Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No shortcut of not excisiting software 1

Status
Not open for further replies.

jongag1

Technical User
Feb 1, 2002
65
NL
Hello,

We use a script for generating shortcuts on the client desktops. On a few clients we have installed extra software which is not on the other clients.
Now, on the clients where the additional software is not installed, comes up shortcuts which are useless.

Is it possible to check if the software excists on the client before generating the shortcut? And if the software is not available skip the shortcut?

In our script we have 10 shortcuts, below are 2 off them. The 1st one is available on all clients, the second on just a few clients.

Hope somebody can help me with this.

Kind regards,
Age

Code:
'	Create shortcut to Microsoft Internet Explorer

'set WshShell = WScript.CreateObject("Wscript.Shell")
'strDesktop = WshShell.SpecialFolders("Desktop")
'set oShellLink = WshShell.CreateShortcut(strDesktop & "\Internet Explorer.lnk")
'oShellLink.IconLocation = "C:\Program Files\Internet Explorer\iexplore.exe ,0"
'oShellLink.TargetPath = "C:\Program Files\Internet Explorer\iexplore.exe"
'oShellLink.WorkingDirectory = ""
'oShellLink.Save

'	Create shortcut to Clarify

set WshShell = WScript.CreateObject("Wscript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\(nacht) Clarify.lnk")
oShellLink.IconLocation = "C:\Program Files\Clarify\eFrontOffice10.1.1\ClarifyClient\clarify.exe ,0"
oShellLink.TargetPath = "C:\Program Files\Clarify\eFrontOffice10.1.1\ClarifyClient\clarify.exe"
oShellLink.WorkingDirectory = "C:\Program Files\Clarify\eFrontOffice10.1.1\ClarifyClient"
oShellLink.Save
 
Do you think that the below code will work?
(I am a bit scared to test it in the real environment)

Code:
'    Create shortcut to Clarify

Dim fso
   Set fso = CreateObject("Scripting.FileSystemObject")
   If (fso.FileExists("C:\Program Files\Clarify\eFrontOffice10.1.1\ClarifyClient\clarify.exe")) Then
	set WshShell = WScript.CreateObject("Wscript.Shell")
	strDesktop = WshShell.SpecialFolders("Desktop")
	set oShellLink = WshShell.CreateShortcut(strDesktop & "\(nacht) Clarify.lnk")
	oShellLink.IconLocation = "C:\Program Files\Clarify\eFrontOffice10.1.1\ClarifyClient\clarify.exe ,0"
	oShellLink.TargetPath = "C:\Program Files\Clarify\eFrontOffice10.1.1\ClarifyClient\clarify.exe"
	oShellLink.WorkingDirectory = "C:\Program Files\Clarify\eFrontOffice10.1.1\ClarifyClient"
	oShellLink.Save
   End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top