Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

johannnn

macrumors 68020
Original poster
Nov 20, 2009
2,204
2,306
Sweden
Hi!

I have this applescript:

Code:
repeat
	display dialog "Take a break!" buttons {"Ok"} default button 1
	delay 600
end repeat

I have saved this as minibreak.app file and have it running reminding me to take short breaks. Problem is, these popup windows happens in the background, I just hear the popup sound and see the dock icon jumping. I would like to bring these windows to the front so I never miss them.

I googled and tried to add
Code:
set window 1 of application "minibreak" to frontmost
but that did not work.

Does anyone have an idea on how to solve this?

Thanks!
 

McGordon

macrumors member
Dec 28, 2010
63
1
Scotland
Just activate it to bring your script to the front.

Code:
repeat
	activate
	display dialog "Take a break!" buttons {"Ok"} default button 1
	delay 600
end repeat
 

johannnn

macrumors 68020
Original poster
Nov 20, 2009
2,204
2,306
Sweden
Thanks! That was an easy fix.

Also, I can't quit this program either by right clicking on the Dock icon or by clicking Close in the Apple menu. Does anyone know why this is? I have to force quit it every time.
 

mysterytramp

macrumors 65816
Jul 17, 2008
1,334
4
Maryland
You can't quit because of this:

Code:
display dialog "Take a break!" buttons {"Ok"} default button 1

Or more precisely "buttons {"Ok"} default button 1"

Ordinarily, display dialog would present two buttons, OK and Cancel. With Cancel, you'd be able to exit the script gracefully. But by adding "buttons {"Ok"} default button 1" you've told AS you don't want the standard.

Change that one line to:

Code:
display dialog "Take a break!"

If you press "OK," the script proceeds normally and delays 600 seconds. Hit cancel and it exits.

mt
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.