Welcome, Guest. Please login or register.

Author Topic: Parameters in RequestChoice / RequestFile commands  (Read 2474 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline TribbleSmasher

Re: Parameters in RequestChoice / RequestFile commands
« on: November 20, 2020, 10:11:28 PM »
I don't know if this works prior to 3.1.x but this works here:

You set or get the value or string you want to display with e.g. Env variables. To insert them you can use backticks.
Edit:
using backticks (3.0+ i think)
Code: [Select]
LIST `REQUESTFILE DRAWERSONLY'

Example 1
Code: [Select]
SETENV myval "important"

REQUESTCHOICE TITLE "hello user" BODY `GETENV myval` OkeyDokey
Example 2
You can also use a script as a body for the requester( the variable acts as a script).
Edit: ok, maybe not full scripts, but internal cmds, like ECHO, EVAL etc.
Code: [Select]
SETENV myval "ECHO 42"

REQUESTCHOICE TITLE "hello user" BODY `$myval` OkeyDokey
Hint
Code: [Select]
SETENV F 5
SETENV S 6
EVAL $F+$S
EVAL $F*$S
Example 3
And, finally, if you shape your myval with additional words separated with spaces, those become gadgets as well
Code: [Select]
SETENV myval "important Okey"

REQUESTCHOICE TITLE "hello user" BODY `GETENV myval` Dokey

As you already 'captured' your variable, just insert that instead.
Or, as Example 4
Code: [Select]
C:DATE >ENV:myval

REQUESTCHOICE TITLE "hello user" BODY "`GETENV myval`" "Okey Dokey!"
As Date outputs a string with spaces you certainly like to surround it with " ".
« Last Edit: November 21, 2020, 12:44:08 AM by TribbleSmasher »
 

Offline TribbleSmasher

Re: Parameters in RequestChoice / RequestFile commands
« Reply #1 on: November 21, 2020, 09:36:07 PM »
I don't really understand the problem.
Everything in backticks gets parsed the same way, so you could chain a list of commands together.
Inserting *N provides a linefeed in the body.
Code: [Select]
setenv myval1 "drive:Internet Apps/"
setenv myval2 "42"

requestchoice TITLE "hello" BODY "`GETENV myval1`*N`GETENV myval2`" "Okey"

Note:
Once any *N is found it is replaced with a linefeed, so you cannot use ECHO *N (to create a single linefeed) as it would end the current line and therefore the command issued. You need to create the lines separately and later join them together.
ECHO without the NOLINE parameter also issues a linefeed.
Also, when the RequestFile returns a string with surrounding "" you send this to a variable and once it get parsed the "" got stripped.
« Last Edit: November 21, 2020, 10:21:09 PM by TribbleSmasher »
 

Offline TribbleSmasher

Re: Parameters in RequestChoice / RequestFile commands
« Reply #2 on: November 22, 2020, 08:36:12 AM »
because i don't know better. :)
You had every chance to chip in for a long time to provide help. :)
 

Offline TribbleSmasher

Re: Parameters in RequestChoice / RequestFile commands
« Reply #3 on: November 22, 2020, 07:30:19 PM »
Thanx for the insight. As i don't know the OPs initial use case i just tried to give possible ways to go. Maybe there is a demand for a new DOS manual after all which could include those advanced scripting lessons.
« Last Edit: November 22, 2020, 07:31:36 PM by TribbleSmasher »