Welcome, Guest. Please login or register.

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

Description:

0 Members and 2 Guests are viewing this topic.

Offline AndyFCTopic starter

Parameters in RequestChoice / RequestFile commands
« on: November 20, 2020, 09:10:39 PM »
Evening all.

I'd like to display a parameter captured in a script using the Requestfile command to be displayed in the RequestChoice prompt. I've tried a few different things but the name of the parameter is displayed in some form and not the value of the parameter (in this case a file path).

Is what I'm trying to do possible and, if so, how please?

I guess the fallback is a Shell output Window.

Thanks.
A1200 in DIY Tower. 3.2 ROMs (softkicking 3.2.2), OS 3.2.2 with ClassicWB, CF card, CD RW and IDE to SD adapter running off the internal IDE port (using the A4000 4-port IDE adapter from Amigakit), Pistorm 32 lite with Pi4/2GB/Emu68 or Blizzard 1230-IV, with 32MB 60ns RAM and 50MHz 68882 FPU. 3COM PCMCIA Network card running with Miami DX.
MorphOS on PowerMac G5 and ATI 9600 pro
 

Offline AndyFCTopic starter

Re: Parameters in RequestChoice / RequestFile commands
« Reply #1 on: November 21, 2020, 09:14:03 PM »
Thanks TribbleSmasher.

This helped me get further (OS 3.1) but have found some limitations.

1: I want to show 2 parameters in the requester body. The first displays OK but the second shows the text 'Getenv' and whatever the variable name is. I've got around this by combing two variables into a new, single, variable which leads to problem 2...

2: The data I want to display is a file path and if it has a space in the value gets automatically wrapped in double quotes. Even though they aren't displayed on screen if you use GETENV they are there and the Requestchoice command sees it as the end of the <BODY>.

I'm nearly there. I've got the script to do what I want but have to reply on ECHO and a Shell Window for some of the output so this is purely an aesthetic issue now.
A1200 in DIY Tower. 3.2 ROMs (softkicking 3.2.2), OS 3.2.2 with ClassicWB, CF card, CD RW and IDE to SD adapter running off the internal IDE port (using the A4000 4-port IDE adapter from Amigakit), Pistorm 32 lite with Pi4/2GB/Emu68 or Blizzard 1230-IV, with 32MB 60ns RAM and 50MHz 68882 FPU. 3COM PCMCIA Network card running with Miami DX.
MorphOS on PowerMac G5 and ATI 9600 pro
 

Offline AndyFCTopic starter

Re: Parameters in RequestChoice / RequestFile commands
« Reply #2 on: November 23, 2020, 07:32:12 PM »
Thanks again for the advice. I'm thinking this might be a limitation of 3.0 and/or 3.1 because I get a different result to TribbleSmasher with a similar script.

The top box is my text script. I'm echoing the variables to debug them and the second window is the output demonstrating that I'm setting the values correctly.
The third window is the RequestChoice box showing the first value displaying correctly but the second isn't, being replaced by the command.

I've tried a few different combinations including $ variables, SETENV and GETENV, backticks and {} but still don't get the desired output in the RequestChoice box.
A1200 in DIY Tower. 3.2 ROMs (softkicking 3.2.2), OS 3.2.2 with ClassicWB, CF card, CD RW and IDE to SD adapter running off the internal IDE port (using the A4000 4-port IDE adapter from Amigakit), Pistorm 32 lite with Pi4/2GB/Emu68 or Blizzard 1230-IV, with 32MB 60ns RAM and 50MHz 68882 FPU. 3COM PCMCIA Network card running with Miami DX.
MorphOS on PowerMac G5 and ATI 9600 pro
 

Offline AndyFCTopic starter

Re: Parameters in RequestChoice / RequestFile commands
« Reply #3 on: November 25, 2020, 01:23:03 PM »
I've had a chance to try Neils' suggestion, using 'Set' at the beginning of the RequestChoice line and this works. There are some caveats:
- Like he warns, having a space in the path ("Ram Disk:" was one of my paths) causes an error. This is strange because setting the parameter as I did originally doesn't produce the same error.
- The 'cause' of the original question where I can't display the second parameter in RequestChoice is because of the waay I call the parameter in the RequestFile command. Using "Requestfile >Env:(parametername)...etc" results in me not being able to show a second parameter in the RequestChoice command. This is the case even if the parameter being called in RequestFile isn't used in RequestChoice

e.g.
Code: [Select]
Set Value1 `Requestfile >Env:Value2 TITLE "Hello"
Set Value3 `Requestfile >Env:Value4 TITLE "World"
RequestChoice TITLE "Test" BODY"$Value1*N$Value3" "Quit"

Results in the parameter $Value3 not getting displayed correctly in the choice requester but:

Code: [Select]
Set Value1 `Requestfile TITLE "Hello"
Set Value3 `Requestfile TITLE "World"
RequestChoice TITLE "Test" BODY"$Value1*N$Value3" "Quit"

works.

Thanks for all your help nbache, TribbleSmasher and Kolla. I've learn a lot about different variables and how to set and retrieve them through this task. I've got a plan of how to deal with the spaces in the path.
A1200 in DIY Tower. 3.2 ROMs (softkicking 3.2.2), OS 3.2.2 with ClassicWB, CF card, CD RW and IDE to SD adapter running off the internal IDE port (using the A4000 4-port IDE adapter from Amigakit), Pistorm 32 lite with Pi4/2GB/Emu68 or Blizzard 1230-IV, with 32MB 60ns RAM and 50MHz 68882 FPU. 3COM PCMCIA Network card running with Miami DX.
MorphOS on PowerMac G5 and ATI 9600 pro