AmigaDos 1.3 Ask with User Input into Variable
1 Attachment(s)
Hi,
i would like to code a Question asking about what Drive to use as source and the same as destination (df0: df1: etc..) I use a normal Workbench 1.3 Shell Script executed over IconX. My Problem is this Script won´t accept set or unset and requestchoice and my Workbench 1.3 Shell also. It´s a script for Disksalv to make it easy to use and more comfortable. In Picture i have the part of the code i coded to ask for Formatted Disk in Destination drive or not. But how to save the user input into a variable and Ask a Question without only y and n ? |
Code:
Echo "Which drive?" Edit: Or not as I missed the "1.3" requirement. |
This isn’t a direct answer to your question, but I think DiskSalv can be controlled pretty well through project icons and tooltypes, so that might be another way to achieve what you’re trying to do.
|
|
Thanks to all this helps me very much :great
|
Additional Question:
Is there any way to Display 2 Variables in 1 Line or put 2 variables together ? My destination is to Display "diksalv var1 var2" |
I have created a solution for my Script.
Feel free to Optimize it. Code:
.key "" |
Quote:
|
for WB 34.(21|28|34)
While browsing a folder containing some files I stumbled across an 'HD install' script I made (WB 1.3 - not using the 'Installer' scripting language, only WB 1.3 commands).
The script was small and worked but I remember not being really happy with it. Especially because I wasn't able to use wanted variables so the script kind of 'forced' some choices... It was of no importance but re-reading it made me think that a better solution could be found. Thus, I tried to rewrite it with the goal of being able to use variables on this WB 1.3 script. My main concern was to pass the variable to the 'copy' command. I tried some redirections, pipes but with no luck (maybe it's possible but my command was incorrect ?) So I began to think about a workaround. After some thinking, a strange idea came to my mind... and it worked :spin Here is my summarized solution : Code:
[...] |
Quote:
If you want argument substitution, then "execute" is your other candidate which does that on a primitive "text-substitution" basis of the "arguments" passed into a script. |
Thank you Thomas for the precisions.
BitD I have learnt the hard way, with a lot of frustration, that the 1.3 Shell was not able to 'expand' the "$<variable_name>" but in the other hand I always found strange that the 'Execute' command that is used to launch a script didn't implement such a parser. Fortunately, BitD ARP for 1.3 addressed some of the 1.3 youth errors. |
Well, argument substitution works with execute already in 1.3, just that the syntax is different, namely <variable name>, not with $variable name. Which nicely conflicts with I/O redirection, and is perfectly inconsistent with how "if" handles variables in 1.3.
The joy of Tripos, what else to say? |
Argument substitution of the parameters provided to the script (".key"), yes. Regarding the I/O redirection conflicts, you know that even the Commodore manual recommended the use of the ".bra {" & ".ket }". So no problem here.
But, even, don't forget the default value that can be given with the $ sign "{argument$default_value}" ;) No, here my point is that it is strange that even a "{variable_name}" was not handled natively (thus allowing, inside scripts, the use of variable created with the 'setenv' command (and stored in ENV: by the system - or created manually in ENV: )). But you are correct by saying that there is an inconsistency between the way "if" handle the $variable and the way "execute" handle the {argument}. |
All times are GMT +2. The time now is 12:50. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.