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,358
2,727
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!
 
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
 
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.
 
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.