Save Method |
Description
Saves a shortcut object to disk.
PowerBASIC Syntax
Remarks
After using the CreateShortcut method to create a shortcut object and set the shortcut object's properties, the Save method must be used to save the shortcut object to disk. The Save method uses the information in the shortcut object's FullName property to determine where to save the shortcut object on a disk. You can only create shortcuts to system objects. This includes files, directories, and drives (but does not include printer links or scheduled tasks).
Example [PowerBASIC]
#INCLUDE "WSHOM.INC"
' Creates an instance of the Windows Script Host LOCAL pWsh AS IWshShell pWsh = NEWCOM "WScript.Shell"
' Creates a shortcut programatically (if it already exists, CreateShortcut opens it) LOCAL pLnk AS IWshShortcut pLnk = pWsh.CreateShortcut(UCODE$(EXE.PATH$ & "Test.lnk"))
' Sets variuos properties and saves them to disk pLnk.Description = UCODE$("Hello world") pLnk.WorkingDirectory = UCODE$(EXE.PATH$) pLnk.Arguments = UCODE$("/c") pLnk.HotKey = UCODE$("Ctrl+Alt+e") pLnk.IconLocation = UCODE$(EXE.PATH$ & "PROGRAM.ICO,0") pLnk.RelativePath = UCODE$(EXE.PATH$) pLnk.TargetPath = UCODE$(EXE.PATH$ & "EX_WHLNK_CreateShortcut.EXE") pLnk.WindowStyle = %WshNormalFocus pLnk.Save
' Get the parameters to to see if they have changed STDOUT "Shortcut description: " & ACODE$(pLnk.Description) STDOUT "Shortcut working directory: " & ACODE$(pLnk.WorkingDirectory) STDOUT "Shortcut arguments: " & ACODE$(pLnk.Arguments) STDOUT "Shortcut hot key: " & ACODE$(pLnk.HotKey) STDOUT "Shortcut icon location: " & ACODE$(pLnk.IconLocation) STDOUT "Shortcut target path: " & ACODE$(pLnk.TargetPath) STDOUT "Shortcut window style: " & FORMAT$(pLnk.WindowStyle)
|