ketongin Posted February 18, 2013 Share Posted February 18, 2013 Is it possible to close a windows application via lisp? ie mspaint, excel or word. Thanks. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 19, 2013 Share Posted February 19, 2013 Did you look up some of the examples for opening say excel then closing would be the same. have a look at say GETEXCEL.LSP Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 19, 2013 Share Posted February 19, 2013 If the application that you want to close was open via your AutoLISP code, then is easy to close it since you know its identifiers. Other you must locate the running process - this is done usually using the content of its caption (label on title bar). However this is quite difficult and not always reliable. It also cannot be done with plain AutoLISP. Quote Link to comment Share on other sites More sharing options...
ketongin Posted February 20, 2013 Author Share Posted February 20, 2013 The process that I want to kill is "Autocad Text Window" I've search everywhere but couldn't find a solution. Since F2 doesn't work if the window pop-up on the second monitor. My goal is F2 = open acad windows 2 = Close acad windows Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 20, 2013 Share Posted February 20, 2013 Try this: (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) Quote Link to comment Share on other sites More sharing options...
ketongin Posted February 21, 2013 Author Share Posted February 21, 2013 many thanks Lee. Works great. Try this: (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) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 21, 2013 Share Posted February 21, 2013 many thanks Lee. Works great. Excellent, you're welcome. Quote Link to comment Share on other sites More sharing options...
gS7 Posted February 21, 2013 Share Posted February 21, 2013 Lee what about (graphscr) option Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 21, 2013 Share Posted February 21, 2013 Lee what about (graphscr) option I can't test, but I'm not sure whether (graphscr) works when the Text Window is on a second monitor. Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 21, 2013 Share Posted February 21, 2013 I confirm that the GRAPHSCR call will close the text window only when is on the same screen as main, graphical, one. 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.