Checking DCL Input isBlank

Checking DCL Input isBlank

thabit79BL3
Enthusiast Enthusiast
276 Views
4 Replies
Message 1 of 5

Checking DCL Input isBlank

thabit79BL3
Enthusiast
Enthusiast

I am writing to request your assistance with a problem I am encountering with my AutoLisp code. Specifically, I am trying to create a function that will check whether the input of a dcl is blank. If the input is blank, I would like the function to execute one command, and if the input is not blank, I would like the function to execute another command.

I have tried using the following code, but it has not been successful:

 

 

 

(setq result (get_tile rcdName))
(if (or (null result) (equal result ""))
   (progn
      (c:wd_wire rcdWirePointStart rcdWirePointEnd "")
    )
   (progn
       (command .....)
   )
)

 

 

 

 

Could you please advise me on how I can modify this code to achieve the desired functionality? I would greatly appreciate your assistance.

Thank you for your time and attention.

 

@paullimapa 

0 Likes
277 Views
4 Replies
Replies (4)
Message 2 of 5

paullimapa
Mentor
Mentor

hard to tell without the rest of the code including dcl.

but my first guest is that this code:

(setq result (get_tile rcdName))

should look like this?

(setq result (get_tile "rcdName"))

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 5

Sea-Haven
Mentor
Mentor

Maybe, get_tile returned ("6" "" "6" "3/4") for my test of 4 get tiles note second answer is "" which is a blank string. Not a null or nil. Still a string but with no value. Bit like getstring does similar for press Enter. 

0 Likes
Message 4 of 5

paullimapa
Mentor
Mentor

note: to test, just simply do this:

(setq result "")

then run the OP's code and it'll still return T:

(or (null result) (equal result ""))

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 5

Sea-Haven
Mentor
Mentor

(if (= (strlen result) 0) then its blank. A space etc looks like its blank will return 1.