Solved

Countdown timer in Apple script

Posted on 2014-12-30
3
1,564 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Create a default user profile for Mac OS X 10.7/10.8 Create a user account on OS X that will be a template for every other user of that computer. I usually call it “profile” and make it an administrator account for the time being. 1. Install a…
A common question or need, when setting-up a new Mac for someone would be to make all of the applications, installed, available from the dock. Many people often do not realize an application is installed unless it is in the dock. Creating a custo…
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 …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

752 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