admin 發表於 2017-11-30 05:26:33

Passing spaces into parms in SalLoadApp

SalLoadApp('C:\\Program Files\\Java\\j2re1.4.2_06\\bin\\javaw.exe ', '-jar -Xss512k ' || 'C:\\Program" "Files\\APP_EXTENSIONS\\CustSchedCustUniqFlds2.jar ' || SqlUser || ' ' || SqlPassword || ' ' || SqlDatabase || ' ' || hWndForm.frmCustomerSchedule.dfsCustomerNo || ' ' || hWndForm.frmCustomerSchedule.dfsCustomerPartNo || ' ' || hWndForm.frmCustomerSchedule.ecmbDocNo.i_sMyValue || ' ' || SalNumberToStrX(hWndForm.frmCustomerSchedule.dfnScheduleNo, 0) || ' ' || hWndForm.frmCustomerSchedule.dfsShipAddrNo)


---maximum length of 256 characters----
Call SalLoadApp ( 'C:\\program files\\internet explorer\\iexplore.exe' , SalStrRepeatX ( 'x',207) ) !--> works.
Call SalLoadApp ( 'C:\\program files\\internet explorer\\iexplore.exe' , SalStrRepeatX ( 'x',208) ) !--> NOT works.

How SalLoadApp Works

Using SalLoadApp with Command Line Arguments: You can start another application by calling SalLoadApp. You can use SalLoadApp to pass command line arguments from one application to another.

The format for SalLoadApp is: SalLoadApp( strAppName, strParameters )

where strAppName is the application to start and strParameters is the command line arguments.

A space in strParameters marks the end of one argument (token) and the start of the next (if any). For example, if you pass this string in strParameters:


SalLoadApp( 'example.exe', 'one two three' )

then strArgArray contains "one", "two", and "three" respectively and nArgCount contains 4. Centura does not pass the spaces to the application.

To pass a space in an argument, place a double quote character before and after it. For example, to pass the string "Hello there" in strArgArray and "Centura" in strArgArray:

SalLoadApp( 'example.exe', 'Hello" "there ' || 'Centura' )

Those are double quote characters before and after the space between "Hello" and "there". Also, there is a space after "there" which tells Centura that this is the end of this token and the start of the next.


Centura has two system variables for command line arguments.
nArgCount is the number of command line arguments.
StrArgArray is an array of strings that contains the command line arguments.
Centura reads each command line argument into an element of strArgArray when an application starts. The 0th (Zero) element is the application name.

strArgArray and Space Characters


You must enclose literal strings, including those which contain only spaces, in single quotes. In the example below, the strings that follow each argument and contain only a space character serve to separate the arguments.

Call SalLoadApp ( 'testapp.exe', 'DEMO' || ' ' || 'SYSADM' || ' ' || 'SYSADM' )

The above statement, written literally, would be:

SalLoadApp ( 'testapp.exe', 'DEMO SYSADM SYSADM' )
頁: [1]
查看完整版本: Passing spaces into parms in SalLoadApp