English Amiga Board


Go Back   English Amiga Board > Support > support.AmigaOS

 
 
Thread Tools
Old 04 March 2022, 13:52   #1
npagonis73
Registered User
 
npagonis73's Avatar
 
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
npagonis73 is offline  
Old 04 March 2022, 14:05   #2
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Ask and skip?
deimos is offline  
Old 04 March 2022, 15:13   #3
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
Or RequestChoice.
daxb is offline  
Old 04 March 2022, 15:40   #4
npagonis73
Registered User
 
npagonis73's Avatar
 
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
Quote:
Originally Posted by deimos View Post
Ask and skip?
It works with Ask Skip and LAB commands thanks for your help
npagonis73 is offline  
Old 04 March 2022, 15:41   #5
npagonis73
Registered User
 
npagonis73's Avatar
 
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
Quote:
Originally Posted by daxb View Post
Or RequestChoice.
Hi there Daxb

Could you elaborate the line i have to add in order to loop it back upon request?

Thanks
npagonis73 is offline  
Old 04 March 2022, 15:45   #6
thomas
Registered User
 
thomas's Avatar
 
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
thomas is offline  
Old 04 March 2022, 19:45   #7
npagonis73
Registered User
 
npagonis73's Avatar
 
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
Quote:
Originally Posted by thomas View Post
Code:
lab loop

Echo "Hello"

set choice `requestchoice Question Again? Yes No`

if $choice eq 1
   skip back loop
endif
Thomas thanks a lot for your help!! Added those lines in my scripts and it works exactly as i wanted!!! Thanks again very much
npagonis73 is offline  
Old 05 March 2022, 17:14   #8
npagonis73
Registered User
 
npagonis73's Avatar
 
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?
npagonis73 is offline  
Old 05 March 2022, 21:29   #9
jPV
Registered User
 
jPV's Avatar
 
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.
jPV is offline  
Old 06 March 2022, 02:49   #10
npagonis73
Registered User
 
npagonis73's Avatar
 
Join Date: Sep 2019
Location: Corfu / Greece
Posts: 410
Quote:
Originally Posted by jPV View Post
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.
Hello jpv

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.
npagonis73 is offline  
Old 06 March 2022, 08:39   #11
jPV
Registered User
 
jPV's Avatar
 
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.
jPV is offline  
Old 06 March 2022, 09:33   #12
npagonis73
Registered User
 
npagonis73's Avatar
 
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
npagonis73 is offline  
Old 06 March 2022, 10:01   #13
jPV
Registered User
 
jPV's Avatar
 
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
jPV is offline  
Old 06 March 2022, 12:42   #14
patrik
Registered User
 
patrik's Avatar
 
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).
patrik is offline  
Old 06 March 2022, 18:57   #15
npagonis73
Registered User
 
npagonis73's Avatar
 
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?
npagonis73 is offline  
Old 06 March 2022, 20:05   #16
patrik
Registered User
 
patrik's Avatar
 
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.
patrik is offline  
Old 06 March 2022, 21:53   #17
npagonis73
Registered User
 
npagonis73's Avatar
 
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.
npagonis73 is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 19:17.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10055 seconds with 13 queries