04 March 2022, 13:52 | #1 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
Help with a script
Hello there
I wrote a small script (photo below), and i need some help. I would like to add at the end a question about "would you like to make another conversion y/n?". If I click "y"i want the script to run again from the beginning, and i i click "n" i want it to quit. How can I do that |
04 March 2022, 14:05 | #2 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
Ask and skip?
|
04 March 2022, 15:13 | #3 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,303
|
Or RequestChoice.
|
04 March 2022, 15:40 | #4 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
|
04 March 2022, 15:41 | #5 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
|
04 March 2022, 15:45 | #6 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 6,985
|
Code:
lab loop Echo "Hello" set choice `requestchoice Question Again? Yes No` if $choice eq 1 skip back loop endif |
04 March 2022, 19:45 | #7 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
|
05 March 2022, 17:14 | #8 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
Hello again
Can someone tell me why the loop part of this script doesn't work on my 3.9 OS while it works fine on 3.2.1? It reaches the point where a requester asks me if i want to make another download and if I click yes then it gives me "object not found" and it doesn't loop back. It just stays there Any ideas? |
05 March 2022, 21:29 | #9 |
Registered User
Join Date: Feb 2008
Location: RNO
Posts: 1,006
|
If you execute other scripts within a script, you can't skip back to labels before the execution of the other scripts. It looks that Aminetrecent and Aminetextract are scripts, and those "cut" everything before them in the main script.
This is how it's been working traditionally on AmigaOSes, but maybe they have changed the behaviour in 3.2 or so. You can work-around it by running the other scripts with the Run command if it doesn't matter too much if they're async or not. |
06 March 2022, 02:49 | #10 | |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
Quote:
Aminetextract and Aminetrecent are indeed scripts. Will check if run command helps but it is strange that the same scripts work perfect in 3.2 1, 3.1.4 and also in 3.1!!! Only 3.9 has this issue as well as Coffin which is based on 3.9 as well. |
|
06 March 2022, 08:39 | #11 |
Registered User
Join Date: Feb 2008
Location: RNO
Posts: 1,006
|
At least on my plain 3.1 setup, these kind of scripts inside scripts don't work with "skip back", tested it yesterday.
IIRC when there's a script execution in the middle of another script, it will create a new temp script (in T: ) that contains the new script and the rest of the original script (but not the beginning), so when it continues to execute this temporary script, there isn't the original label anymore and that's why the skip back fails. |
06 March 2022, 09:33 | #12 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
Ok i understand. What should I change in my script then in order to avoid that?
Thanks a lot for your help |
06 March 2022, 10:01 | #13 |
Registered User
Join Date: Feb 2008
Location: RNO
Posts: 1,006
|
I haven't had to deal this myself, so I don't know good solutions right now, I've just been aware of the issue.
But that Run seems to solve the skipping issue, because then the another script is run as a separate process, but it isn't a perfect solution, because the next line is executed immediately without waiting the external script being finished... I don't know what to recommend... I guess it could be worked around with some hacky or ugly solutions which might result editing of the external script or random waits or such, but I'd rather find a cleaner solution, which I don't have in mind now, sorry |
06 March 2022, 12:42 | #14 |
Registered User
Join Date: Jan 2005
Location: Umeå
Age: 43
Posts: 922
|
Interesting, had no idea of this limitation.
I suspect that it can be solved under 3.1 by launching the scripts with http://aminet.net/package/util/cli/System as that makes them run as a separate process. I normally use the system tool to be able to redirect output from scripts on 3.1 (another strange limitation in 3.1). |
06 March 2022, 18:57 | #15 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
Hello again Patrik
The problem is on 3.9 not on 3.1. Both Coffin and my plain 3.9 installations have this problem. On 3.1 the scripts run fine and the loop works. Since i am not familiar with the system command, how would I execute the scripts in ToolsDaemon? Would i use any arguments? |
06 March 2022, 20:05 | #16 |
Registered User
Join Date: Jan 2005
Location: Umeå
Age: 43
Posts: 922
|
Add system before however you would launch the script normally. In this case before aminetsearch and aminetextract.
|
06 March 2022, 21:53 | #17 |
Registered User
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
|
Hi again
Running from shell the attached script (C:System DH0:UHC/Nikos/AM-RecentExt), doesn't solve the problem. Loop doesn't work and it also gives the same error "object not found". It works up to the point where Requestchoice gives the requester but when you choose yes, the error described above happens. Last edited by npagonis73; 06 March 2022 at 22:06. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
More script help please | Glen M | support.Apps | 8 | 01 February 2020 19:13 |
Script help | -Acid- | support.Other | 6 | 09 July 2018 20:34 |
AmigaDos script help | liviux76 | Coders. Scripting | 8 | 09 November 2017 16:20 |
Best script launcher | jotd | support.Games | 7 | 29 December 2015 18:37 |
RebootStart script help! | Overkill | support.Other | 43 | 23 April 2013 17:52 |
|
|