Author Topic: unable the escape key..  (Read 11643 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: unable the escape key..
« Reply #15 on: October 10, 2006, 12:00:59 PM »
hhhmm.....seem having same problem..


Code: [Select]
(defun goto_INGcommand ()
  (if (eq g "ING_SAVE")
    (progn
  (initdia 1)
  (command "_saveas")
))
)


(defun INGcommand ()
  (setq g nil)
  (while
    (progn
      (setq g (vl-catch-all-apply 'getstring (list "INGcommand: ")))
      (cond
        ((vl-catch-all-error-p g) ; yes, error
         (alert "Escape not allowed.")
         t ; stay in loop
        )
        ((vl-string-search "ING" (setq g (strcase g)))
         (goto_INGcommand)
         nil     ; exit loop & return the INGcommand entered.
        )
        ((eq g "COMMAND")
         (exit) ; bye bye
        )
        (t
         (alert
           "Invalid ING command.\n Type \"Command\" to return to AutoCAd command."
         )
         t
        )
      )
    )
  )
  g
)



(setq cmd (INGcommand))

maybe need to think for another solution....
using reactor..or something else....

Thanks. CAB.
Keep smile...

Patrick_35

  • Guest
Re: unable the escape key..
« Reply #16 on: October 10, 2006, 12:06:51 PM »
Salut

Code: [Select]
(defun INGcommand(/ g)
  (while (setq g (vl-catch-all-apply 'getstring (list "\nINGcommand: ")))
    (if (not (vl-catch-all-error-p g))
      (progn
        (setq g (strcase g))
        (if (vl-string-search "ING" g)
          (ing_go g)
)
        (if (eq g "COMMAND")(exit))
        (if (and
          (not (vl-string-search "ING" g))
          (not (eq g "COMMAND")))
          (alert "Invalid ING command.\n Type \"Command\" to return to AutoCAd command.")
        )
      )
      (if (member (vl-catch-all-error-message g) (list "Fonction annulée" "Function cancelled"))
        (setq g T)
        (setq g nil)
      )
    )
  )
)

(defun ing_go (g1)
  (if (eq g1 "ING_SAVE")
    (progn
    (initdia 1)
    (command "_saveas"))
  ))

(INGcommand)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: unable the escape key..
« Reply #17 on: October 10, 2006, 12:09:32 PM »
Works for me.   :-o
Code: [Select]
(defun INGcommand (/ g)
  (while
    (progn
      (setq g (vl-catch-all-apply 'getstring (list "INGcommand: ")))
      (cond
        ((vl-catch-all-error-p g) ; yes, error
         (alert "Escape not allowed.")
         t     ; stay in loop
        )
        ((vl-string-search "ING" (setq g (strcase g)))
         (alert "You have entered a ING command")
         nil   ; exit loop & return the INGcommand entered.
        )
        ((eq g "COMMAND")
         (exit) ; bye bye
        )
        (t
         (alert
           "Invalid ING command.\n Type \"Command\" to return to AutoCAd command."
         )
         t
        )
      )
    )
  )
  g
)

(defun c:test (/ cmd)
  (setq cmd (INGcommand))
  (cond
    ((eq cmd "ING_SAVE")
     (initdia 1)
     (command "_saveas")
    )
    (t
     (alert "Invalid ING Command")
     )
  )
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: unable the escape key..
« Reply #18 on: October 10, 2006, 02:02:27 PM »
Works for me. 

hug ?..   :?
hmm....bizzarre..!..

Thanks CAB nice try !..   :wink:

Patrick,..your code work perfectly. thank you.  :roll:
Keep smile...

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: unable the escape key..
« Reply #19 on: October 10, 2006, 02:16:18 PM »
Works for me. 

hug ?..   :?
hmm....bizzarre..!..

Thanks CAB nice try !..   :wink:
Andrea did you copy the second test routine without any changed & test it?
Did you get an error? If it works in the test the problem is in your implementation.  8-)

I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: unable the escape key..
« Reply #20 on: October 10, 2006, 02:33:34 PM »
Andrea did you copy the second test routine without any changed & test it?

Yes, CAB...
copy and paste in a new lisp file...

but the result is that return to AutoCAd command line..
Keep smile...

GDF

  • Water Moccasin
  • Posts: 2081
Re: unable the escape key..
« Reply #21 on: October 10, 2006, 02:49:59 PM »
Works for me.   :-o
Code: [Select]
(defun INGcommand (/ g)
  (while
    (progn
      (setq g (vl-catch-all-apply 'getstring (list "INGcommand: ")))
      (cond
        ((vl-catch-all-error-p g) ; yes, error
         (alert "Escape not allowed.")
         t     ; stay in loop
        )
        ((vl-string-search "ING" (setq g (strcase g)))
         (alert "You have entered a ING command")
         nil   ; exit loop & return the INGcommand entered.
        )
        ((eq g "COMMAND")
         (exit) ; bye bye
        )
        (t
         (alert
           "Invalid ING command.\n Type \"Command\" to return to AutoCAd command."
         )
         t
        )
      )
    )
  )
  g
)

(defun c:test (/ cmd)
  (setq cmd (INGcommand))
  (cond
    ((eq cmd "ING_SAVE")
     (initdia 1)
     (command "_saveas")
    )
    (t
     (alert "Invalid ING Command")
     )
  )
)

Alan

Work fine for me.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Andrea

  • Water Moccasin
  • Posts: 2372
Re: unable the escape key..
« Reply #22 on: October 10, 2006, 05:01:16 PM »
ok....let see ...
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: unable the escape key..
« Reply #23 on: October 10, 2006, 05:05:53 PM »
ok guys...

I think i have wrong start...
The program that i'm trying to do...
is to permit only some AutoCad function to the user...
like:

_SAVEAS
_OPEN
_PLOT
_PREVIEW
_LINE
_PLINE
...and some few other...

before continuing this project..
is this program a good way to do it ?

need your experience.   :kewl:
Keep smile...

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: unable the escape key..
« Reply #24 on: October 10, 2006, 05:10:35 PM »
What a waste of energy ... why didn't you say that at the start. ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: unable the escape key..
« Reply #25 on: October 10, 2006, 05:16:41 PM »
sorry Kerry..
your right....

but i have lurn something again....
maybe is wasting time for you..
but when i lurn.....is not wasting time for me.

I'm here to understand and lurn
how of all of guru like you, make a program better.

 :oops:
« Last Edit: October 10, 2006, 05:17:47 PM by Andrea »
Keep smile...

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: unable the escape key..
« Reply #26 on: October 10, 2006, 05:20:59 PM »
Andrea, dont play the old "I want to learn" card.

We have been having this same discussion for years.

You continually think that people can read your mind .. and expect it.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: unable the escape key..
« Reply #27 on: October 10, 2006, 06:00:47 PM »
this is my another way...
what is your comment about this one..

Code: [Select]
(defun loadFreactor ()

(vl-load-com)
(vlr-command-reactor nil '((:vlr-commandWillStart . startFCommand)))
)


(defun startFCommand (getcommand / CMD)
  (setq CMD (nth 0 getcommand))
  (cond
   
    ((and (/= CMD "TEXT")
  (/= CMD "MTEXT")
  (/= CMD "DTEXT")
  )
     (progn
     (alert "Command disable.")
     (exit)
     )
     
)))

(loadFreactor)

the problem is..that the (exit) do not exit the command.

« Last Edit: October 10, 2006, 07:15:39 PM by Andrea »
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: unable the escape key..
« Reply #28 on: October 10, 2006, 06:01:45 PM »
Kerry..please...don't start.. :x
Keep smile...

sinc

  • Guest
Re: unable the escape key..
« Reply #29 on: October 10, 2006, 08:32:31 PM »
ok guys...

I think i have wrong start...
The program that i'm trying to do...
is to permit only some AutoCad function to the user...
like:

_SAVEAS
_OPEN
_PLOT
_PREVIEW
_LINE
_PLINE
...and some few other...

before continuing this project..
is this program a good way to do it ?

need your experience.   :kewl:

You could always just UNDEFINE certain commands.  For example, you could put lines like the following in your ACAD.LSP file:
Code: [Select]
(command "undefine" "circle")
It is a simple matter for a moderately-savvy user to override this by using REDEFINE or by preceding the command name with a period ("."), but it might work for low-level users.  Anyway, a moderately-savvy user could probably get around anything you try to do...