How to show info dialogue ?

Hi all,

Just started with Eggplant, so I have a newbie question... I have made a script that is supposed to start a certain time, but when I start the script I'd like to have some kind of popup telling any interested users that the start time is X hours, Y minutes and Z seconds. This popup dialogue is to be updated every second, just to show that the script is active and counting down. When the start time occurs, the popup dialogue will be closed.

Is there any clever script or command for a popup dialogue (tried with 'answer "Start time: " & start_time', but then I don't know how to close the popup...)

Any suggestions are welcome!

/TC

Comments

  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Currently, the Ask and Answer commands don't provide a mechanism to dismiss them automatically. There is a way to achieve something like what you want, though, but it requires using AppleScript.

    It's not too hard to do, but unfortunately we've found that because Eggplant runs scripts in a background thread, the only way to make it reliable is to have AppleScript tell the Finder to display the panel. It may seem a little strange, and causes some slightly annoying side effects (like switching of windows) but it will do more or less what you want.

    Here's an example script that counts down. I don't know of a way to update the text while a panel is up, so this puts the panel up repeatedly with an update of the time remaining.
    put "Starting at " & the long time
    
    set secondsRemaining to 20 seconds
    set stopTime to the time + secondsRemaining
    
    repeat while secondsRemaining is greater than zero
    	set answer to doAppleScript of merge of {{
    tell application "Finder"
    
    set x to display dialog "This application will proceed automatically in [[secondsRemaining]] seconds" buttons {"Stop","Proceed"} giving up after [[minimum(4,secondsRemaining)]]
    
    end tell
    activate application "Eggplant"
    get button returned of x
    }}	
    	
    	if answer is "Stop" then exit all
    	if answer is "Proceed" then exit repeat
    	set secondsRemaining to round(stopTime - the time)
    end repeat
    
    put "Proceeding at " & the long time
    
  • ok, thanks - I'll try it out.

    /TC
Sign In or Register to comment.