cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Mac/Linux trigger Java GUI Scripting from command line

0 Likes
2,994

Scenario

I am able to trigger a javascript file from command line like this:

test1.js

application.openConnectionByConnectionString("conn=/H/10.10.10.100/S/3200&expert=true");
application.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtRSYST-MANDT").text = "220";
application.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtRSYST-MANDT").setFocus();
application.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtRSYST-MANDT").caretPosition = 3;
application.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtRSYST-BNAME").text = "username";
// The text of a password field is not recorded. Either enter a valid password or delete the following line
application.findById("/app/con[0]/ses[0]/wnd[0]/usr/pwdRSYST-BCODE").text = "secret";
application.findById("/app/con[0]/ses[0]/wnd[0]").resizeWorkingPane(181,35,false);
application.findById("/app/con[0]/ses[0]/wnd[0]").sendVKey(0);
application.findById("/app/con[0]/ses[0]/wnd[0]/tbar[0]/okcd").text = "/nex";
application.findById("/app/con[0]/ses[0]/wnd[0]").sendVKey(0);
#!/bin/bash
export SAPGUIDIR="/Applications/SAP Clients/SAPGUI 7.50rev5/SAPGUI 7.50rev5.app/Contents/Resources"
export WORKDIR=`pwd` # this is where the script file is located

cd "${SAPGUIDIR}"
echo "[DEBUG] starting..."

java \
	-cp Java/GuiStartS.jar com.sap.platin.Gui \
	-n \
	-b \
	-f ${WORKDIR}/test1.js

echo "[DEBUG] done!"

Problem
JavaGUI does not quit. There is a popup that says "The script has successfully completed its execution".

If I run the command again, I get another copy of JavaGUI running ...

How can I get JavaGUI to quit completely?

Please could anyone share a link to the full JavaScript API?

View Entire Topic
RMW
Product and Topic Expert
Product and Topic Expert
0 Likes

Using parameter -? will print the list of parameters.

0 Likes

LOL, reverse-engineering the documentation...

...there is no mention of "NOPHANTOM" - not even the mighty Google has any record of this feature

"/Applications/SAP Clients/SAPGUI 7.50rev5/SAPGUI 7.50rev5.app/Contents/MacOS/SAPGUI" -h
2020-01-31 16:34:14.902 SAPGUI[77876:3663785] Task succeeded.
############################# ERROR #############################
31.01. 16:34:16.926 ERROR: Getopt.nextOption(): Unrecognized option: -h
############################# ERROR #############################
com.sap.platin.base.logon.GuiImpl: start program for PlatinGui
Usage: com.sap.platin.base.logon.GuiImpl [options]
Available options:
/Rfc=[0-9A-F][0-9A-F]* RFC id to send to backend during connect
-o <hostSpec>opens a connection to <hostSpec> (e.g. /H/binmain/S/3253)
-f <fileName>executes the script contained in the file <fileName>
-s <script>executes the script contained in string <script<
-w opens a script window for manual script input
-n doesn't show guilogon window
-t <traceKeys> activates all trace keys contained in string <traceKeys>
(delimited by commas, e.g. CON,SES,EVT,C_AGI)
-l <traceFile> writes trace information activated by trace keys with the option -t
into the log file <traceFile>
-p <libdir>path to the JPlatin library
-g <gmuxpath>path to Gmux
-b no progress bar
-? prints this help text
The options '-f' and '-s' may occur repeatedly and in any order (they are evaluated in the order
they appear).