Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

checking for existance of drive ussing Autolisp code not working?

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
The_Caddie
640 Views, 7 Replies

checking for existance of drive ussing Autolisp code not working?

I'm trying to check for the existence of a drive using lisp, then if not found perform a task (represented in my below example by the alert)

 

however it dose not work could somebody suggest how I can achieve this?

 

(if (vl-file-directory-p "C:\ten") T)
(alert "exists"))

 I know it doesn't work because if I change the T to nil as demonstrated bellow I should invoke the opposite reaction from autocad but instead I get the exact same outcome which is an alert telling me the file exists?

 

(if (vl-file-directory-p "C:\ten") nil)
(alert "exists"))

 

7 REPLIES 7
Message 2 of 8
pbejse
in reply to: The_Caddie

(if (vl-file-directory-p "C:\ten")
(alert "exists"))

 

 

Message 3 of 8
The_Caddie
in reply to: pbejse

Doent seam to do anything for me
Message 4 of 8
pbejse
in reply to: The_Caddie


@The_Caddie wrote:
Doent seam to do anything for me

"\" to "\\"  or "/"

 

 

Message 5 of 8
hmsilva
in reply to: The_Caddie

Try

(if (findfile "c:/Test")
(alert "Exists")
)


EDIT

 

Change

"C:\ten"
to
"C:\\ten"
or
"C:/ten"

 

@pbejse

Oops too slow... Smiley Embarassed


Henrique

EESignature

Message 6 of 8
The_Caddie
in reply to: pbejse

double \ works thanks...

Message 7 of 8
pbejse
in reply to: hmsilva


@hmsilva wrote:

....

@pbejse

Oops too slow... Smiley Embarassed


Henrique


Smiley LOL Now we're even.

 

Cheers Henrique.

 

Message 8 of 8
hmsilva
in reply to: pbejse

Smiley LOL

 

Cheers pbejse

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost