IURLShortcut

Represents a shortcut to an URL in AdvancedInstaller project.

Declaration

IURLShortcut : IDispatch

Overview

Using this interface you can edit the URL shortcut.

Properties

String Name
- Sets or Gets the URL shortcut name.

String URL
- Sets or Gets the URL shortcut address.

IFolder ShortcutFolder
- Sets or Gets the URL shortcut location.

String RunMode
- Sets or Gets the URL shortcut run-mode. It can be: Normal, Maximized,Minimized.

Methods

Icon(IFile iconFile, int iconIndex = 0)
-Sets the icon for the URL shortcut. If the file is an .ico, the index is by default 0. In case of a .dll or .exe file, the index can be specified.

DeleteFile()
-This method will delete the URL shortcut from the project. The object on which this method is called is no longer available for editing.

Example

$advinst = new-object -comObject "AdvancedInstaller"
$proj    = $advinst.CreateProject($advinst.ProjectTypes.Architect)

# add url shortcuts
$url_sh1 = $proj.ShortcutsComponent.CreateURLShortcut($proj.PredefinedFolders.ShortcutFolder, "Test URL Shortcut", "https:/test.com")
$url_sh2 = $proj.ShortcutsComponent.CreateURLShortcut($proj.PredefinedFolders.ShortcutFolder, "My URL Shortcut", "https:/advancedinstaller.com")

# add a file for shortcut icon
$file_icon = $proj.FilesComponent.AddFile($proj.PredefinedFolders.ApplicationFolder,"$currentPath\resources\resources-powershell\procexp.exe")

# set icon
$url_sh1.Icon($file_icon, 2)

# edit url shortcut
$url_sh2.Icon($file_icon)
$url_sh2.RunMode = "Maximized"
$url_sh2.ShortcutFolder = $proj.PredefinedFolders.Desktop

# save the project
$proj.SaveAS($projPath)

# delete an url shortcut
$url_sh1.DeleteFile()

$proj.Save()

See also

IShortcutsComponent