![]() |
|
|
#1 |
|
Registered User
Join Date: Aug 2010
Location: Lost
Posts: 233
|
AmigaDOS question
I've been going back and forth with this one and can't figure it, is there any way that I can check in a script if a specific drive is available?
I was hoping IF EXISTS would work, but if the drive doesn't exist it shows an error message dialog saying so and I want it to be silent. Example: IF EXISTS dh1:testfile -> If testfile doesn't exist no message dialog shows up, but if there is no dh1 drive then a dialog will popup with an error stating the drive doesn't exist. Same thing if I simply try IF EXISTS dh1: Is there any way to make this work, or maybe some other AmigaDOS command I might be missing? |
|
|
|
|
|
#2 |
|
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 3,911
|
Code:
Assign >NIL: EXISTS DH1: IF NOT WARN Echo "DH1 is available" EndIF |
|
|
|
|
|
#3 |
|
Registered User
Join Date: Aug 2010
Location: Lost
Posts: 233
|
Nice one, thanks.
That worked perfectly, but I ran into an issue when using it with floppies though. This works fine: Assign >NIL: EXISTS DF0: But EXISTS will always return true no matter if I have a floppy inserted on df0 or not which is correct since df0 does exist, so this code won't work as I wanted: Assign >NIL: EXISTS DF0: IF NOT WARN IF EXISTS DF0:S/My-Script Echo "Run the script" EndIF EndIF Once it hits the IF EXISTS DF0:S/My-Script line a dialog will appear saying there is no disk on drive df0. I was hoping using this instead would work: Assign >NIL: EXISTS DF0:S But assign always fails with returncode 20 this way. So what's the best way to check if I have a floppy present on df0? I will always have the df0 drive present so on this case I need to check if a disk is present there or not. |
|
|
|
|
|
#4 |
|
Registered User
Join Date: Aug 2005
Location: Leicester/UK
Age: 55
Posts: 1,127
|
IF EXISTS DF0:S/My-Script
Echo "Run the script" ELSE Echo "Dont run the script" EndIF
__________________
A600, 2GB CF HD, KS3.1, WB3.1, A604, EasyADF, PCMCIA + 4GB CF. |
|
|
|
|
|
#5 |
|
Registered User
Join Date: Aug 2010
Location: Lost
Posts: 233
|
That's exactly what I have on my post above, like I said that doesn't work. If there is no disk on df0 a dialog will popup saying so and that's what I'm trying to avoid.
|
|
|
|
|
|
#6 |
|
Registered User
Join Date: Aug 2005
Location: Leicester/UK
Age: 55
Posts: 1,127
|
You may need a third party program. I use "Isinserted" to check if a CF card is present in CF0:.
Try a search on Aminet for a suitable program. EDIT: Isinserted DF0: IF not warn if exists df0:s/myscript echo "Use myscript" else echo "dont use" endif endif
__________________
A600, 2GB CF HD, KS3.1, WB3.1, A604, EasyADF, PCMCIA + 4GB CF. Last edited by Arnie; 19 August 2012 at 09:53. |
|
|
|
|
|
#7 |
|
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 3,911
|
It's probably better to use a program which was made for this purpose.
However, this could work, too: Code:
info >t:tempfile DF0: search >nil: t:tempfile "No disk present" if not warn echo "no disk present in drive DF0" else echo "either there is a disk in drive DF0 or drive DF0 does not exist" endif |
|
|
|
|
|
#8 |
|
Registered User
Join Date: Aug 2010
Location: Lost
Posts: 233
|
Thanks guys, Isinserted did the trick had no idea such a program existed.
Unfortunately it doesn't work on WB1.3 so I can't use it on all situations. For those I ended up using your clever workaround thomas and it worked like a charm ![]() |
|
|
|
|
|
#9 |
|
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 3,911
|
Here is one which works on 1.3, too:
|
|
|
|
|
|
#10 |
|
Registered User
Join Date: Aug 2010
Location: Lost
Posts: 233
|
Thanks again thomas, just tested that one and it works great.
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Question for AmigaDos coders | DeafDaz | Coders. General | 11 | 26 September 2011 07:31 |
| AmigaDOS manual | amiga | request.Other | 5 | 28 November 2009 23:34 |
| AmigaDOS | Swordlord | New to Emulation or Amiga scene | 28 | 05 March 2004 23:31 |
| AmigaDOS help | bippym | Amiga scene | 1 | 08 July 2003 23:46 |
| Dumb AmigaDOS Question | Parsec | support.Apps | 10 | 11 June 2003 11:50 |