English Amiga Board


Go Back   English Amiga Board > Support > support.Apps

 
 
Thread Tools
Old 03 October 2018, 22:44   #1
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
How to check if a volume/drive exists?

Is there a command to check if a drive/volume exists before using the CD command to change to it and run a script? This is because my User-Startup uses this command at the moment to change to DH4:, but not all my configurations have a DH4: and this command is being called from a WB HDF.

I thought "IF EXISTS DH4:" would work fine, but apparently not.

EDIT: Reply if you like, but I think I've found a workaround if there's no solution to this issue. However, if there is a solution, then I'll happily accept it.

Last edited by Foebane; 03 October 2018 at 23:27.
Foebane is offline  
Old 04 October 2018, 01:04   #2
kolla
Banned
 
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
Isn't there an "assign dh4: exists"?
kolla is offline  
Old 04 October 2018, 01:50   #3
-Acid-
Registered User
 
Join Date: Oct 2012
Location: South Shields
Posts: 812
Assign >NIL: exists dh4:
if not warn
do something
else
dont bother
endif
-Acid- is offline  
Old 04 October 2018, 05:57   #4
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
Quote:
Originally Posted by -Acid- View Post
Assign >NIL: exists dh4:
if not warn
do something
else
dont bother
endif
This script didn't work for me, even with "dh4:@", with @ being the name of the file to execute.

I've found a simple solution, and it works. Thanks, anyway.
Foebane is offline  
Old 04 October 2018, 06:23   #5
desiv
Registered User
 
desiv's Avatar
 
Join Date: Oct 2009
Location: Salem, OR
Posts: 1,767
Quote:
Originally Posted by Foebane View Post
I've found a simple solution, and it works. Thanks, anyway.
And??
Enquiring minds want to know!!!! ;-)

Thanx
desiv is offline  
Old 04 October 2018, 07:53   #6
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
Quote:
Originally Posted by desiv View Post
And??
Enquiring minds want to know!!!! ;-)

Thanx
My solution was to simply add DH4: to the configuration and point to an empty "@" file, so there wouldn't be any more "Drive DH4: is empty" messages and yet it wouldn't run anything else.

Now the User-Startup lines involved are simply:

CD DH4:
EXECUTE @

When I tried the script suggested by Acid, the DH4: wasn't executed either way, and to be honest, I'm still rusty on some AmigaDOS commands. At least I know what the two above lines do.
Foebane is offline  
Old 04 October 2018, 08:27   #7
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by Foebane View Post
This script didn't work for me, even with "dh4:@", with @ being the name of the file to execute.

I've found a simple solution, and it works. Thanks, anyway.

Acid's solution works fine so you most probably did it wrong. Easy check:


Code:
assign >NIL: DH4: exists
if not warn
echo "DH4: found"
else
echo "DH4: not available"
endif
Copy/paste and execute it and you'll either see a "not available" or "found" text.
StingRay is offline  
Old 04 October 2018, 11:24   #8
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,856
If you are using ARP, you can use the following :
Code:
IF EXISTS DH4:
   <put your code here>
ELSE
   <put your code here>
ENDIF
PS:
Quote:
Originally Posted by Foebane View Post
[...] EDIT: Reply if you like, but I think I've found a workaround if there's no solution to this issue. However, if there is a solution, then I'll happily accept it.
Nice one !

Last edited by malko; 04 October 2018 at 11:32.
malko is offline  
Old 04 October 2018, 11:51   #9
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
Cool, it worked this time! Don't know what I did wrong before.

Thanks, StingRay, Acid and Malko!

I guess I gave up too easily.
Foebane is offline  
Old 16 February 2023, 17:26   #10
mech
Registered User
 
mech's Avatar
 
Join Date: Mar 2009
Location: texas,usa
Posts: 235
check for cd

I know this is a old thread,but there is something on Aminet that may apply:


aminet.net/disk/misc/chkcd10.lha
mech 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
Same name for HDToolbox Drive Type, Partition and Volume NOT a problem? Foebane support.Apps 24 14 March 2018 21:21
Check if PROGDIR: exists? AGS Coders. System 13 13 April 2015 01:33
CD audio volume change is not applied if Paula volume is changed, too thomas support.WinUAE 1 21 March 2014 16:50
Interest Check: A1010, Golden Hawk MIDI 500 and C64 floppy drive ApolloBoy2 MarketPlace 1 01 December 2011 23:01
Please insert volume System: in any drive.... asm1 project.ClassicWB 7 19 January 2010 18:35

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 10:22.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.19905 seconds with 13 queries