English Amiga Board


Go Back   English Amiga Board > Support > support.Other

 
 
Thread Tools
Old 18 August 2012, 08:04   #1
brolly
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?
brolly is offline  
Old 18 August 2012, 12:13   #2
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,939
Code:
Assign >NIL: EXISTS DH1:
IF NOT WARN
  Echo "DH1 is available"
EndIF
thomas is offline  
Old 19 August 2012, 01:09   #3
brolly
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.
brolly is offline  
Old 19 August 2012, 05:10   #4
Arnie
R.I.P Smudge 18-08-16

Arnie's Avatar
 
Join Date: Aug 2005
Location: Leicester/UK
Age: 62
Posts: 3,908
IF EXISTS DF0:S/My-Script
Echo "Run the script"
ELSE
Echo "Dont run the script"
EndIF
Arnie is offline  
Old 19 August 2012, 09:16   #5
brolly
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.
brolly is offline  
Old 19 August 2012, 09:34   #6
Arnie
R.I.P Smudge 18-08-16

Arnie's Avatar
 
Join Date: Aug 2005
Location: Leicester/UK
Age: 62
Posts: 3,908
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.
Arnie is offline  
Old 19 August 2012, 09:54   #7
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,939
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
thomas is offline  
Old 20 August 2012, 02:14   #8
brolly
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
brolly is offline  
Old 20 August 2012, 11:35   #9
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 5,939
Here is one which works on 1.3, too:
Attached Files
File Type: lha DiskInDrive.lha (4.8 KB, 108 views)
thomas is offline  
Old 23 August 2012, 02:12   #10
brolly
Registered User
 
Join Date: Aug 2010
Location: Lost
Posts: 435
Thanks again thomas, just tested that one and it works great.
brolly 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
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

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 04:58.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.06952 seconds with 14 queries