• <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
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
        • SystemApp Statement
        • SystemApp.setArgument Function
        • SystemApp.exec Function
        • SystemApp.getResult Function
        • SystemApp.clear Function
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

SystemApp.setArgument Function

Format
b = system_app_name.setArgument(argumentʃ, valueʅ);
Description
The SystemApp.setArgument function adds an argument to a SystemApp object. The argument will later be used when the system application is executed. The string expression argument and the optional string or numeric expression value are processed differently on Android and Windows platforms.
Return Value
The function returns a logical value of 1 (true).
Android Example
On Android, a system application is typically an Android activity. Each argument will be part of the "extras" passed in the Intent Bundle that opens the activity. If value is a string expression, it will be put as a String extra associated with the name argument. If value is a numeric expression, it will be put as a double extra associated with the name argument. If value is not specified, a null String extra will be used. There is special processing for three argument types:
  • "action": The value is used as the action when calling Intent.setAction.
  • "data": The value (which should be URI-encoded) is used as the data when calling Intent.setData.
  • "type": The value is used as the MIME data type when calling Intent.setType.
// get directions to the U.S. Census Bureau using Google Maps
SystemApp google_maps_navigation;
google_maps_navigation.
setArgument("action", "android.intent.action.VIEW");
google_maps_navigation.
setArgument("data", "google.navigation:q=U.S.+Census+Bureau");
google_maps_navigation.
exec("com.google.android.apps.maps");
References to files can be shared with the other application by calling the System.getSharableUri action and passing the resulting URI as the "data" argument.
Windows Example
On Windows, a system application is an executable program. On Windows, every argument is turned into a command line argument passed to the executable. If an argument is provided without a corresponding value and the argument contains spaces and is not wrapped in quotes, the argument will be surrounded by quotes so that it is processed as a single argument by the executable. If a value is provided, then the argument and value are concatenated and will not be surrounded by quotes. If value is numeric, it will be converted to a string.
// plays the song in Windows Media Player, becoming:
// wmplayer.exe "Quick Escape.mp3"
SystemApp windows_media_player;
windows_media_player.
setArgument("Quick Escape.mp3");
windows_media_player.
exec("wmplayer.exe");

// opens the Census Bureau website in Chrome's Incognito mode, becoming:
// chrome.exe --args --incognito https://www.census.gov
SystemApp chrome;
chrome.
setArgument("", "--args --incognito");
chrome.
setArgument("https://www.census.gov");
chrome.
exec("chrome.exe");
See also: SystemApp Object, SystemApp.exec Function