Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys/Gals,

I have created this little script to copy the icon shortcut with url shortcut
that will install a shortcut to the specific website with a defined icon, on employees desktops. I'm currently using VBScript to create the shortcut. Below is the working code:

VB
Set WshShell = CreateObject("WScript.Shell")
strDesktopPath = WshShell.SpecialFolders("Desktop")
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\Shortcut name goes here.lnk")
objShortcutUrl.TargetPath = "Web link goes here"
objShortcutUrl.IconLocation = "icon path goes here"
objShortcutUrl.Save


At the moment it does not give any confirmation if the shortcut has been copied onto the desktop, the script is working fine it does push the icon shortcut. But I am wondering if a prompt pops up saying "Icon copied or installed successfully etc." Can a line be added in the script for prompt popup??

I would appreciate any help please. Thanks in advance.
Posted
Updated 18-Aug-12 3:44am
v9
Comments
[no name] 17-Aug-12 17:42pm    
"Can a line be added in the script"... of course you can. I am going to out on a limb and assume that your real question is something like "How can I show a message box?" or something like that.... and the answer can be found here, http://www.databison.com/index.php/vba-message-box-msgbox-the-message-can-do-better/
[no name] 17-Aug-12 18:00pm    
Tnx Wes Aday. I tried the above link but not sure if i am doing it correctly. I just added the below code in the vbs script. For e.g.
<pre lang="vb">Set WshShell = CreateObject("WScript.Shell")
strDesktopPath = WshShell.SpecialFolders("Desktop")
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\Shortcut name goes here.lnk")
objShortcutUrl.TargetPath = "Web link goes here"
objShortcutUrl.IconLocation = "icon path goes here"
objShortcutUrl.Save
Dim Response As VbMsgBoxResult
Response = MsgBox("Do you wish to be terminated?", vbYesNo + vbQuestion)

Select Case Response
Case vbYes
' terminate
Case vbNo
' do not terminate
End Select </pre>

This doesn't seems to be working. Any thoughts or advise plz
[no name] 17-Aug-12 18:34pm    
What does "doesn't seems to be working" mean? Do you get the message box? It does not terminate?
[no name] 17-Aug-12 19:24pm    
Apologies, yes not getting the message box. Getting the script error. here's the screenshot http://i46.tinypic.com/vrzd3c.jpg

 
Share this answer
 
Comments
Espen Harlinn 18-Aug-12 12:33pm    
Nice link :-D
I got this code which does the job.
VB
x=msgbox("Your Text Here" ,0, "Your Title Here")
 
Share this answer
 
Comments
Espen Harlinn 18-Aug-12 12:33pm    
5'ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900