Hi,
I can now compile and execute output only scripts, but not interactives.
To run interactive scripts in Zeus you need to use a Zeus macro script. This is exactly how Zeus runs C#, Lua, Go and Python interactive scripts.
This product is too more complicated for me to customize.
Zeus definitely requires a level of user customization and it also needs a basic understand of things like command lines and system paths etc.
Would you have examples from peoples having done this?
Just do the following:
1) Save the code below to a file called
rexx_exec.py in the
zScript folder.
On Windows Vista, Windows 7 etc that folder is here:
Code: Select all
C:\Users\<user name>\AppData\Roaming\Xidicone\Zeus\zScript\
On Windows XP that folder is here:
2) Edit the REXX document type and add the following macro:
Menu Text: Execute '$f" Script
Macro Name: $zudzScript\rexx_exec.py
Arguments: "$fn"
[x] Add to popup menu
NOTE: The $zudzScript in the arguments above point to the
zScript folder described earlier.
3) Change this line of code in the
rexx_exec.py to whatever you need to run the current file in the REXX interpreter:
Code: Select all
# the 'REXX command to run the current filename
cmdREXX = "REXX.exe " + file_name
4) Now open a REXX file and run this macro from the Macros menu.
It should run your current file through the REXX interpreter, display a user input dialog so you can interact with the script and capture the output inside of Zeus when you end the script.
Here is code for the
rexx_exec.py script:
Code: Select all
#
# Name: Execute REXX script
#
# Author: Jussi Jumppanen
#
# Language: Python
#
# Description: This function is used to execute a REXX script in a MS-DOS
# window and have the script output captured in Zeus when
# the script terminates.
#
import os
import zeus
def key_macro():
file_name = ""
if zeus.argc() == 1:
# get the file passed in
file_name = zeus.argv(0)
# save the current file
zeus.FileSave()
else:
# the initial value
nill = ""
# ask the user to name the script that is to be run
file_name = zeus.user_input("REXX Script to Execute:", nill)
if (len(file_name) == 0):
zeus.message("The operation cancelled by user.")
zeus.beep()
return
# the output file name
file_output = file_name + ".ztow"
# remove the file quotes to allow the file to be deleted
file_output_ex = file_output.translate(None, '"')
# remove any previous output file
if os.access(file_output_ex, os.F_OK):
os.remove(file_output_ex)
# the 'REXX command to run the current filename
cmdREXX = "REXX.exe " + file_name
# the 'run script' command using tee to capture the output to a file
cmd = cmdREXX + " 2>&1 | tee " + file_output
#zeus.message_box(0, cmd, "Test")
# run the command as a MS-DOS command in a visible DOS window and wait for it to finish
flags = 16+32+64
# run the command which should be displayed in a DOS window
zeus.system(cmd, "", flags)
# capture the standard output, run as a DOS batch command and wait for it to finish
flags = 2+16+32
# send the resulting output file to zeus using the type MS-DOS command
zeus.system("type " + file_output, "", flags)
# remove the output file
if os.access(file_output_ex, os.F_OK):
os.remove(file_output_ex)
key_macro() # run the macro
Cheers Jussi