Created
March 28, 2021 16:02
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use case: custom PDF viewer for Zotero, see here:
https://forums.zotero.org/discussion/88586/unable-to-open-zotero-link-to-pdf-with-page-number-in-microsoft-edge-chromium