Jump to content
script neanderthal

Complex shortcuts made with vbs

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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...