TSE: Issue: It looks like passing command line parameters to startup macros when using '-e' does not work or is not possible

24 views
Skip to first unread message

knud van eeden

unread,
Jun 13, 2025, 5:01:56 PM6/13/25
to SemWare TSE Pro Text Editor, S.E. Mitchell
TSE: Issue: It looks like passing command line parameters to startup macros when using '-e' does not work or is not possible

Hello,

Use case: Running TSE programs on a remote server via the Internet, then passing the parameters of a TSE program running on that remote servers via parameters passed in the URL in a browser, 
then TSE MacroCmdLine extracts those incoming parameters. 
But that does thus not work.

Tested on TSE for Windows version 4.50.6

===

Steps to reproduce:

1. Create this TSE program:

PROC Main()
 STRING s[255] = Query( MacroCmdLine )
 Warn( s ) // empty
 s = GetToken( s, " ", 2 )
 Warn( s ) // empty
 FWrite( _STDOUT_, s )
 Exit()
END

2. Save it e.g. as 

    foobar.s 

3. Compile it

4. Run it using any of the below expressions I tried, it shows always an empty result back, thus "", from Query( MacroCmdLine ).

g32.exe -efoobar.mac 1 2

g32.exe -e"foobar.mac 1 2"

g32.exe -e"foobar.mac" "1 2"

g32.exe -e"ddd1.mac" "1" "2"

5. Expected was that is should first show "1 2", then after that "2". 

6. Note: Running the same TSE macro INSIDE TSE, e.g.

    menu > Macro > ExecMacro > 

    ddd1.mac 1 2 
 
   shows first "1 2", then "2", as expected.

7. See also the inline screenshot.

8. E.g. So the parameters should be able to be passed from the TSE command line as parameters to the foobar macro, and not seen as filenames. Maybe supplying a separate parameter, like 

g32.exe -efoobar.mac -p 1 -p 2

or 

g32.exe -efoobar.mac -p 1 2

or something similar.

Thanks 
with friendly greetings
Knud van Eeden

Inline image





knud van eeden

unread,
Jun 13, 2025, 5:10:50 PM6/13/25
to SemWare TSE Pro Text Editor, S.E. Mitchell
Even simpler reproduction:

PROC Main()
 Warn( Query( MacroCmdLine ) )
END

save and compile it as foobar.s

run it

g32.exe -efoobar.mac 1 2

shows an *empty* string inside TSE.



knud van eeden

unread,
Jun 13, 2025, 7:16:56 PM6/13/25
to SemWare TSE Pro Text Editor, S.E. Mitchell
This issue is resolved.

Use instead:

PROC Main()
 Warn( Query( DosCmdLine ) )
END

which gives the full command line including the variable parameters.




kyoko kirigiri

unread,
Jun 15, 2025, 7:32:43 AM6/15/25
to SemWare TSE Pro text editor
Maybe you would've had help earlier if you changed that fuggly font...

Carlo Hogeveen

unread,
Jun 15, 2025, 7:49:21 AM6/15/25
to sem...@googlegroups.com

Knud van Eeden

unread,
Jun 15, 2025, 8:03:34 AM6/15/25
to TSE Pro Support
Thanks Carlo.

Similarly using instead 'DosCmdLine' (instead of 'MacroCmdLine') is another (simplest, shortest,...) solution.

It works OK, here is the proof thus (paste the below URL as a one-liner in a browser e.g. on your mobile telephone and get the 5 quintic roots back in your browser)


where I pass 6 parameters a=1, b=2, c=3, d=4, e=5, f=6 to the general quintic ax^5+bx^4+cx^3+dx^2+ex+f=0 via my browser to a remote TSE running on a server there.

TSE seems thus not threat the parameters as filenames if e.g. using %20 (=ASCII 32or a space thus) to separate them after the macro name.

with friendly greetings 
Knud van Eeden


--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/semware/000d01dbddeb%2486473bf0%2492d5b3d0%24%40ecarlo.nl.

Knud van Eeden

unread,
Jun 15, 2025, 8:45:29 AM6/15/25
to TSE Pro Support
The font type was and is not (basically never) explicitly set here. 

What is seen is and was chosen by the applications (e.g. email client used, result of clipboard copy/paste, ...) at that moment.

with friendly greetings
Knud van Eeden


--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.

knud van eeden

unread,
Jun 20, 2025, 7:53:57 PM6/20/25
to SemWare TSE Pro Text Editor
Not sure if CmdLineParameter.s works (here).


Even if I put a Warn( "Here", " ", Query( DosCmdLine ) ) 
directly in the 'WhenLoaded' part of 
CmdLineParameter.s and recompile then the best I can see is
is:

 '-e'

Thusno parameters at all after the '-e'.

And of course if I run the GetGlobalStr() in the main TSE program
the result is then thus also empty strings.

The CmdLineParameter.s is thus present in the TSE autoload
and is for sure invoked thus.

Tested with TSE for Windows version 4.50.6.

Inline image

with friendly greetings
Knud van Eeden



On Friday, June 20, 2025 at 07:56:21 PM GMT+2, Knud van Eeden <knud.va...@gmail.com> wrote:

knud van eeden

unread,
Jun 20, 2025, 8:04:39 PM6/20/25
to SemWare TSE Pro Text Editor
That Query() works now in whenLoaded, a case sensitive letter in the URL was significant and of influence here.

So should be resolved for now. 

Thanks.


knud van eeden

unread,
Jun 20, 2025, 8:27:03 PM6/20/25
to SemWare TSE Pro Text Editor
1. Also the full path to the location of the macro (including .mac) has to be supplied, otherwise it will not work (=get empty string).

2. Note: optionally: As far as I know this information about full path and .mac is not in the documentation.

Inline image

3. And now passing of a divide by slash '/' works.

4. The parameter -p must thus to be used, as designed.


Inline image

Inline image


S.E. Mitchell

unread,
Jun 23, 2025, 6:28:45 AM6/23/25
to sem...@googlegroups.com
TSE expects filenames and command line switches on the command line.
There is no provision for handling parameters passed to macros from
the command line.
The .ui file WhenLoaded() proc is where the command line is processed.
The .ui WhenLoaded() indirectly runs tsestart before processing said
command line.
In your tsestart macro, you are free to manipulate the DosCmdLine
variable, e.g., you can process it yourself, and add/remove text from
the same.

Suppose you have: g32 -e foo 2 / 3
So your tsestart could scan the command line for -e and if found:
copy -e foo and any parameters to a string s, so s equals: -e foo 2 / 3
remove -e foo and everything after it from the DosCmdLine
Remove -e or "-e " from s.
And then perform: ExecMacro(s)
where s contains foo 2 / 3

A piece of cake :)

--
Sammy
Reply all
Reply to author
Forward
0 new messages