23 February 2018, 21:15 | #1 |
Registered User
Join Date: Aug 2016
Location: Cresco, PA, USA
Age: 53
Posts: 1,126
|
AmigaDOS wait for user input
EDIT: Found it - here - http://www.amigawiki.de/doku.php?id=...commands_large
It's the ASK command. Leaving topic for future ref in case someone else has same question otherwise, Please disregard the following: I've read the AmigaDOS references and searched but cannot find an example to show me how a lot of ths should work. I don't understand what this topic refers to, I downloaded the lha linked and don't know how to check it out.. http://eab.abime.net/showthread.php?t=69399 Basically, I want a script to run, prompt the user to press RETURN to continue. As long as the user does not press enter, just sit there and wait for them to press enter. As soon as they do press enter - finish running the rest of the script. I don't understand how to use CON: or .KEY Can someone explain this to me? And give a simple example? Last edited by Sinphaltimus; 23 February 2018 at 21:27. |
23 February 2018, 21:29 | #2 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
There's the Ask command which sort-of does what you want. Just have this in a script:
Ask "Press Return to continue." Ask is intended for Yes/No responses though. So it accepts either Y, yes, N, no or nothing (just press return). If the user types something else then presses Return, the prompt message is shown again. Edit: Whoops, didn't see your edit in time. |
23 February 2018, 21:40 | #3 |
Registered User
Join Date: Aug 2016
Location: Cresco, PA, USA
Age: 53
Posts: 1,126
|
Thanks Mark, I actually read your answer after posting this question so I guess it's a follow up question now.
OK, another question. I now do not understand how to use IF WARN to check for an answer. If I ask a Yes or No questions. If Yes continue script, if NO echo a msg then exit script. Can you explain this to me? And give a simple example? |
23 February 2018, 21:44 | #4 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,645
|
Code:
ask Would you please answer Sinphaltimus' question? if warn echo this is how you use it else echo get out of here noob! endif http://wiki.amigaos.net/wiki/AmigaOS...mand_Reference |
23 February 2018, 21:44 | #5 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,303
|
Try this in a shell:
Code:
requestchoice "title" "body" "ok" Code:
echo >con:20/100/300/200/title/wait |
23 February 2018, 21:52 | #6 | |
Registered User
Join Date: Aug 2016
Location: Cresco, PA, USA
Age: 53
Posts: 1,126
|
Quote:
I stayed away from that reference because it's not AmigaDOS 3.1 "Copyright (c) 2012-2016 Hyperion Entertainment and contributors." It contains commands that don't exist for me like DISMOUNT. But thank you, your example works for me as intended. That's exactly what I needed. For refs, I was using: http://www.amigawiki.de/doku.php?id=...commands_large But I was unable to formulate proper usage. so again, thanks for your example. |
|
23 February 2018, 22:14 | #7 |
Banned
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
|
What about this?
Code:
lab ask set answer _x echo noline "What is your name? " set >NIL: answer ? if "$answer" eq "_x" echo "Sorry, I demand an answer!" skip back ask else echo "Hello $answer" endif |
23 February 2018, 22:29 | #8 |
Registered User
Join Date: Aug 2016
Location: Cresco, PA, USA
Age: 53
Posts: 1,126
|
Thanks kolla, I'm sure I'll need to know that at some point. Akira's answer pretty much nailed it.
|
24 February 2018, 19:15 | #9 | |
Banned
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
|
Quote:
Let me come with a small update - as I wrote the previous, I was puzzling over what trick I would use to check if a variable is not set - and now it just dawned upon me Code:
lab ask unset answer echo noline "What is your name? " set >NIL: answer ? if "$answer" eq "*$answer" echo "Sorry, I demand an answer!" skip back ask else echo "Hello $answer" endif So now you can go ahead and call yourself _x or whatever you like |
|
24 February 2018, 20:22 | #10 | |
Registered User
Join Date: Aug 2016
Location: Cresco, PA, USA
Age: 53
Posts: 1,126
|
Quote:
Thanks kolla! |
|
25 February 2018, 00:44 | #11 |
Banned
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
|
There are ways to get volume name via scripting, instead of user input, here is a script than can be named "unmount" for example...
Code:
.key DEV/A .bra [ .ket ] set fromdir "`cd`" cd [DEV] set VOL "`cd`" cd "$fromdir" assign [DEV] dismount assign "$VOL" dismount Anyways, here is a program you may be interested in http://aminet.net/package/disk/misc/Dismount |
25 February 2018, 02:47 | #12 |
Registered User
Join Date: Aug 2016
Location: Cresco, PA, USA
Age: 53
Posts: 1,126
|
Thanks. I'll check it out.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wait() | mritter0 | Coders. C/C++ | 2 | 17 May 2014 19:14 |
WHDload 17.1 problem with user input | Fieldday | project.WHDLoad | 10 | 27 February 2013 08:54 |
getting a user to press a key via AmigaDOS | DeafDaz | Coders. System | 3 | 10 January 2012 17:37 |
timed wait using CIAs | jotd | support.Other | 3 | 23 March 2008 14:55 |
Wait a sec - what about Macs? | Computolio | Amiga scene | 10 | 02 June 2004 07:23 |
|
|