Can anyone help me find where I’ve gone wrong with this? Ideally I’d like to use the Mail PDF, but I could just as easily create the PDF everyday and then mail it…
tell application "iCal" to quit
delay 2
tell application "iCal"
activate
set frontmost to true
switch view to day view
end tell
tell application "System Events"
tell process "iCal"
tell menu bar 1
tell menu bar item "File"
tell menu "File"
click menu item "Print."
end tell
end tell
end tell
delay 5
tell window "Print"
click button "Continue"
end tell
end tell
delay 1
tell process "iCal"
tell window "Print"
tell menu button "PDF"
tell menu item "Mail PDF"
click menu item "Mail PDF"
end tell
end tell
end tell
end tell
end tell
this works for me 10.5.2 though on my system a few of the delays aren’t needed, but I left them in
tell application "iCal" to quit
delay 2
tell application "iCal"
activate
set frontmost to true
switch view to day view
end tell
activate application "iCal"
tell application "System Events"
tell process "iCal"
click menu item "Print." of menu 1 of menu bar item "File" of menu bar 1
delay 5
click button "Continue" of window "Print"
delay 1
click menu button "PDF" of window "Print"
delay 1
click menu item "Mail PDF" of menu 1 of menu button "PDF" of window "Print"
end tell
end tell
Nope. I get the old “System Events got an error: NSReceiverEvaluationScriptError: 4” when it tries to make the actual PDF.
It could be a 10.4 thing, which I am on. And looking back I see that my sig was not posted. My apologies; I could have sworn I included it.
Thanks for the reply.
Mike
Browser: Firefox 2.0.0.13
Operating System: Mac OS X (10.4)
Well I’ll try testing that out some today on a tiger machine.
James,
Any chance you had time to check your script out on a Tiger machine? I did a bunch of research and what I’ve found is that the PDF buttons from iCal’s Print dialog are almost impossible to find through AS.
I ended up using Automator to “Summarize” the day’s events. The only problem with this is that its only a text file. The PDF that iCal generates is very readable, and much easier to get a handle on a day’s schedule at a glance. Sure wish it would work…
Mike
Browser: Firefox 2.0.0.13
Operating System: Mac OS X (10.4)