Automatically Print Daily Calendar from iCal

Discussion in 'Mac Apps and Mac App Store' started by ee99ee, Jan 27, 2007.

  1. ee99ee macrumors 6502

    ee99ee

    Joined:
    Mar 9, 2006
    #1
    Is there a way I could setup iCal, or some appliaction, to automatically print my daily calendar at a certain time every morning? I'd like to wake up to a printed agenda for the day so I know what's going on...

    Maybe an automator script that runs as a cron job? I've never used automator, so I'm just guessing...

    -Chris
     
  2. swiftaw macrumors 603

    swiftaw

    Joined:
    Jan 31, 2005
    Location:
    Omaha, NE, USA
    #2
    I think you could create a workflow in Automator that if run would print today's calendar.

    To get it to run automatically, create a daily event in ical, and set an alarm for it. Two of the choices for the alarm are "open file" and "run script" one of these might be able to launch the automator workflow you created and thus print you calendar.
     
  3. ianeng macrumors newbie

    Joined:
    Feb 12, 2007
    #3
    UI Script for printing daily calendar

    Here is a UI script I used at one point to print my calendar each morning.

    I hope it is what you are looking for.

    Code:
    tell application "iCal" to quit
    delay 2
    tell application "iCal"
    	activate
    	set frontmost to true
    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 pop up button 1
    			click menu item "Day" of menu 1 of pop up button 1
    			delay 1
    			click pop up button 4
    			click menu item "Today" of menu 1 of pop up button 4
    			delay 1
    			click button "Continue"
    		end tell
    		delay 1
    		tell window "Print"
    			click pop up button 3
    			click menu item "### Change to Name of your Printer ###" of menu 1 of pop up button 3
    			delay 1
    			keystroke return
    		end tell
    	end tell
    end tell
    
    Just past that code into Applescript, input your printer name, schedule a task named something like "print schedule", and set the alarm to 'run script' and select this script.

    Questions? Just ask.

    -Ian
     
  4. lfigarcia macrumors newbie

    Joined:
    Feb 22, 2008
    Location:
    "God's Country", i.e., western WA
    #4
    Request Help with This Script

    H! I am not experienced in compiling scripts. I tried to use yours and got the following:

    "System Events got an error: Can’t get pop up button 3 of window "Print" of process "iCal". Invalid index."

    Also, how do I do the following:

    "schedule a task named something like "print schedule", and set the alarm to 'run script' and select this script."

    As you can see, I am a complete novice! :-D
     
  5. ianeng macrumors newbie

    Joined:
    Feb 12, 2007
    #5
    Well, it looks as though Leopard changed the Print dialog box. This new code should work, but it will simply use the default printer so make sure that is set properly.

    Code:
    tell application "iCal" to quit
    delay 2
    tell application "iCal"
    	activate
    	set frontmost to true
    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 pop up button 1
    			click menu item "Day" of menu 1 of pop up button 1
    			delay 1
    			click pop up button 4
    			click menu item "Today" of menu 1 of pop up button 4
    			delay 1
    			click button "Continue"
    		end tell
    		delay 1
    		tell window "Print"
    			keystroke return
    		end tell
    	end tell
    end tell
    To schedule this to run every morning, create an event in iCal at the time you want your schedule to be printed. Double click on the event and create an alarm that will "run script" and then select this script.

    If you have any more questions, or if that doesn't work, let me know.
    -Ian
     
  6. RumMunkey macrumors 6502a

    RumMunkey

    Joined:
    Nov 3, 2006
    Location:
    Canada
    #6
    [​IMG]

    Selecting "Run a script" as the action for an iCal event alarm.
     
  7. joannadee01 macrumors newbie

    Joined:
    Sep 21, 2014
    #7
    I see open file as an option but not run script - please help



     
  8. Weaselboy macrumors Core

    Weaselboy

    Joined:
    Jan 23, 2005
    #8
    I assume you are on Mavericks? Just use open file then other and select the script.
     
  9. kennabt macrumors newbie

    Joined:
    Jan 13, 2015
    #9
    I would love to get this working. When I execute the script I get this error:

    Result:
    error "Calendar got an error: Can’t set frontmost of application to true." number -10006 from frontmost of application


    I appreciate any help with this!
     
  10. Jarvis in Mind macrumors newbie

    Joined:
    Apr 5, 2015
    #10
    Code:
    tell application "Calendar" to quit
    delay 2
    tell application "Calendar"
    	activate
    end tell
    tell application "System Events"
    	tell process "Calendar"
    		tell menu bar 1
    			tell menu bar item "File"
    				tell menu "File"
    					click menu item "Print…"
    				end tell
    			end tell
    		end tell
    		
    		tell window "Print"
    			click pop up button 1
    			click menu item "Day" of menu 1 of pop up button 1
    			
    			click pop up button 4
    			click menu item "Today" of menu 1 of pop up button 4
    			
    			click button "Continue"
    		end tell
    		
    		tell window "Print"
    			click pop up button 1
    			click menu item "HP LaserJet 1015" of menu 1 of pop up button 1
    			
    			keystroke return
    		end tell
    	end tell
    end tell
     

Share This Page