Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Browser Print Preview Page
This worked for me. I hope it does for someone else.
stan littlefield
;// Display Print Preview of Browser Document ;// Lot's of Other Constants To Play with - using 2004F ;// stan littlefield, January 9, 2003 ; generic routine - courtesy of Jay Alverson ; I added a Readystate loop #definesubroutine startMSIE(cURL) Browser = objectopen("InternetExplorer.Application") Browser.addressbar = @false Browser.statusbar = @false Browser.menubar = @false Browser.toolbar = @false Browser.visible = @true browser.navigate(cURL) WaitForPageLoad() ; setup the document object... browserDoc = Browser.Document all = browserdoc.all return(browser) #endsubroutine #DefineSubroutine WaitForPageLoad() ; assume Browser While browser.busy || browser.readystate == 1 TimeDelay(0.5) EndWhile While browser.Document.ReadyState != "complete" TimeDelay(0.5) EndWhile return #EndSubroutine ; constants for the ExecWB() method OLECMDID_NEW = 2 OLECMDID_SAVE = 3 OLECMDID_SAVEAS = 4 OLECMDID_SAVECOPYAS = 5 OLECMDID_PRINT = 6 OLECMDID_PRINTPREVIEW = 7 OLECMDID_PAGESETUP = 8 OLECMDID_SPELL = 9 OLECMDID_PROPERTIES = 10 OLECMDID_CUT = 11 OLECMDID_COPY = 12 OLECMDID_PASTE = 13 OLECMDID_PASTESPECIAL = 14 OLECMDID_UNDO = 15 OLECMDID_REDO = 16 OLECMDID_SELECTALL = 17 OLECMDID_CLEARSELECTION = 18 OLECMDID_ZOOM = 19 OLECMDID_GETZOOMRANGE = 20 OLECMDID_UPDATECOMMANDS = 21 OLECMDID_REFRESH = 22 OLECMDID_STOP = 23 OLECMDID_HIDETOOLBARS = 24 OLECMDID_SETPROGRESSMAX = 25 OLECMDID_SETPROGRESSPOS = 26 OLECMDID_SETPROGRESSTEXT = 27 OLECMDID_SETTITLE = 28 OLECMDID_SETDOWNLOADSTATE = 29 OLECMDID_STOPDOWNLOAD = 30 OLECMDID_ONTOOLBARACTIVATED = 31 OLECMDID_FIND = 32 OLECMDID_DELETE = 33 OLECMDID_HTTPEQUIV = 34 OLECMDID_HTTPEQUIV_DONE = 35 OLECMDID_ENABLE_INTERACTION = 36 OLECMDID_ONUNLOAD = 37 OLECMDID_PROPERTYBAG2 = 38 OLECMDID_PREREFRESH = 39 null = ObjectType("NULL", "") cURL = "http:\\www.winbatch.com" br = startMSIE(cURL) BoxOpen("Preparing Print Preview", "Please Wait...") browser.ExecWB(OLECMDID_PRINTPREVIEW, 0, null, null ) BoxShut() Exit ;// end of scriptAnd here is a further developed script, wherein I have incorporated several suggestions into the script, added an ini file and included an xml/xsl pair to test with. ( I selected a poem about Spring, as it just went to 18 here, after a high of 71 2 days ago ).
stan littlefield
MSIEPrev.zip
objShell = CreateObject("Shell.Application") objInstances = objShell.windows objIE = 0 If objInstances.Count > 0 ; make sure we have instances open. ForEach objIE In objInstances sName = StrLower(objIE.FullName) If StrIndex( sName, 'iexplore.exe', 1, @FWDSCAN ) != 0 ; internet explorer not windows explorer. ret = AskYesNo( "Found instance of InternetExplorer ":objIE.LocationURL, "Would you like to refresh?" ) If ret objInstances = 0 objShell = 0 Break EndIf EndIf Next EndIf If objIE == 0 Pause('Notice', 'Unable to locate any running instances of InternetExplorer') EndIf OLECMDID_REFRESH = 22 null = ObjectType("NULL", "") objIE.ExecWB(OLECMDID_REFRESH, 0, null, null ) Exit
Article ID: W15647
File Created: 2017:08:29:11:58:48
Last Updated: 2017:08:29:11:58:48