Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Creating a Shortcut to a Nonfile Object

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,34349
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Creating a Shortcut to a Nonfile Object
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Creating a Shortcut to a Nonfile Object - 5/10/2006 11:58:48 AM   
  CyberGuy

 

Posts: 4
Score: 0
Joined: 3/13/2006
Status: offline
How do I create a shortcut to a nonfile object, such as a printer?
 
 
Post #: 1
 
 RE: Creating a Shortcut to a Nonfile Object - 5/11/2006 12:28:26 AM   
  Country73


Posts: 735
Score: 10
Status: offline
I don't believe you can actually create a shortcut to a printer.
If you try to create a shortcut manually, the wizard actually states:
   This wizard helps you to create shortcuts to local or networks programs, files, folders, computers, or Internet addresses.
 
I haven't ever tried to create a shortcut to a printer before, and I was unable to do so manually, so I would have to say no on that.

(in reply to CyberGuy)
 
 
Post #: 2
 
 RE: Creating a Shortcut to a Nonfile Object - 5/11/2006 1:56:30 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
For what it is worth, you can make a shortcut to a printer. Click:

Start->Settings->Printers and Faxes

Then right click on a printer and choose Create Shortcut.

This is on XP. Don't know about older OSs.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Country73)
 
 
Post #: 3
 
 RE: Creating a Shortcut to a Nonfile Object - 5/11/2006 2:55:53 AM   
  Country73


Posts: 735
Score: 10
Status: offline
I stand corrected...

(in reply to ebgreen)
 
 
Post #: 4
 
 RE: Creating a Shortcut to a Nonfile Object - 5/11/2006 4:03:20 AM   
  CyberGuy

 

Posts: 4
Score: 0
Joined: 3/13/2006
Status: offline
I know how to create a shortcut to a non-file object such as a printer using point-and-click, but that's not what I'm asking. I'm asking how to do it via Visual Basic/VBScript. There is an MSDN article at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/shortcuts/shortcut.asp which describes how to do this at the bottom, but I don’t have enough knowledge to make it work. I’m not talking about how to make a shortcut to a special folder; I can do that already with the code below. I need to make a shortcut to an object inside that special folder.
 
Option Explicit
Const NETWORK_CONNECTIONS = &H31&
Dim WshShell : Set WshShell = WScript.CreateObject("WScript.Shell")
Dim objShell : Set objShell = CreateObject("Shell.Application")
Dim objFolder : Set objFolder = objShell.Namespace(NETWORK_CONNECTIONS)
Dim objFolderItem : Set objFolderItem = objFolder.Self
Dim strDesktop: strDesktop = WshShell.SpecialFolders("Desktop")
Dim objShellLink : Set objShellLink = WshShell.CreateShortcut(strDesktop & "\Link File.LNK")
objShellLink.TargetPath = objFolderItem.Path
objShellLink.Save

(in reply to CyberGuy)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Creating a Shortcut to a Nonfile Object Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts