Jump to content

Recommended Posts

Posted (edited)

Yeah. It's same so! So where was my wrong came from? can you tell me @Lee Mac and Please guide me to troubleshoot this problem?

Edited by Deby Ferdian
Input his name!
  • Replies 29
  • Created
  • Last Reply

Top Posters In This Topic

  • Deby Ferdian

    12

  • Lee Mac

    7

  • MJLM

    3

  • guigonse

    3

Posted (edited)

I get it now. It turns out that caused this all happen that is because I assign it of a keyboard shortcut into a CUI options as CTRL+W that's why my palettes is always shown up and hidden every my act to press my custom keyboard shortcut of text window. But in otherwise vice verse it's very normally when I just type it at the command line as aliasses and everything work greats very nice! so.. Do you have an any idea to get can custom the "TS" command as a text window into a CUI options?

Edited by Deby Ferdian
try to arragement!
Posted

Hi, @BIGAL or anyone could help me. Do you have an Idea guys about this code and Assign it of a keyboard shortcut key into a CUI options. Here it is my code:

 

(defun-q c:[color=darkorange][b]TW [/b][/color]nil
   (tgltxtscr)
   (setq c:TW (vl-list* '() (if (equal '(tgltxtscr) (cadr c:TW)) '(textscr) '(tgltxtscr)) (cddr c:TW)))
   (princ)
)

(defun tgltxtscr ( / wsh )
   (if (setq wsh (vlax-create-object "wscript.shell"))
       (progn
           (textscr)
           (vl-catch-all-apply
              '(lambda ( )
                   (vlax-invoke wsh 'appactivate "AutoCAD Text Window")
                   (vlax-invoke wsh 'sendkeys "% H")
               )
           )
           (vlax-release-object wsh)
       )
   )
   (princ)
)

 

 

Get assign a "TW" command has figure of an above into "CTRL+W". I was try with many times but what the occur is, it seems doesn't work normally as a common as toggle screen of text window instead the subject with another function has came out since that. It is HIDE/SHOW PALETTES. why??? But in the otherwise if I just type it ("TW" command only) at the command line then everything was fine..

  • 1 year later...
Posted

I've been in shock for a while!! :?

Nice self-re-defining function!! :P

Posted
I've been in shock for a while!! :?

Nice self-re-defining function!! :P

 

Brings me memories of this somewhat related thread about self-redefining function.

I guess thats the simpliest example from Lee Mac, where my brain still gets stuck.

Posted

Yes!! Just a late comment about both related and present thread: in old Autolisp, (defun ..) functions WHERE true lists, and so could be edited as it.

This days I'm rewriting old routines to remain compatibles with Autolisp as well as AutoCAD2007 forced-VisualLISP.

Take a look here if you feel idle (next paste promoted by Microsoft Explorer...)

http://www.cadtutor.net/forum/showthread.php?101640-AutoLISP-or-Visual-LISP

Posted
Try the following:

(defun-q c:ts nil
   (graphscr)
   (setq c:ts (vl-list* '() (if (equal '(graphscr) (cadr c:ts)) '(textscr) '(graphscr)) (cddr c:ts)))
   (princ)
)

 

Truly Ingenious Lee! I never figured out back in the day that you could make a function re-write itself like that. I understand it a bit better now, but once upon a time I was pulling my hair out trying to figure out a way to do that. Now there it is!

Posted
Truly Ingenious Lee! I never figured out back in the day that you could make a function re-write itself like that. I understand it a bit better now, but once upon a time I was pulling my hair out trying to figure out a way to do that. Now there it is!

 

Thank you! The technique is useful for developing functions which 'learn' from repeated usage...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...