I encountered a mysterious bug with AppleScript and OSX 10.9.1.
This code works inside AppleScript Editor, but when I save it as an application, "giving up after" doesn't work. It works in my other computer with 10.6.8 (Snow Leopard) though. Does anyone know what's the issue? Thanks!
global fullTime
global chosenTime
set pickFromList to {1, 2}
choose from list the pickFromList with prompt "Next message will dissapear after 1 + x seconds. Choose x!"
set chosenTime to result as text
add1sec()
display dialog "Click OK and the next dialog box will appear in " & fullTime & " seconds"
delay fullTime
display dialog "Works! But now this should dissapear after " & fullTime & " seconds" giving up after fullTime
on add1sec()
set fullTime to chosenTime + 1
end add1sec
Updating to OSX 10.9.2 fixed this issue.