Skip to content

Instantly share code, notes, and snippets.

@qqobb
Created March 28, 2021 16:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qqobb/39a554f6f3f9a274ae05d46424a7572c to your computer and use it in GitHub Desktop.
Save qqobb/39a554f6f3f9a274ae05d46424a7572c to your computer and use it in GitHub Desktop.
Open a PDF file at a specific page in MS Edge using Acrobat's command-line syntax.
' Name : acro2edge.vbs
' Purpose : Open a PDF file at a specific page in MS Edge using Acrobat's command-line syntax.
' Details : VBScript for Windows Script Host, tested on Windows 10.
' Example : acro2edge.vbs /A page=3 "C:\...\file.pdf"
Option Explicit
Dim WshShell, strEdge, k
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim numArg : numArg = WScript.Arguments.Count
Dim arrArg() : ReDim arrArg(numArg - 1)
Dim s1, s2 : s1 = """" : s2 = """ """
strEdge = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
For k = 0 to UBound(arrArg)
arrArg(k) = WScript.Arguments.Item(k)
Next
If numArg = 0 Then
WshShell.Run s1 & strEdge & s1, 1, False
ElseIf numArg = 3 And UCase(arrArg(0)) = "/A" Then
WshShell.Run s1 & strEdge & s2 & "file:///" & arrArg(2) & "#" & arrArg(1) & s1, 1, False
Else
WshShell.Run s1 & strEdge & s2 & Join(arrArg, s2) & s1, 1, False
End If
@qqobb
Copy link
Author

qqobb commented Mar 28, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment