Solved

Countdown timer in Apple script

Posted on 2014-12-30
3
1,190 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:
SimonAdept 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

A lot of new and distinct gadgets are making their appearance every other day. The latest gadget that has wooed the attention of all gadget lovers and non gadget lovers alike is the Smartwatch. This tiny gadget is capable of offering live access to …
Set up iPhone and iPad email signatures to always send in high-quality HTML with this step-by step guide.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now