Hi,
You could try something like this:
var oType = xfa.host.appType;
var oVersion = xfa.host.version;
if (oType == "Reader" && oVersion < 7)
{
app.alert("some message...);
}
if (oType == "Extended" | oType == "Extended-Pro" && oVersion < 9)
{
app.alert("a different message...");
}
I haven't tested it and I know from previous experience that it is difficult to get a "app.execMenuItem("Close");" script to work. The best we achieved was to have a hidden numeric field with the initialised value set to zero. This hidden field had script, if its value was changed to 1 then it executed the "close" script.
If the criteria was met that the file should not be opened instead of the app.alert above we had script thta changed the value from 0 to 1, invoking the "close" event. Because the PDF had changed (numeric field changing from 0 to 1) the user was asked if they wanted to save the file before closing. As part of that was a cancel button, which if clicked meant that the file did not close.
This was a real messy work around, so I will be interested to see if someone has a more elegant solution.
Good luck,
Niall