ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Call To AcroExch.App In VB Script Fails

    IT Discussion
    1
    2
    321
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • garak0410G
      garak0410
      last edited by

      I found a VBScript years ago that will print only the first page of multiple PDF files. You just drag the PDF's over the shortcut to the script and it works...

      '//Print first page of pdfs
      
      set WshShell = CreateObject ("Wscript.Shell")
      set fs = CreateObject("Scripting.FileSystemObject")
      Set objArgs = WScript.Arguments
      
       
      
      if objArgs.Count < 1 then
      msgbox("Please drag a file on the script")
      WScript.quit
      end if
      
       
      
      Set gApp = CreateObject("AcroExch.App")
      gApp.show '<- comment or take out to work in hidden mod
      
       
      
      'open via Avdoc and print
      for i=0 to objArgs.Count - 1
      FileIn = ObjArgs(i)
      Set AVDoc = CreateObject("AcroExch.AVDoc")
      If AVDoc.Open(FileIn, "") Then
        Set PDDoc = AVDoc.GetPDDoc()
        Set JSO = PDDoc.GetJSObject
        jso.print false, 0, 0, true
        gApp.CloseAllDocs
      end if
      next
      
       
      
      gApp.hide : gApp.exit : Quit()
      MsgBox "Done!"
      
       
      
      Sub Quit
      Set JSO = Nothing : Set PDDoc = Nothing : Set gApp =Nothing : Wscript.quit
      End Sub
      

      This script has worked through Windows 7, 10, 11 and multiple versions of Adobe Acrobat.

      Now, the script will not work and it shows this:

      594f5332-c159-4a39-91a4-7d89a1de24bb-image.png

      Line 25 is this:

      Set AVDoc = CreateObject("AcroExch.AVDoc")
      So here's the troubleshooting I've done so far before I focused on line 25:

      Removed print drivers and reinstalled as either WSD, full drivers and generic drivers (all HP's)
      Tried to uninstall recent Windows 11 Updates but it immediatley reinstalls it on reboot.
      Ran the script on a Windows 10 machine with a much older copy of Adobe Acrobat and it works.

      So I am guessing it has something to do with recently updated versions of Acrobat...which is 2023.006.20320.

      So, is this related to recent Adobe Acrobat updates and if so, is there another command to use to "call" Acrobat?

      garak0410G 1 Reply Last reply Reply Quote 0
      • garak0410G
        garak0410 @garak0410
        last edited by

        For now, I removed the newest Acrobat and reloaded a perpetual 2017 version and it is working again. Clearly something in the last Acrobat Update or maybe a combo of it with Windows Update.

        1 Reply Last reply Reply Quote 1
        • 1 / 1
        • First post
          Last post