Jump to content

Complex shortcuts made with vbs


script neanderthal

Recommended Posts

From a 'Run' command it is possible to open a pdf file in Acrobat Reader with parameters:e.g. "C:\Program Files (x86)\Adobe\Reader 10.0\Reader" /A "zoom=100" "K:\Documents\mypdf.pdf"and it is possible to make a desktop shortcut manually to do the same thing. I'd like to be able to create a such a shortcut programmatically using vbscript for example, so as to ensure my particular pdf file is only opened in Acrobat Reader and NOT Acrobat or any other pdf reader which might be installed.

 Set Shell = CreateObject("WScript.Shell")ARpath = Shell.Regread("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe\path")ARapp = Shell.Regread("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe\")PDFfile="K:\Documents\mypdf.pdf"sctarget = """"& ARapp & """" & " /A " & """zoom=100"" " & """"&PDFfile&""""msgbox sctargetShell.run sctarget

this works fine so far, but the shortcut creation part throws up an error.

DesktopPath = Shell.SpecialFolders("Desktop")Set link = Shell.CreateShortcut(DesktopPath & "\mypdf.lnk")link.WorkingDirectory = ARpathlink.TargetPath = sctargetlink.Save

Any suggestions?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...