u_shell_shortcut (tcshlutl.pbl)

This is a wrapper around u_shell_link that simplifies creating shortcuts.

The four main functions will find a shell special directory, create any required subdirectories when appropriate and create a simple shortcut file.

Contents

Low-level functions

High-level functions


uf_create_shortcut(string s_shortcut_name, string s_target_name

Description

Creates a shortcut file anywhere in the file system. This low-level function will not create directories

Arguments

string s_shortcut_name: the name of the shortcut file to create. This should have a .lnk extension

string s_target_name: the name of the executable (or other file) that the shortcut should point at

Returns

integer: 1 on success, -1 on failure.


uf_create_desktop_shortcut(string s_name, string s_target, boolean b_all_users)

Description

Creates a shortcut file on the Desktop, either available to the current user or to all users that use the machine. Since I didn't see much point to creating a shortcuts in subdirectores under the desktop this function will not create subdirectories.

Arguments

string s_name: the name of the shortcut file to create. This should have a .lnk extension. This should not include a path

string s_target_name: the name of the executable (or other file) that the shortcut should point at

boolean b_all_users: if this is true the shortcut will be visible to anyone who logs into this machine, otherwise it will only be visible to the current user.

Returns

integer: 1 on success, -1 on failure.

Example

uo_shell_shortcut.uf_create_desktop_shortcut("Notepad;", "notepad.exe" true)


uf_create_programs_shortcut(string s_name, string s_target, boolean b_all_users)

Description

Creates a shortcut file on the Programs menu, either available to the current user or to all users that use the machine. This function will create the subdirectories required for submenus under the Programs menu.

Arguments

string s_name: the name of the shortcut file to create. This should have a .lnk extension.

string s_target_name: the name of the executable (or other file) that the shortcut should point at

boolean b_all_users: if this is true the shortcut will be visible to anyone who logs into this machine, otherwise it will only be visible to the current user.

Returns

integer: 1 on success, -1 on failure.

Example

// Create the normal PowerBuilder icon
uo_shell_shortcut.uf_create_programs_shortcut("Powersoft 5.0\PowerBuilder 5.0 Intel32;", "pb050.exe" true)


uf_create_startmenu_shortcut(string s_name, string s_target, boolean b_all_users)

Description

Creates a shortcut file on the Start menu itself, either available to the current user or to all users that use the machine. This function will create the subdirectories required for submenus under the Start menu.

Arguments

string s_name: the name of the shortcut file to create. This should have a .lnk extension. This may include subdirectories.

string s_target_name: the name of the executable (or other file) that the shortcut should point at

boolean b_all_users: if this is true the shortcut will be visible to anyone who logs into this machine, otherwise it will only be visible to the current user.

Returns

integer: 1 on success, -1 on failure.

Example

// Fast access to PowerBuilder
uo_shell_shortcut.uf_create_startmenu_shortcut("Quick\PowerBuilder 5.0 Intel32;", "pb050.exe" true)


uf_create_startup_shortcut(string s_name, string s_target, boolean b_all_users)

Description

Creates a shortcut in the Startup menu, either available to the current user or to all users that use the machine. Since I didn't see much point to creating a shortcuts in subdirectores under the Startup menu (would they execute on startup?) this function will not create subdirectories.

Arguments

string s_name: the name of the shortcut file to create. This should have a .lnk extension. This should not include a path

string s_target_name: the name of the executable (or other file) that the shortcut should point at

boolean b_all_users: if this is true the shortcut will be visible to anyone who logs into this machine, otherwise it will only be visible to the current user.

Returns

integer: 1 on success, -1 on failure.

Example

// I want the calculator available on startup
uo_shell_shortcut.uf_create_startup_shortcut("Calculator;", "calc.exe" true)