Create a ShortcutTag(s): WinAPI/Registry


oleobject ws, loo_shortcut
string ls_desktop

ws = CREATE oleobject
ws.ConnectToNewObject("WScript.Shell")

// other "specialfolder" of interest
//  AllUsersDesktop
//  AllUsersStartMenu
//  AllUsersPrograms
//  AllUsersStartup
//  Desktop
//  Favorites
//  MyDocuments
//  Programs
//  Recent
//  SendTo
//  StartMenu
//  Startup
ls_desktop = ws.SpecialFolders("Desktop")
loo_shortcut = ws.CreateShortcut(ls_desktop +"\realhowto.lnk")
loo_shortcut.TargetPath = "http://www.rgagnon.com/howto.html"
loo_shortcut.WorkingDirectory = ls_desktop

// 1 Activates and displays a window.
//   If the window is minimized or maximized, the system restores it to
//   its original size and position.
// 3 Activates the window and displays it as a maximized window.
// 7 Minimizes the window and activates the next top-level window.
loo_shortcut.WindowStyle = 1
loo_shortcut.IconLocation = &
  ws.ExpandEnvironmentStrings("%WINDIR%\SYSTEM\url.dll , 0")

loo_shortcut.Save
CreateShortcut() is also used to read an existing shortcut.
ls_desktop = ws.SpecialFolders("AllUsersDesktop")
loo_shortcut = ws.CreateShortcut(ls_desktop +"\Mozilla Firefox.lnk")
ls_firefoxPath  = loo_shortcut.TargetPath

MessageBox("FF path", ls_firefoxPath)

blog comments powered by Disqus