rudi Posted May 22, 2013 Share Posted May 22, 2013 Hi. I need to bulk check and change the page settings -> paper tray settings (first page, other pages) for several thousand word documents. The reason is, that the former printer was a HP 2xxx, tray 2 was blank paper A4. Now that printer was retired, the printouts are handled by a Xerox Workcentre, that has to select the appropriate tray filled with A4 blank paper on it's own. The secretaries now have to change the settings for 1st and all other pages from "Tray 2" to "Tray autoselect", otherwise the Xerox Workcentre won't print the jobs (-> Jobs get stuck: Wrong paper in Tray 2: A3). And, no, switching the paper between the Xerox` trays is not an option, because then we would have the similar issue for other users using the same printer. How to search for DOCX files with fixed paper tray settings in the document's "Page Settings" (German: Seite einrichten)? change the "paper tray" settings to "Auto select tray" automatically? Any suggestions appreciated, no matter, what's the approach. Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
water Posted May 22, 2013 Share Posted May 22, 2013 Using Microsoft Word COM. FirstPageTry and OtherPagesTray Property of the PageSetup object. If you like this approach I can give you a stripped down version of the code. Using the Word UDF or my WordEX would be too slow. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
rudi Posted May 23, 2013 Author Share Posted May 23, 2013 Hi Water, Thanks for your reply. yes, of course I'm interested in your code as a draft to bulk change our DOCX. A question upon your Word UDF or your WordEX: Another approach might be to write a Autoit app, that... is set as the default application for DOC/DOCX, so it's started, when such a document is double clicked. Then it checks the standard printer (HP or Xerox Workcenter) if HP, then set printer tray to "Tray Two" if Xerox, then set printer trays to "select automatically" Then start WinWord.exe %1 The Downside would be, that this way the word documents are always changed, when they are just opened. (Tivoli TSM Backup is doing incremental for ever. We keep all versions for 4 months, after that the latest 4 versions for ever. When I "touch" the DOCX exteranally with an autoit script *BEFORE* WinWord is opening them, this will trigger a new version even in case the document wasn't saved when exiting Winword) Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
water Posted May 27, 2013 Share Posted May 27, 2013 In short (untested and without any error checking): #Include <WordEx.au3> $oWord = _Word_Create() ; WdPapertray enumeration: http://msdn.microsoft.com/en-us/library/bb237921(v=office.12).aspx Global Const $wdPrinterDefaultBin = 0 $aDocs = _FileListToArray(@ScriptDir, "*.docx") ; Process all *.docx in the current directory For $i = 1 to $aDocs[0] $oDoc = _Word_DocOpen($oWord, $aDocs[$i]) $oDoc.PageSetup.FirstPageTray = $wdPrinterDefaultBin $oDoc.PageSetup.OtherPagesTray = $wdPrinterDefaultBin ; Use _WordDocSave or _Word_DocSaveAs to save the document _Word_DocClose($oDoc) Next _Word_Quit($oWord) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
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