| Previous | Next | |
STF.createShortcut(targetFile:String, arguments:String, shortcutFile:String, description:String, iconFile:String, iconNumber:Number) : BooleantargetFile - Name (including the full path) of the file the shortcut should point to.
arguments - WINDOWS ONLY - Command-line arguments for the targetFile file. This argument is ignored on the Mac.
shortcutFile - Name and location of the shortcut. On Windows the shortcut must have an .lnk extension.
description - WINDOWS ONLY - Description of the shortcut. This argument is ignored on the Mac.
iconFile - WINDOWS ONLY - Name (including the path) of the file containing the icon to be used for this shortcut. This argument is ignored on the Mac.
iconNumber - WINDOWS ONLY - Ordinal number of the icon within the iconFile. This argument is ignored on the Mac.
A boolean.; ; This value is returned as a parameter to the registered callback. See the example below or STF.registerCallBack() for more information on return variable handling.
Method; Creates a shortcut to an existing file. If a fully qualified path is not specified, the working directory is used.
The following example creates a shortcut to a file in the Programs Folder (Applications directory on the Mac) on the desktop. The example below first gets the desktop and programs fodler paths then creates the shortcut.
var programsDir:String;
var desktopDir:String;
// define callback function for STF.getSpecialFolder("DESKTOP");
function onGetDesktopDirReturn(returnValue:String) {
desktopDir = returnValue;
STF.unregisterCallBack("getSpecialFolder", onGetDesktopDirReturn, this);
//unregister the callback and get next path
STF.registerCallBack("getSpecialFolder", onGetProgramsDirReturn, this);
STF.getSpecialFolder("PROGRAMS");
}
// define callback function for STF.getSpecialFolder("PROGRAMS");
function onGetProgramsDirReturn(returnValue:String) {
programsDir = returnValue;
STF.unregisterCallBack("getSpecialFolder", onGetProgramsDirReturn, this);
createShortCutOnDesktop();
}
//register the first special folder callback
STF.registerCallBack("getSpecialFolder", onGetDesktopDirReturn, this);
//call the first special folder cmd
STF.getSpecialFolder("DESKTOP");
function createShortOnDesktop() {
if (STF.platform_str == "WIN") {
/*== Windows Implementation ==*/
sourcePath = programsDir+"/iTunes/iTunes.exe";
destinationPath = desktopDir+"\\File.lnk";
STF.createShortcut(sourcePath,"",destinationPath,"Shortcut","",0);
} else {
/*== Mac Implementation ==*/
sourcePath = programsDir+"/Tunes";
destinationPath = desktopDir+"/Desktop/iTunes";
STF.createShortcut(sourcePath,"",destinationPath,"","",0);
}
}| Questions or Feedback? | Previous | Next |