Class Win32::Shortcut
In: shortcut.rb
Parent: Object

Methods

Constants

VERSION = '0.2.1'
SHOWNORMAL = 1   Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
SHOWMAXIMIZED = 3   Activates the window and displays it as a maximized window.
SHOWMINNOACTIVE = 7   Displays the window in its minimized state, leaving the currently active window as active.
Arguments = args
Description = desc
HotKey = key
IconLocation = location
TargetPath = link_path
WindowStyle = style
WorkingDirectory = directory

Public Class methods

Creates and returns a Shortcut object. In block form it yields self and automatically ensures that Shortcut#save is called at the end of the block. In non-block form it does not actually create the shortcut until the Shorcut#save method is called.

Identical to Shortcut#new except that it will raise an ArgumentError unless the file already exists.

Public Instance methods

Returns any arguments (i.e. command line options) for the shortcut.

Sets the arguments (i.e. command line options) for the shortcut.

Returns the description (i.e. comment) for the shortcut.

Sets the description for the shortcut.

Returns the file name of the shortcut.

Returns the hotkey (i.e. shortcut key) associated to the shortcut, in the form of a 2-byte number of which the first byte identifies the modifiers (Ctrl, Alt, Shift) and the second is the ASCII code of the character key.

Sets the hotkey for the shortcut.

Returns the name of the file that contain the icon for the shortcut. In practice this is almost always blank. YMMV.

Sets the name of the icon file to be used for the shortcut.

Returns the target of the shortcut. This is, joined with arguments, the content of the "Target" field in a Shortcut Properties Dialog Box. The target name is returned in 8.3 format.

Sets the target of the shortcut.

Attempts to automatically resolve a shortcut and returns the resolved path, or raises an error. In case no resolution was made, the path is returned unchanged.

Note that the path is automatically updated in the path attribute of the Shortcut object.

show_cmd()

Alias for window_style

show_cmd=(style)

Alias for window_style=

target_path()

Alias for path

target_path=(link_path)

Alias for path=

Returns the type of window style used by a shortcut. The possible return values are ‘normal’, ‘maximized’, or ‘minimized’.

Sets the window style to a shortcut. The style can be one of the following three constants or equivalent string values:

  • SHOWNORMAL or ‘normal‘
  • SHOWMAXIMIZED or ‘maximized‘
  • SHOWMINNOACTIVE or ‘minimized‘

Please see the documentation for those constants for further details.

Returns directory in which the targeted program will be executed. Correspond to the "Start in" field of a Shortcut Properties Dialog Box.

Sets the directory in which the targeted program will be executed.

[Validate]