Newbie has question for iCal

So I’m not new to Macs, but new to AS, so here’s the question:

I would like to do the following - Check and see if iCal is running, and if not, open iCal each morning before I get to work, and have the main window open and on top so I can see what I have to do for that Day/Week/Month,

Is this something that I can code with AS? I know that if I leave iCal open I can run a script during the night that could conceivably open the window, but will it work if the computer is asleep? Also, if iCal is not running, can I set an AS to execute at a certain time to open iCal:

(try
tell application “iCal”
launch
end tell
end try)

and then open the window?

Running 10.3.8 dual 2Ghz G5

Thanks for the help-

Andy

Hi,

The app Cronnix does a good job at setting crontabs that run scripts at certain times:

http://h5197.serverkompetenz.net/cronnix/

A simple script like:

tell app “iCal” to activate

would run iCal or bring it to the front.

If you set your computer to always run, but allow sleep for display, then you can have the script awaken the computer. Otherwise, I think in Panther, there is a setting in the System Preferences Energy Saver that allows you to wake up the system at a certain time.

gl,

Thanks for the info on Cronnix kel, that seems like it will work well as far as the timing of things, but I still can’t seem to figure out how to get the main window open if iCal is already running, but the window is closed.

When I’m running ScriptEditor, and trying to record a script, when I select “iCal” from the “Window” menu in the iCal app nothing registers in the script window, and I have no idea what code to use to call that function. Does anyone know how to call the window to open from inside a script?

kel, thanks also for the much more concise version of the script I had discovered.

Andy

Hi,

What about this:

tell application “iCal”
activate
set visible of window “iCal” to true
end tell

gl,

Kel,

the “set visible of window” command is exactly what I was looking for!

I also had some trouble with the creation of the Script as an .app, which I figured out. It was opening Script Editor each time, and displaying a window with two buttons, “Run” to run app, or “Quit” to quit. I realized that when saving the script out, there are some check boxes in Script Editor down around the drop-down menu for the Script/Application choices, and I had “Startup Screen” checked. I unchecked it, and checked “Run Only”.

Now everything works like a dream, whether iCal is open or closed, the script will always bring the window up every morning @ 8:30 am sharp. Thanks with your help on this!!

Andy

Hi Andy,

Glad you got it going.

run only means that you can’t modify it anymore. It’s not necessary to have this checked and probably better not to.

gl,