18 August 2012, 08:04 | #1 |
Registered User
Join Date: Aug 2010
Location: Lost
Posts: 435
|
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? |
18 August 2012, 12:13 | #2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,002
|
Code:
Assign >NIL: EXISTS DH1: IF NOT WARN Echo "DH1 is available" EndIF |
19 August 2012, 01:09 | #3 |
Registered User
Join Date: Aug 2010
Location: Lost
Posts: 435
|
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. |
19 August 2012, 05:10 | #4 |
R.I.P Smudge 18-08-16
Join Date: Aug 2005
Location: Leicester/UK
Age: 66
Posts: 3,968
|
IF EXISTS DF0:S/My-Script
Echo "Run the script" ELSE Echo "Dont run the script" EndIF |
19 August 2012, 09:16 | #5 |
Registered User
Join Date: Aug 2010
Location: Lost
Posts: 435
|
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.
|
19 August 2012, 09:34 | #6 |
R.I.P Smudge 18-08-16
Join Date: Aug 2005
Location: Leicester/UK
Age: 66
Posts: 3,968
|
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 Last edited by Arnie; 19 August 2012 at 09:53. |
19 August 2012, 09:54 | #7 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,002
|
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 |
20 August 2012, 02:14 | #8 |
Registered User
Join Date: Aug 2010
Location: Lost
Posts: 435
|
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 |
20 August 2012, 11:35 | #9 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,002
|
Here is one which works on 1.3, too:
|
23 August 2012, 02:12 | #10 |
Registered User
Join Date: Aug 2010
Location: Lost
Posts: 435
|
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 |
AmigaDos | Hockmiester | New to Emulation or Amiga scene | 3 | 02 April 2013 08:01 |
Question for AmigaDos coders | DeafDaz | Coders. General | 11 | 26 September 2011 07:31 |
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 |
|
|