I wrote a script which detects OS and triggers the right install progame according to the OS version.
It is working well under 9.1, 9.2, 10.2 and 10.3.
But the script is showing a script error under 10.0 and 10.1 .
The error message is “A descriptor type mismatch occured”.
Jason gave me a possible reason, but I can’t test it right now because I do not have version 10. 0 and 10.1 here. I am very in a hurry to solve it out, so I want to know more information.
I appreciate any help.
Below is the script source.
copy my gestaltVersion_info(“sysv”, 4) to {system_version, system_string}
set me_ to path to me
if the system_version is less than “1000” then – this checks for OS X 10.0.0
tell application “Finder”
set appContainer to container of me_ as text
set appInstall to (appContainer & “Classic MacOS:Install”)
open file appInstall
end tell
else
tell application “Finder”
set appContainer to container of me_ as Unicode text
set appInstall to (appContainer & “MacOS X:Install”)
open file appInstall
end tell
end if
on gestaltVersion_info(gestalt_code, string_length)
try
tell application “Finder” to ¬
copy my NumToHex((system attribute gestalt_code), ¬
string_length) to {a, b, c, d}
set the numeric_version to {a, b, c, d} as string
if a is “0” then set a to “”
set the version_string to (a & b & “.” & c & “.” & d) as string
return {numeric_version, version_string}
on error
return {“”, “unknown”}
end try
end gestaltVersion_info
on NumToHex(hexData, stringLength)
set hexString to {}
repeat with i from stringLength to 1 by -1
set hexString to ((hexData mod 16) as string) & hexString
set hexData to hexData div 16
end repeat
return (hexString as string)
end NumToHex