• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
    • Text Templates
    • Templated Reporting System
    • HTML, Markdown, and JavaScript Integration
    • Action Invoker
      • Overview
      • Execution Environments
      • Security, Resource Management, and Formatting Options
      • Base Actions
      • Application Namespace
      • Clipboard Namespace
      • Data Namespace
      • Dictionary Namespace
      • File Namespace
      • Hash Namespace
      • Localhost Namespace
      • Logic Namespace
      • Message Namespace
      • Path Namespace
      • Settings Namespace
      • Sqlite Namespace
      • System Namespace
        • System Action Invoker Namespace
        • System.createShortcut Action
        • System.getSharableUri Action
        • System.selectDocument Action
        • Sharable URI
      • UI Namespace
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataManager>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

System.createShortcut Action

Format
CS.System.createShortcut(target := ...
                     
ʃ, label := ...ʅ
                     
ʃ, longLabel := ...ʅ
                     
ʃ, icon := ...ʅ)
ArgumentDescriptionTypes / Required
targetThe file path of an application or file that is the target of the shortcut.string
required
labelA label describing the shortcut. If not defined, the target's filename (without an extension) is used.string
not required
longLabelA longer, more descriptive, label that may be used when space permits.string
not required
iconThe file path of an icon to use for the shortcut.string
not required
Description
The System.createShortcut action creates a shortcut to a CSPro application or file. The way that the shortcut is created depends on the execution environment.
On Windows, a shortcut is added as a Shell link. The shortcut is placed on the Desktop and is named based on the label. If longLabel is provided, it is used as the shortcut's description.
On Android, a shortcut is added as a pinned shortcut that can be added to the Android launcher (the home screen). The label is used as the shortcut's short label. If longLabel is provided, it is used as the shortcut's long label. Android guidance recommends maximum label lengths of 10 and 25 characters, respectively. A shortcut is not automatically created but instead Android displays a screen that allows the user to drag the shortcut to the home screen, or click a button to add it to the home screen automatically. Given this requirement for user intervention, it is not guaranteed that a shortcut is actually created.
An icon can be associated with a shortcut. On Windows, icons can be specified in any format that the Image.load function handles. On Android, icons can be specified in any format supported by Android's BitmapFactory. Generally ICO (.ico) files are used on Windows and PNG (.png) files are used on Android. If designing an icon for cross-platform use, it is best to use the PNG format. On both platforms, the icon file will be copied to CSPro or system storage, so the icon can be a temporary file.
If an icon is not specified, the icon will default to the file type's icon on Windows, and the traffic light icon (representing PFF files) on Android.
Return Value
The action returns undefined.
Exceptions
The action throws an exception if any of its arguments are not specified in a valid form, or if:
  • The target or icon file do not exist.
  • The icon file cannot be read by the system.
  • The Android version does not support pin shortcuts (a version lower than 8.0).
Example (CSPro Logic)
CS.System.createShortcut(target := "Congestion-Pricing-Survey.pff",
                         
label := "Congestion",
                         
longLabel := "Congestion Pricing Survey",
                         
icon := "Images/Traffic-Icon.png");
See also: System Action Invoker Namespace