scripts for setting print preference

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
bbgaw
Newbie
Posts: 13
Joined: Thu May 08, 2008 7:54 pm

scripts for setting print preference

Post by bbgaw » Mon Jun 02, 2008 2:45 pm

Hi,

I want to print a page in Landscape orientation. It seems like WebRecorder cannot record this print procedure. I am not sure how to do it. I wonder if there any sample codes handle this already. and if no, could you please give me some hints.

The procedure is: open the Print window (I know how to do this), then click Preferences, check landscape box, then click ok, then click Print (I know how to do this).

Thanks a lot!

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Jun 02, 2008 3:07 pm

Something like this:

Code: Select all

//Send CTRL+P
Press CTRL
Send>p
Release CTRL


//Wait for the print dialog
WaitWindowOpen>Print

//Send ALT-r to invoke Preferences
Press ALT
Send>r
Release ALT

//Wait for the Printing Preferences dialog
WaitWindowOpen>Printing Preferences

//Go to the Basics tab
Press CTRL
Press Tab * 4
Release CTRL

//ALT-O to go to Orientation
Press ALT
Send>o
Release ALT

//Down one to Landscape
Press Down

//Press Enter to OK
Press Enter

WaitWindowClosed>Printing Preferences

SetFocus>Print
Press Enter

I say *something* like that because the dialogs may vary for your OS and printer driver. The above works for me in Vista with my default printer.

Actually, it's quicker to do it via Print Preview:

Code: Select all

//Select Print Preview
Press ALT
Send>fv
Release ALT

//Wait for the Print Preview window
WaitWindowOpen>Print Preview

//ALT-L selects landscape mode
Press ALT
Send>l
Release ALT

//ALT-P prints
Press ALT
Send>p
Release ALT
This is for IE7.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts