Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Do you mean this?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Do you mean this?
Authored by: bluehz on Feb 24, '03 07:33:04AM

thx - that was it exactly!

There used to be a timeout parameter for "display dialog" that would close the dialog after reset time period. Does any one know if that still works.



[ Reply to This | # ]
giving up after seconds...
Authored by: ChaChi on Jun 10, '05 05:24:45PM
To make an applescript dialog timeout after a specified length of time you'd just add "giving up after (seconds)" to the "display dialog" command.

Here's an example that will "timeout" after 5 seconds:

osascript -e 'tell application "Finder"' -e 'activate' -e 'display dialog "Hello World" buttons {"Cancel", "OK"} default button 2 giving up after 5' -e 'end tell'

Here's another way of doing this using "System Events" instead of the "Finder":

osascript -e 'set theReturn to ASCII character 10' -e 'set theIcon to posix file "/Applications/Utilities/Terminal.app/Contents/Resources/icon.icns"' -e 'tell application "System Events"' -e 'set FrontMostApp to (name of processes whose frontmost is true) as string' -e 'activate' -e 'set thePassword to text returned of (display dialog "Enter Your Administrator Password:" buttons {"Cancel", "OK"} default button 2 default answer "password" with title "Terminal Alert" giving up after 60 with icon file theIcon with hidden answer)' -e 'set frontmost of process FrontMostApp to true' -e 'end tell' -e 'return theReturn & "The Password Entered Was: \"" & thePassword & "\"" & theReturn'

Hope this helps...

[ Reply to This | # ]
Do you mean this?
Authored by: ChaChi on Jun 10, '05 05:30:24PM
Sorry, the last part of the second example above should read:
-e 'return theReturn & "The Password Entered Was: \"" & thePassword & "\"" & theReturn
I thought I had checked the code for any "special" characters.

[ Reply to This | # ]