Solved

Countdown timer in Apple script

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MAC Needs 2 Domains 2 53
Save Excel documents to PDF and RETAIN color 16 131
teamviewer how can we hear remote system audio? 1 29
Mini Mac disk problem 7 28
iCloud Drive was introduced after iOS 8 was launched last year. This drive is Apple’s online storage device that lets users sync their files and access them from all their Apple devices.   There is a lot of data that is not automatically backed up…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
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 …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

22 Experts available now in Live!

Get 1:1 Help Now