confuzzled Posted September 10, 2010 Posted September 10, 2010 Hi. Currently, I am openning a file and every so often i get this system generated message box. The options I have are to define or skip. I was wondering if anyone knew how to create a code so that if a message box like this were to pop up, the code would autoselect the "skip" command button and then execute that command. Any help is appreciated. Thanks. Quote
Lt Dan's legs Posted September 10, 2010 Posted September 10, 2010 Look into dcl http://www.afralisp.net/dialog-control-language/ Quote
confuzzled Posted September 13, 2010 Author Posted September 13, 2010 Thanks for the helpful link but I am not quite sure how to apply this to the system generated box as I do not know the dlc reference since it is generated by Autocad and not myself. Also, this message box opens upon startup of the drawing. Right now, I have a code in VBA cycles through openning and closing drawings and then extracts data, so the code I have runs automatically upon startup, but like I mentioned above, I do not know the dlc reference to hide it and select "skip". An alternative I tried was loading the excel objects reference and trying: application.displayalerts=false, but I read elsewhere that this won't work for openning a drawing. Quote
Lt Dan's legs Posted September 13, 2010 Posted September 13, 2010 an example of dcl in action Mtool You do not have to write it in the lisp. This just makes it easier to share. I believe for startup you'll use s:: Quote
irneb Posted September 14, 2010 Posted September 14, 2010 You can send a keystroke to the currently active window (i.e. dialog) using the ActiveX object of WScript.Shell. Sorry I don't have sample code in VBA, but here's how to do it in Lisp. And there should be quite a lot of this sample code for VB (at least) if you do a google on WScript.Shell SendKeys: (or *ws* (setq *ws* (vl-bb-ref '*ws*)) (and (setq *ws* (vlax-get-or-create-object "WScript.Shell")) (vl-bb-set '*ws* *ws*) ) ) (vlax-invoke *ws* 'SendKeys "{ESC}") ;Send ESC key (vlax-invoke *ws* 'SendKeys "S") ;Send S keystroke The 1st part is just so I only have one reference to the ActiveX object for the entire acad session - otherwise you end up having a memory leak. Not sure if the same problem occurs using VBA? Anyhow, what I don't know how to do is to check if a dialog is already open. Sending the key(s) to a DWG which doesn't require them may cause other problems. Edit: Could youmaybe post the exact message displayed in this box? Maybe it's as simple as setting some sysvar like FileDia or such. Quote
confuzzled Posted September 14, 2010 Author Posted September 14, 2010 Msgbox: "Undefined Alias Referenced" (in blue header) Smaller box within the message box : "Details" within the smaller box: line 1: "Alias: _map" within the smaller box: line 2: "street_all.dwg" buttons at bottom: define (auto selected), skip, help Unfortunately, there are too many of these references undefined in over many drawings so defining them is not a very plausible option. I tried to use send keys in vba, but I could not get the send keys to access the message box or what the message box is named so that I can identify it in my code. Quote
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.