start an application at a particular time

kalster

Diamond Member
Jul 23, 2002
7,355
6
81
What is the easiest way to start an application at a particular time in Leopard. I want to run a particular application at 12 am everyday. Do i have to write an apple script to do this or is there any application to do this
 

TheStu

Moderator<br>Mobile Devices & Gadgets
Moderator
Sep 15, 2004
12,089
45
91
Originally posted by: kalster
What is the easiest way to start an application at a particular time in Leopard. I want to run a particular application at 12 am everyday. Do i have to write an apple script to do this or is there any application to do this

If you don't mind my asking, what is the application?

Have you checked to see if this application has any built in ability to be scheduled?
 

mugs

Lifer
Apr 29, 2003
48,920
46
91
You could google up crontab and use it to start the application from the command line. For instance you could start iTunes from the command line like so:

/Applications/iTunes.app/Contents/MacOS/iTunes &

Not sure if there are any downsides to this approach
 

TheStu

Moderator<br>Mobile Devices & Gadgets
Moderator
Sep 15, 2004
12,089
45
91
With the command line then you should be able to script the activity.
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
Originally posted by: mugs
You could google up crontab and use it to start the application from the command line. For instance you could start iTunes from the command line like so:

/Applications/iTunes.app/Contents/MacOS/iTunes &

Not sure if there are any downsides to this approach

Rather then call the app directly, I'd probably use applescript to allow me to do more then just start the app if I so desired.

I'd make a file per app (probably in a folder dedicated for this)

Itunes example

tell application "iTunes"
activate
end tell

You can now launch this one of two ways. If you always stay logged in, then iCal is the best choice. You can schedule apps to launch at times via iCal. But if you want the app to run even when you are not logged int, then cron is the way to go.

Inside terminal.app you type crontab -e and place in the script (with some formating to specify exactly when).

example:
30 6 * * 1-5 /Users/username/myscripts/openitunes.scpt
(This runs that script at 6:30am, any day, any month, and long as that day is monday-friday)

or you can make it easier by using a osx gui tool for cron such as Cronnix.

By using applescript, you could actually automate this process even further. Such as automatically starting a song you like, or opening a series of webpages.

example

tell application "iTunes"
activate
set the sound volume to 75
play playlist "Blues"
end tell
 

Injury

Lifer
Jul 19, 2004
13,066
2
81
If it were me, I'd use iCal to launch an automater script. Seems like the most hassle-free way.
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
Yea, iCal is the easiest way to go if you are always logged in. But if you are running an app when you are not logged in (say a script that connects to a ftp server and downloads nightly backups at 1am) iCal will not help ya. Also, some versions of cron (acron) will make sure a task always gets run. For example, if you had the computer off, it will attempt to run it at the next possible time once the computer is turned back on.

Of course on OSX I almost never log out, so I could use iCal and get away with it.
 

mugs

Lifer
Apr 29, 2003
48,920
46
91
Originally posted by: sourceninja
Originally posted by: mugs
You could google up crontab and use it to start the application from the command line. For instance you could start iTunes from the command line like so:

/Applications/iTunes.app/Contents/MacOS/iTunes &

Not sure if there are any downsides to this approach

Rather then call the app directly, I'd probably use applescript to allow me to do more then just start the app if I so desired.

I'd make a file per app (probably in a folder dedicated for this)

Itunes example

tell application "iTunes"
activate
end tell

You can now launch this one of two ways. If you always stay logged in, then iCal is the best choice. You can schedule apps to launch at times via iCal. But if you want the app to run even when you are not logged int, then cron is the way to go.

Inside terminal.app you type crontab -e and place in the script (with some formating to specify exactly when).

example:
30 6 * * 1-5 /Users/username/myscripts/openitunes.scpt
(This runs that script at 6:30am, any day, any month, and long as that day is monday-friday)

or you can make it easier by using a osx gui tool for cron such as Cronnix.

By using applescript, you could actually automate this process even further. Such as automatically starting a song you like, or opening a series of webpages.

example

tell application "iTunes"
activate
set the sound volume to 75
play playlist "Blues"
end tell

:thumbsup: Thanks for the info. I just got back to using a Mac after a 10 year hiatus, so I really don't know what Applescript is capable of these days. I should read up on it, I could really see myself using it a lot. It's funny that OS X gets so much hate from computer nerd types when it has so many great features for people like us.