Solved

Countdown timer in Apple script

Posted on 2014-12-30
3
1,421 Views
Last Modified: 2015-01-03
Hello All,

I am trying to create a Apple script code where in it can display a timer for 15 minutes.
After the 15 minutes the script invokes another application.
The timer is just a alert message for the user to close his documents.
I did use the display dialog through repeat but it I do not want the display to pop up every time.
Only the time should decrease from the display message.
Like 15:00 then 14:59, 14:58.
Please help.
Thanks
0
Comment
Question by:karthik80c
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Simon earned 500 total points
ID: 40525225
In plain Applescript, you can only do a repeat with a static dialog. Presumably you want to do this so the you don't get the 'flicker' of the dialog box being re-displayed every second? You can reduce the re-display by updating the timer less frequently...
repeat with i from 15 to 1 by -1
	set Dlg to display dialog "You have " & return & i & " minutes left to decide" buttons {"Yes", "No"} default button ¬
		"Yes" with icon caution giving up after 60
	if (button returned of Dlg) is "Yes" then
		return "Yes"
		exit repeat
	else if i = 1 or (button returned of Dlg) is "No" then
		return "No"
		exit repeat
	end if
end repeat

Open in new window


You could also get a bit fancier and change the repeat time from minutes to seconds when you get down to the final minute.

However, I'd say the only way to do exactly what you requested is to build an Cocoa-Applescript application in XCode.
0
 

Author Comment

by:karthik80c
ID: 40525347
Thank you for your response.
I will use the cocoa-applescript and check whether am able to do that.
0
 

Author Comment

by:karthik80c
ID: 40529174
Dear Simon

I did try using a Cocoa - Apple script as suggested by you. I am new to that. So I searched different forums to get the one I require.
Could you please provide me a solution to the following query. Thank you for your help.
http://www.experts-exchange.com/OS/Apple_Operating_Systems/OS_X/Q_28590069.html
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes in detail how to set up the iPad in the Enterprise using iPCU aka iPhone Configuration Utility.  This could also be used for the iPhone although I have not detailed out any differences. Preparation as an iPad Administrator:…
There is a security feature on iOS devices that is nearly impenetrable when it has been activated.  This article will provide some possible solutions as well as necessary steps to take to ensure you do not end up with a locked device.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question