ari Posted September 9, 2010 Posted September 9, 2010 Hello, I have a project: print MS word jobs with different page range (not the whole job). Right now, in AutoIt, I use: Dim $WordDoc = $WordObj.Documents.Open($file) $WordDoc.PrintOut This will print all pages. Don't know if AutoIt can do like VB does: Activedocument.Activewindow.PrintOut _ Range:=wdPrintFromTo, From:="1", To:="3" Or any other ideas? Please help. Thanks!
PsaltyDS Posted September 9, 2010 Posted September 9, 2010 Yes AutoIt can use that COM method syntax, the parameter strings just have to be quoted properly and enclosed in parens. Something like: $WordDoc.PrintOut('Range:=wdPrintFromTo, From:="1", To:="3"') Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
ari Posted September 9, 2010 Author Posted September 9, 2010 Thank you for the info. I tried it on AutoIt v3, it's failed. Any other ideas?
PsaltyDS Posted September 9, 2010 Posted September 9, 2010 (edited) Well, you probably need the actual value of wdPrintFromTo instead of the string variable name: Global Const $wdPrintAllDocument = 0 Global Const $wdPrintSelection = 1 Global Const $wdPrintCurrentPage = 2 Global Const $wdPrintFromTo = 3 Global Const $wdPrintRangeOfPages = 4 ; ... get $WordDoc somehow... $WordDoc.PrintOut('Range:=' & $wdPrintFromTo & ', From:="1", To:="3"')Ref: MSDN: PrintOut MethodRef: MSDN: Word Enumerated Constants Edited September 9, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
ari Posted September 10, 2010 Author Posted September 10, 2010 I have tried. I can't make PrintOut('') work, instead _WordDocPrint function works well with Ranges. Thanks
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now