I have a script which basically pops ip a display dialog and asks to enter a number. Technically the numbers should be 3 characters long, such as XXX however what i’d like is let’s say if someone enters 3, then it automatically adds two zeros in front of the number, like 3 would become 003 and if someone enters 18 then it becomes 018… and if someone enters 121 then it remains the same.
so far, i have this
display dialog "What is the Number?" default answer ""
set the orig_page to the text returned of the result
if (count orig_page) is not in 3 then
set low_page to "0" & orig_page
end if
what this does is, if the character is eg. 8, then it only adds one zero to make it 08 and if its 18 then it makes it 018, but if i enter 121 then it does nothing. I think i need to set a “try” statement or something… can someone guide me in the right direction? thanks!