I’ll start by saying I’m very new to AppleScript. I’ve picked up a bit on my own but am currently stumped.
I’m working with a repeat that currently ensures that the text returned of specific dialog box is no greater than 0.2. I have it working just fine in that if any value greater than 0.2 is entered, the user is given an error dialog box and subsequently returned to the previous dialog box. Upon entering a value less than 0.2, the user is advanced to the next dialog box. Here’s my issue:
I would like to write in script that also ensures the text returned of that specific dialog box is a numeric value and not text. I’m sure it’s that I don’t have a full understanding of the language yet, but I keep getting a syntax error or trapping myself within the repeat. Here is the repeat I have without the latter issue written in. Any help would be greatly appreciated.
repeat
set SATp to text returned of (display dialog "Saturday Daily Sales/Traffic Percentage (as a decimal)" buttons {"Cancel", "Next"} default button 2 with title "TEST" with icon file "Macintosh HD:Users:Everett:Desktop:Folder:TEST_icon.icns" default answer "0.0")
if SATp is greater than 0.2 then
display dialog "Error: Saturday Daily Sales/Traffic should not exceed 0.2. Please review your numbers." buttons {"Cancel", "Back"} default button 2 with title "ERROR" with icon file "Macintosh HD:Users:Everett:Desktop:Folder:error.icns"
else
exit repeat
end if
end repeat