Difference: InvokingWindowsShellFunctions (2 vs. 3)

Revision 32016-02-18 - JeanNeron

Line: 1 to 1
 
META TOPICPARENT name="RunningWindowsFunctionsFromAPPX"

Invoking Windows Shell Functions

In order to invoke a Windows shell function (such as a batch file or executable) from APPX for Windows, you can use a syntax similar to the following. (You'll have to break the SET statement apart into multiple APPENDs, but it is presented here as single strings, for clarity.)

Line: 13 to 12
 

This assumes the command we want to run is already formatted in --- TEMP 512. We enclose the entire command in quotes in case of embedded spaces. The '/w' switch tells APPX to wait for the command to complete before continuing. If you don't need to wait, you can leave that switch out.

Added:
>
>
You can also use the full path & file name of a file directly in the RUN command, ie, RUN C:\WINDOWS\SYSTEM32\NOTEPAD.EXE, however note that APPX will not wait for the command to complete. If you need to wait for the command to complete, use the '/w cmd.exe /c' syntax. Remember that when you use the RUN command, it will be executed on the server, not the client. If you need to run the command on the client PC, see .CLIENT LOAD URL.

To pass parameters to the command, simply execute PASS <field name> or PASS <Filename>, then append a $* to your command. For example:

      SET      --- TEMP 80                    =      APARAMETER
      PASS     --- TEMP 80                    FIELD            SHARE? N
      PASS     CAR CUSTOMER                   FILE             SHARE? N
      SET      --- TEMP 79                    =      D:\TEST.BAT $* 
      RUN      --- TEMP 79                                 END? N  FAIL 0

Executing a PASS with the File parameter will pass the complete path of that file to the command (without the .dat extension).

You can also control the order the parameters are PASSed. The '$*' syntax will PASS the parameters in the order of the PASS statements, but you can also refer to '$1', '$2', etc. In the example above, if we executed 'D:\TEST.BAT $2 $1', the batch file would receive the path to CAR CUSTOMER first, followed by the contents of --- TEMP 80.

See Passing Fields or File Names for more information passing values to external commands.

Troublehshooting

If you can't get your command to execute the way you expect, try logging on to the server console and running the client directly on the server. Use the 'Local' tab to connect to the engine. You will be able to see any messages, dialog boxes or errors that appear.

 

Older APPX/Windows Versions

The following might be useful if you are running very old software.

Line: 82 to 107
  Before:
Changed:
<
<
====================== = =================================== 013 REMOVE DIRECTO+------------------------------------------------+ 014 SUBMIT JOB & Command String & 015 GET SESSION PI& & 016 KILL TASK &cat6 & 017 VIEW FILE &{PRINTQ.HEX OPTIONS}6 & XX8 SUBMIT PRINT J&{BANNER FILE}6 & &{PRINTQ.PATH FILE}6 & &|lp -oraw6 & &{PRINTQ.SUBMIT DETAIL}6 & &2>&1 |awk '/^request id is/{print "0" \$4}6 & &/^\\/usr\\/bin\\/lp/{print "1" \$0}' & & & & & +------------------------------------------------+
>
>
====================== = =================================== 013 REMOVE DIRECTO+------------------------------------------------+ 014 SUBMIT JOB & Command String & 015 GET SESSION PI& & 016 KILL TASK &cat6 & 017 VIEW FILE &{PRINTQ.HEX OPTIONS}6 & XX8 SUBMIT PRINT J&{BANNER FILE}6 & &{PRINTQ.PATH FILE}6 & &|lp -oraw6 & &{PRINTQ.SUBMIT DETAIL}6 & &2>&1 |awk '/^request id is/{print "0" \$4}6 & &/^\\/usr\\/bin\\/lp/{print "1" \$0}' & & & & & +------------------------------------------------+
  After:
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback