Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
4

VB Script - AVDOC Not Working In Fully Updated PC's

Community Beginner ,
Sep 19, 2023 Sep 19, 2023

I created a VSScript years ago that will print only the first page of multiple PDF files. You just drag the PDF's over the shortcut to the scrip 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:

scriptPrinting.jpg

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? 

TOPICS
Edit and convert PDFs , Modern Acrobat , PDF
995
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 20, 2023 Sep 20, 2023

Does anyone know if AVDoc was removed/changed in the recent update? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 25, 2023 Sep 25, 2023
LATEST

Does it work correctly if I select and run "disable new acrobat" instead of the new UI?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines