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

Hit "Esc" not function

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
148 Views, 3 Replies

Hit "Esc" not function

Hi Alls,
I just attempt to use "Esc" button,it's not error function,I want to know
how Esc work,look like this code,gut it failed
[code]
(setq opt (getstring "\nEnter text style name : ")) ; hit "Esc"
(cond ((= opt "")(setq opt "Standard"))
((= opt 'error: Function cancelled)(alert "\nYou just cancel it")))
[/code]
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

Hi,
after that code revised,it got solve,but alert can not display
[code]
(setq opt (getstring "\nEnter text style name : ")) ; hit "Esc"
(cond ((= opt "")(setq opt "Standard"))
((= opt '*Cancel*)(alert "\nYou just cancel it")))
[/code]



"Adesu" wrote in message
news:5244097@discussion.autodesk.com...
Hi Alls,
I just attempt to use "Esc" button,it's not error function,I want to know
how Esc work,look like this code,gut it failed
[code]
(setq opt (getstring "\nEnter text style name : ")) ; hit "Esc"
(cond ((= opt "")(setq opt "Standard"))
((= opt 'error: Function cancelled)(alert "\nYou just cancel it")))
[/code]
Message 3 of 4
Anonymous
in reply to: Anonymous

Ade,
Search for "*error*" here.
You will find a lot of example code.
Your code will stop - if ESCape key pressed.
You need to 'define' your own local *error* function.

Bob
Message 4 of 4
Anonymous
in reply to: Anonymous

"Adesu" wrote in message
news:5244097@discussion.autodesk.com...
Hi Alls,
I just attempt to use "Esc" button,it's not error function,I want to know
how Esc work,look like this code,gut it failed
[code]
(setq opt (getstring "\nEnter text style name : ")) ; hit "Esc"
(cond ((= opt "")(setq opt "Standard"))
((= opt 'error: Function cancelled)(alert "\nYou just cancel it")))
[/code]


Hi Adesu.
Check this:
(defun alert_if_error ( msg / )

(if
(vl-catch-all-error-p (setq opt (vl-catch-all-apply 'getstring (list
msg) )))
(alert "\n You just cancel it")
(if
(eq opt "") (setq opt "Standard")
(setq opt opt)

)
)
)

(alert_if_error "Enter text style name : ")

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

Post to forums  

Autodesk Design & Make Report

”Boost