Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

gpchess2k

macrumors member
Original poster
Oct 12, 2015
42
0
I can't seem to figure out how to work with exponential numbers properly. The variable 'DriverVersion' always spits out a decimal number and I would like to compare them using operators. I simplified my script below:

Code:
set DriverVersion to "4.2.0"

tell application "Finder"
if DriverVersion < "4.12" then
display dialog "Driver outdated. UPDATING!" buttons {"Close"} default button "Close" with icon caution

if DriverVersion > "4.12" then
display dialog "Newest driver already found!" buttons {"Close"} default button "Close" with icon caution

else

display dialog "ELSE. INSTALLING DRIVER!" buttons {"Close"} default button "Close" with icon caution

end if
end if
end tell
 
Code:
set DriverVersion to 4.2 -- real
--log class of DriverVersion
--set DriverVersion to "4.2" -- text
--log class of DriverVersion

if DriverVersion < 4.12 then
    display dialog "Driver outdated. UPDATING!" buttons {"Close"} default button "Close" with icon caution
   
else if DriverVersion > 4.12 then
    display dialog "Newest driver already found!" buttons {"Close"} default button "Close" with icon caution
   
end if

Info : AppleScript defines classes for working with real and integer values
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.