Solved

Why can I not use the colons in this shortcut creation?

Posted on 2014-01-12
5
195 Views
Last Modified: 2014-01-12
Remove the Colons and it works, but I need the colons.
Option Explicit 

'Enumerate all variables
Dim strDesktop, oUrlLink, WshShell, oShellLink

	set WshShell = WScript.CreateObject("WScript.Shell")
	strDesktop = WshShell.SpecialFolders("Desktop")
	set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")
	oShellLink.TargetPath = "C:\Program Files (x86)\NaviCare Systems\NaviCare7.1\cpmnav32.exe" & " -cFLShandsUF_MGR:navicare.shands.ufl.edu:7024" & " -uOR" & " -zview"
	oShellLink.WindowStyle = 1
	oShellLink.Hotkey = "CTRL+SHIFT+F"
	oShellLink.Description = "BedBoard"
	oShellLink.WorkingDirectory = strDesktop
	oShellLink.Save

Open in new window

0
Comment
Question by:pphreadr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 100 total points
ID: 39775615
Targetpath can only contain the executable. You have to put arguments into arguments

Try this:

oShellLink.TargetPath = "C:\Program Files (x86)\NaviCare Systems\NaviCare7.1\cpmnav32.exe" 
oShellLink.Arguments = " -cFLShandsUF_MGR:navicare.shands.ufl.edu:7024  -uOR  -zview"

Open in new window

0
 

Author Closing Comment

by:pphreadr
ID: 39775667
Outstanding. Just what I needed. thanks.
0
 

Author Comment

by:pphreadr
ID: 39775680
any way to make the target and switches variables?
0
 

Author Comment

by:pphreadr
ID: 39775686
Something like this. I will then read a file to set the variables.
Option Explicit 

'Enumerate all variables
Dim strDesktop, oUrlLink, WshShell, oShellLink, objServer, objUser, objPasswd, objTarget

	set objTarget = "C:\Program Files (x86)\NaviCare Systems\NaviCare7.1\cpmnav32.exe"
	set objServer = "-cFLShandsUF_MGR:navicare.shands.ufl.edu:7024"
	set objUser = "-uOR"
	set objPasswd = "-zview"
	set WshShell = WScript.CreateObject("WScript.Shell")
	strDesktop = WshShell.SpecialFolders("Desktop")
	set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")
	oShellLink.TargetPath = objTarget
	oShellLink.Arguments = objServer & " " & objUser & " " & objPasswd
	oShellLink.WindowStyle = 1
	oShellLink.Hotkey = "CTRL+SHIFT+F"
	oShellLink.Description = "BedBoard"
	oShellLink.WorkingDirectory = strDesktop
	oShellLink.Save

Open in new window

0
 

Author Comment

by:pphreadr
ID: 39775689
OK, I got it.
Option Explicit 

'Enumerate all variables
Dim strDesktop, oUrlLink, WshShell, oShellLink, objServer, objUser, objPasswd, objTarget

	objTarget = "C:\Program Files (x86)\NaviCare Systems\NaviCare7.1\cpmnav32.exe"
	objServer = "-cFLShandsUF_MGR:navicare.shands.ufl.edu:7024"
	objUser = "-uOR"
	objPasswd = "-zview"
	set WshShell = WScript.CreateObject("WScript.Shell")
	strDesktop = WshShell.SpecialFolders("Desktop")
	set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")
	oShellLink.TargetPath = objTarget
	oShellLink.Arguments = objServer & " " & objUser & " " & objPasswd
	oShellLink.WindowStyle = 1
	oShellLink.Hotkey = "CTRL+SHIFT+F"
	oShellLink.Description = "BedBoard"
	oShellLink.WorkingDirectory = strDesktop
	oShellLink.Save

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question