Jump to content

How to create / Edit a Desktop shortcut in LabVIEW


Recommended Posts

Hi

I wonder if anybody could give me pointers in creating a Windows XP desktop shortcut with LabVIEW or how edit an existing one. Working in LabVIEW 8.2.1

I can see how to do this with WshShell commands (the Windows shell scripting environment) but not with LabVIEW.

I did try playing around with the "IWshRuntimeLibrary.IWshShell2" ActiveX object but though I can find a CreateShortCut invoke method I seem unable to do anything constructive with it.

cheers

Dannyt

Link to comment

Have you looked up the IShellLink interface? There's probably a third-party commandline interface available somewhere if you look hard enough.

I will have a look at IShellLink thanks.

I was try to avoid a thirdparty option if possible and just do it with LabVIEW so I did not have to deploy anything out with the LabVIEW. Maybe there is a registry key ?

If I was going in the thirdparty direction I could code up a WSH example myself

'Create a Desktop ShortCut

set WshShell = WScript.CreateObject("WScript.Shell")

strDesktop = WshShell.SpecialFolders("Desktop")

set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut To Notepad.lnk")

oShellLink.TargetPath = "Notepad.exe" 'WScript.ScriptFullName

oShellLink.WindowStyle = 1

oShellLink.Hotkey = "CTRL+SHIFT+N"

oShellLink.IconLocation = "notepad.exe, 0"

oShellLink.Description = "Shortcut To Notepad."

oShellLink.WorkingDirectory = strDesktop

oShellLink.Save

cheers

Dannyt

Link to comment

Sorry, my examples posted earlier were in 8.5.1.

Here they are back saved to 8.0.

Bruce

Bruce,

many many thanks to you for that, works a treat, +1 rep to you sir :-)

LAVA to the rescue again. I was at least please I was heading onto the right lines

NOTE for anyone else downloading the 8.0 version, you file Create Shortcut.vi has the 8.5 version of Set Shortcuproperties in it so remember to put the new 8.0 one in its place

Dannyt

Edited by dannyt
Link to comment

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.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.