Sometimes it is necessary to check for a particular AS version to determine the existence of certain functionality. This returns a boolean telling you if your minimum AS version requirements are met. It should work under any OS/AS version except AS 1.6 - see the error note.
Will compile slightly differently under late AS versions - ‘computer’ will be replaced by ‘system attribute’ - where the Finder tell is not required. Removing the Finder tell speeds up the handler considerably and can be done if your script is definitely not going to be running under anything earlier than AS 1.8.3.
OS version: Any
-- minASVers -- by Richard Morton 2004 --
-- Determine if the AS version is sufficient
-- Pass a 3 digit number corresponding to the minimum version required
-- USAGE: set haveAS192 to minASVers at 192
--> true -- if running AS 1.9.2 or higher, otherwise false
-- Input: integer - three digit number representing the minimum AS version required, e.g. 130 for AS 1.3; 155 for AS 1.5.5
-- Output: boolean - true if the AS version is that or higher, otherwise false.
-- Error: AS 1.6 can be quite problematic to test for. May return error number -1708 under this version.
on minASVers at reqVers
set numList to characters of ("1100" & (reqVers as string))
set decNum to 0
repeat with num in numList
set decNum to (16 * decNum) + num
end repeat
tell application "Finder" to set ascv to (system attribute "ascv")
if ascv < decNum then return false
return true
end minASVers