MJLM Posted July 3, 2014 Share Posted July 3, 2014 This may be a rather lame question but how can I bring up the "Autocad Text Window" using autolisp instead of the 'manual' F2 key? The idea is to throw a couple of prompt commands to report results in the text window but it seems I cant find something to call and open this window out of an Autolisp routine. Anyone knows? Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted July 3, 2014 Share Posted July 3, 2014 as it named (textpage) ;or (textscr) ;vice verse (graphscr); returns graphic screen Quote Link to comment Share on other sites More sharing options...
Spaj Posted July 3, 2014 Share Posted July 3, 2014 Why not try an (Alert "message") box Quote Link to comment Share on other sites More sharing options...
MJLM Posted July 3, 2014 Author Share Posted July 3, 2014 as it named (textpage) ;or (textscr) ;vice verse (graphscr); returns graphic screen thanks a lot! Quote Link to comment Share on other sites More sharing options...
MJLM Posted July 3, 2014 Author Share Posted July 3, 2014 Why not try an (Alert "message") box cause the data returned are too many, you need to scroll to review all. Quote Link to comment Share on other sites More sharing options...
Deby Ferdian Posted March 23, 2016 Share Posted March 23, 2016 How to make both of them (toggle function as textscr hide/show) in full LISP? I try with this sample that I get this example from somewhere when I'm browsing.. (defun c:TS () (if (dos_istextscr) (graphscr) (textscr))) (defun c:TW () (if (zerop (getvar "opmstate")) (command "textscr") (command "graphscr") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 23, 2016 Share Posted March 23, 2016 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) ) Quote Link to comment Share on other sites More sharing options...
Deby Ferdian Posted March 24, 2016 Share Posted March 24, 2016 Hehe.. You got me twice at the same question it's ~.AWESOME.~ again, very outs standing! Quote Link to comment Share on other sites More sharing options...
Deby Ferdian Posted March 27, 2016 Share Posted March 27, 2016 Hi, How to we including the "AI_DESELECT" to that code after graphscr done ? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 27, 2016 Share Posted March 27, 2016 Hi, How to we including the "AI_DESELECT" to that code after graphscr done ? Try the following: (defun-q c:ts nil (progn (graphscr) (sssetfirst nil nil)) (setq c:ts (vl-list* '() (if (equal '(textscr) (cadr c:ts)) '(progn (graphscr) (sssetfirst nil nil)) '(textscr)) (cddr c:ts))) (princ) ) Quote Link to comment Share on other sites More sharing options...
Deby Ferdian Posted March 27, 2016 Share Posted March 27, 2016 (edited) How about for this code, I forgot where is I got this LISP code from.. ??? But All I know is this LISP code for a function to look a properties from the object we are select, looking this: (defun c:Q () (if (zerop (getvar "opmstate")) (command ".properties") (command ".propertiesclose") ) (princ) ) And How to put the "AI_DESELECT" this on into the above the code I write ? Edited March 27, 2016 by Deby Ferdian Fix first line! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 27, 2016 Share Posted March 27, 2016 (defun c:q nil (if (zerop (getvar 'opmstate)) (command "_.properties") (progn (command "_.propertiesclose") (sssetfirst nil nil)) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Deby Ferdian Posted March 27, 2016 Share Posted March 27, 2016 (edited) Wow.. It's so fast response @Lee Mac! It's fully really helfully really.. But nobody to good response me on my another thread. If you mind, would you ??? See on this link at the same forum; http://www.cadtutor.net/forum/showthread.php?96188-Create-a-LISP-as-a-function-for-Section-Plan-gt-View-to-the-section-gt-UCS-to-the-current&p=657622 http://www.cadtutor.net/forum/showthread.php?96183-Instead-of-quot-ESC-quot-Buttion!&p=657602 Edited March 27, 2016 by Deby Ferdian Insert Awesome word! Quote Link to comment Share on other sites More sharing options...
Deby Ferdian Posted March 27, 2016 Share Posted March 27, 2016 Please help me! Quote Link to comment Share on other sites More sharing options...
Deby Ferdian Posted March 27, 2016 Share Posted March 27, 2016 How about to change "graphscr" with a something like we send a key to it "% h" (alt+h to hide a textscr). is this possible???? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 27, 2016 Share Posted March 27, 2016 How about to change "graphscr" with a something like we send a key to it "% h" (alt+h to hide a textscr). is this possible???? Perhaps something like this: (defun-q c:ts nil (graphscr-action) (setq c:ts (vl-list* '() (if (equal '(textscr) (cadr c:ts)) '(graphscr-action) '(textscr)) (cddr c:ts))) (princ) ) (defun graphscr-action nil (if (= :vlax-true (LM:appactivate "AutoCAD Text Window")) (LM:sendkeys "%(H){ESC}{ESC}") ) (sssetfirst nil nil) ) ;; App Activate - Lee Mac ;; A wrapper for the appactivate method of the WSH ;; str - [str] Application title or Process ID (defun LM:appactivate ( str / rtn wsh ) (if (setq wsh (vlax-create-object "wscript.shell")) (progn (setq rtn (vl-catch-all-apply 'vlax-invoke-method (list wsh 'appactivate str))) (vlax-release-object wsh) (if (vl-catch-all-error-p rtn) (prompt (vl-catch-all-error-message rtn)) rtn ) ) ) ) ;; Send Keys - Lee Mac ;; A wrapper function for the SendKeys method of the WSH ;; Reference: http://msdn.microsoft.com/en-us/library/8c6yea83%28v=vs.85%29.aspx (defun LM:sendkeys ( str / wsh rtn ) (if (setq wsh (vlax-create-object "wscript.shell")) (progn (setq rtn (vl-catch-all-apply 'vlax-invoke (list wsh 'sendkeys str))) (vlax-release-object wsh) rtn ) ) ) (vl-load-com) (princ) Quote Link to comment Share on other sites More sharing options...
Deby Ferdian Posted March 27, 2016 Share Posted March 27, 2016 (edited) Hi, @Lee Mac the code actually does not work at all, in fact what happens is hiding and showing the palettes(autocad) and start menu windows(the left corner of taskbar)! While intended only hiding behind the windows of AutoCAD. I have look at a similar code and it seems also posted by you look at this; (defun _graphscr ( / wsh ) (setq wsh (vlax-create-object "WScript.Shell")) (vlax-invoke wsh 'appactivate (strcat "AutoCAD Text Window - " (if (eq (getenv "ShowFullPathInTitle") "1") (getvar 'DWGPREFIX) "" ) (getvar 'DWGNAME) ) ) (vlax-invoke wsh 'sendkeys "% H") (vlax-release-object wsh) (princ) ) (defun c:CTW ( / 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) ) (vl-load-com) (princ) and they was same, they were just hiding and showing the palettes and start menu windows! Do you have an any idea? or is it supposed be changed first by me before I running it of all. Right??? Edited March 27, 2016 by Deby Ferdian There are so a lot of miss words! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 27, 2016 Share Posted March 27, 2016 The code I have posted performs successfully in my testing - what version & language of AutoCAD are you using? Quote Link to comment Share on other sites More sharing options...
Deby Ferdian Posted March 27, 2016 Share Posted March 27, 2016 (edited) Of mine is AutoCAD 2013 x64, version of G.55.0.0, I'm not sure about the language. It might besure my region is Indonesia so it will be corresponding to my country too. Right??? Edited March 27, 2016 by Deby Ferdian Just make a bold to several word of my written! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 27, 2016 Share Posted March 27, 2016 Of mine is AutoCAD 2013 x64, version of G.55.0.0, I'm not sure about the language. It might besure my region is Indonesia so it will be corresponding to my country too. Right??? Essentially, what is the caption of your text window? For English versions, this is: AutoCAD Text Window The above posted code relies on using this caption to identify the appropriate window to activate (using the appactivate method) before issuing the Alt+H keystroke (using the sendkeys method). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.