English Amiga Board    


Go Back   English Amiga Board > » Support > support.Other

Reply
 
Thread Tools
Old 18 August 2012, 08:04   #1
brolly
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?
brolly is offline   Reply With Quote
Old 18 August 2012, 12:13   #2
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 3,911
Code:
Assign >NIL: EXISTS DH1:
IF NOT WARN
  Echo "DH1 is available"
EndIF
__________________
Home: thomas-rapp.homepage.t-online.de
Email: thomas-rapp@web.de
thomas is offline   Reply With Quote
Old 19 August 2012, 01:09   #3
brolly
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.
brolly is offline   Reply With Quote
Old 19 August 2012, 05:10   #4
Arnie
Registered User
 
Arnie's Avatar
 
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.
Arnie is offline   Reply With Quote
Old 19 August 2012, 09:16   #5
brolly
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.
brolly is offline   Reply With Quote
Old 19 August 2012, 09:34   #6
Arnie
Registered User
 
Arnie's Avatar
 
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.
Arnie is offline   Reply With Quote
Old 19 August 2012, 09:54   #7
thomas
Registered User
 
thomas's Avatar
 
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
__________________
Home: thomas-rapp.homepage.t-online.de
Email: thomas-rapp@web.de
thomas is offline   Reply With Quote
Old 20 August 2012, 02:14   #8
brolly
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
brolly is offline   Reply With Quote
Old 20 August 2012, 11:35   #9
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 3,911
Here is one which works on 1.3, too:
Attached Files
File Type: lha DiskInDrive.lha (4.8 KB, 28 views)
__________________
Home: thomas-rapp.homepage.t-online.de
Email: thomas-rapp@web.de
thomas is offline   Reply With Quote
Old 23 August 2012, 02:12   #10
brolly
Registered User
 
Join Date: Aug 2010
Location: Lost
Posts: 233
Thanks again thomas, just tested that one and it works great.
brolly is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

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


All times are GMT +2. The time now is 14:10.

-->

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Page generated in 0.25731 seconds with 12 queries