03 October 2020, 23:38 | #1 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
CLI help
I have the following CLI line: {convert “10 USD EUR”} (without the brackets), which gives me the exchange value of how many euros is 10 dollars. How can I have the same but include requesters for the amount and the currency codes and add it in ToolsDaemon for example?
|
03 October 2020, 23:58 | #2 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,187
|
Set command sets a variable and $ in front allows substitution of that variable for the RequestChoice command.
|
04 October 2020, 00:26 | #3 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
Thanks for the quick reply. Could you please be a bit more specific on the line I posted; what would it be changed into;
|
04 October 2020, 13:05 | #4 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,304
|
For currency choice you can use this: https://wiki.amigaos.net/wiki/AmigaO...#REQUESTCHOICE
For values you can use this: https://wiki.amigaos.net/wiki/AmigaO...#REQUESTSTRING To set the results in a variable: https://wiki.amigaos.net/wiki/AmigaO..._Reference#SET Code:
set amount `requeststring "titletext" "bodytext"` set currencyFrom `requestchoice "titletext" "bodytext" "USD|EUR|YEN|Gold" set currencyTo `requestchoice "titletext" "bodytext" "USD|EUR|YEN|Gold"` {convert “$amount $currencyFrom $currencyTo”} |
04 October 2020, 14:50 | #5 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
CLI help
Thanks a lot for the guidelines. Made the attached script and set iconX as default tool. The script starts and all 3 requesters come up, I choose amount and currencies and then nothing. I also tried the convert “$amount $currencyFrom $currencyTo” which is the alternative way of running this tool and also nothing. There are 2 tools provided by the author, the convert.rexx and the convert (compiled version) which requires the quotes as seen above and must be run from CLI. The rexx tool doesn’t require quotes. Both tools if used in a shell by typing: rx convert.rexx 100 USD EUR or Convert “100 USD EUR” Work perfect. The tool even updates itself in real-time with the latest rates before converting. We made some progress but we are missing the actual result. Last edited by npagonis73; 04 October 2020 at 14:56. |
04 October 2020, 15:41 | #6 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,187
|
The easiest way would be to do a RequestChoice requester having only an OK button that prints the result.
Code:
RequestChoice $amount$currencyFrom `convert "$amount $currencyFrom $currencyTo"`$currencyTo OK Last edited by Samurai_Crow; 04 October 2020 at 15:48. |
05 October 2020, 21:30 | #7 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
Just to update you on the situation. Couldn’t make it work with requestchoice command. I tried many different ways and combinations. Found out that the line with the convert command wasn’t working cause probably the input codes taken from the requestchoice command for the currencyFrom and To were problematic. Once changed the requestchoice with requeststring command for the currencyFrom and To, immediately it worked. Downside with this is that you have to type the currency code yrself. What do you think is wrong with the requestchoice lines and the currency codes? Imputing the codes by hand in requeststring worked straight away. Clicking on them on the requestchoice window doesn’t work.
Also do you have any ideas for better presenting the result with requestchoice command instead of a whole shell window appearing? |
05 October 2020, 21:41 | #8 |
Registered User
Join Date: Dec 2014
Location: France
Posts: 104
|
Alternatively (the easy way) you could use 'R' which will automagically create a GUI by parsing the DOSArgs string of your program.
For example, if your DOSArgs string is "AMOUNT/N,CURRENCYFROM,CURRENCYTO,HELP/S" then at typing 'R Convert' would display a requester with 4 named fields. One numeric, two as strings, and one check box for help in which you could recall (printf) the supported currencies to the user. Last edited by flype; 05 October 2020 at 21:53. |
05 October 2020, 21:45 | #9 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
Could you tell me more about "R"; I am not aware of it and how to use it. Would love to try and make a simple GUI for the program.
|
05 October 2020, 22:03 | #10 | |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
Quote:
Oh sorry I didn’t see the example you wrote. Thanks, I will try what you say and see |
|
05 October 2020, 22:17 | #11 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,187
|
The link for "r" is at http://aminet.net/package/util/cli/r if interested.
The reason RequestChoice isn't working for you is that it returns the number of the button rather than the text of the button. In an AREXX script you could use a stem to look up the button number and substitute the text yourself. Last edited by Samurai_Crow; 05 October 2020 at 22:30. |
05 October 2020, 22:31 | #12 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
Thanks I will try it. Do I set the variables first and then add another line which creates the GUI or am I wrong?
|
05 October 2020, 22:34 | #13 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,187
|
You just do "r convert" and r creates the gui from convert's template. At least I think that's how it works.
|
05 October 2020, 22:35 | #14 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
Oh wow. Ok I will try and see if it is that simple. Thanks all
|
05 October 2020, 22:59 | #15 |
Registered User
Join Date: Dec 2014
Location: France
Posts: 104
|
It would look like this if your DOS Args are arranged the same way as below :
http://imgur.com/gallery/sCGmi21 You can even pass predefined values. |
05 October 2020, 23:18 | #16 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
CLI help
Tried it. It is really great and it works with most commands I tried but this convert must be a program and it says that template not found. The script I wrote and use so far from toolsdaemon is also not recognized as a command. Is there a way to do it?
|
05 October 2020, 23:29 | #17 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,304
|
No. If the command template isn't correct, it will not work. See also r.guide.
|
05 October 2020, 23:36 | #18 |
Registered User
Join Date: Dec 2014
Location: France
Posts: 104
|
Eventually, it s possible to call the result of the 'R convert' in a message requester without using a script.
https://i.imgur.com/zzSy2eS.png Here i wrote a dummy C convert tool to verify how it works precisely. That method, with the pipe imbrication requires that the tool (convert) only does a single line output. A multi line printf will make requestchoice to complain. It all depends how your convert tool interpret the arguments and output the result. Last edited by flype; 05 October 2020 at 23:41. |
05 October 2020, 23:41 | #19 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
Thanks a lot guys. Will try that tonight and will be back tomorrow for more feedback.
|
05 October 2020, 23:58 | #20 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
One last question. How can I set a variable for the result of the conversion?
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
for..each statement in CLI | pieter1976 | support.Other | 10 | 09 January 2020 22:15 |
Amikit and CLI | BanisterDK | support.WinUAE | 2 | 16 September 2012 12:10 |
CLI help | DeafDaz | request.Other | 3 | 10 August 2011 01:16 |
CLI Syntax | Greaser | New to Emulation or Amiga scene | 1 | 08 October 2006 10:14 |
|
|