RussMuss Posted December 19, 2006 Share Posted December 19, 2006 Gidday! We use Autocad in our office and have third party software to capture the job number when we print. However this can be annoying to click okay onto a dialog box everytime we print a drawing. I would like Autolisp (which is a built in programming language within Autocad) to be linked to Autoit. I can write a batch print script in Autolisp but I would like it linked to Autoit to automatically click on to the dialog box to make it 'disappear'. Is there any way to make this work?. Please note I don't know very much about Autoit, so don't go over my head! Many thanks if someone could solve our annoying problem cheers Russ Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 19, 2006 Share Posted December 19, 2006 (edited) well if it has a distinct title u can use WinExists along with controlclick to click the OK button use the Autoit Window Info Tool thats on the start menu when u installed autoit. This will give u the required info Edited December 19, 2006 by Thatsgreat2345 Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted December 19, 2006 Moderators Share Posted December 19, 2006 I'm not familiar with Autolisp, but AutoCAD has a COM Interface that may be able to accomplish this. What version of AutoCAD are you running? Link to comment Share on other sites More sharing options...
RussMuss Posted December 19, 2006 Author Share Posted December 19, 2006 (edited) Thanks for the reply. I can't figure out how to combine the 2 functions that you have mentioned and make a *.au3 file. Can you give me an idea I am running Autocad 2007. What is a COM interface? thanks Russ Edited December 19, 2006 by RussMuss Link to comment Share on other sites More sharing options...
RussMuss Posted December 19, 2006 Author Share Posted December 19, 2006 I have put together the below code. Is this correct? I have tried to run the below script when I am in Autocad and print the dialog box pops up with "Equitrac Office" but the box okay button is not clicked. What am I doing wrong? If WinExists("Untitled -") Then MsgBox(0, "Equitrac Office", "Window exists") EndIf ControlClick("Untitled -", "", "MDIClient1") Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 19, 2006 Share Posted December 19, 2006 The button shouldnt be MDIClient1 it should be something like Button1 or Button2 Link to comment Share on other sites More sharing options...
RussMuss Posted December 20, 2006 Author Share Posted December 20, 2006 I have tried your suggestion as below but it does not work. Am I supposed to run the script then when I print a drawing in Autocad it will automatically 'okay' the dialog box that pops up - like it is supposed to? Is the file supposed to be in a particular file search path? If WinExists("Untitled -") Then MsgBox(0, "Equitrac Office", "Window exists") EndIf ControlClick("Untitled -", "", "button1") Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 20, 2006 Share Posted December 20, 2006 Could you post everything you have in the Autoit WIndow Info im guessing its a regular window and the buttons dont have control ID's so , if you press enter what happens cuz u can always controlsend enter and if the OK button is the default button itll press it Link to comment Share on other sites More sharing options...
RussMuss Posted December 20, 2006 Author Share Posted December 20, 2006 oKAY attached is a print screen dump of what I have. thanks if you could look at it Russ__TEST.doc Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 20, 2006 Share Posted December 20, 2006 could u maybe attach a .jpg and make it easy on me xD Link to comment Share on other sites More sharing options...
RussMuss Posted December 20, 2006 Author Share Posted December 20, 2006 okay here is a jpg Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 20, 2006 Share Posted December 20, 2006 do you understand what the Window Info Tool im talking about? Link to comment Share on other sites More sharing options...
RussMuss Posted December 20, 2006 Author Share Posted December 20, 2006 yes I do but I don't understand what it does. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 20, 2006 Share Posted December 20, 2006 it gets the class ID and alot of stuff of what ever control is under the mouse , thus when the window u want to press ok pops up, go to it put ur mouse on the Ok Button, pause it by press ctrl shift f i think , and then tell me what the stuff says Link to comment Share on other sites More sharing options...
RussMuss Posted December 20, 2006 Author Share Posted December 20, 2006 Attached is the info box that I get..... Link to comment Share on other sites More sharing options...
RussMuss Posted December 20, 2006 Author Share Posted December 20, 2006 oops no attachment...... my file was too big! here is a copy paste from the active window. This is the window when I have the mouse over the ok button. I see what you mean about the name of the okay button - button3. I did try changing the name to button3 but still nothing happens ie If WinExists("Untitled -") Then MsgBox(0, "Equitrac Office", "Window exists") EndIf ControlClick("Untitled -", "", "Button3") here is the active window............. Press CTRL-ALT-F to freeze the display. >>>>>>>>>>>> Window Details <<<<<<<<<<<<< Title: Equitrac Office Class: #32770 Size: X: 452 Y: 426 W: 376 H: 145 >>>>>>>>>>> Mouse Details <<<<<<<<<<< Screen: X: 637 Y: 522 Cursor ID: 2 >>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<< RGB: Hex: 0xD4D0C8 Dec: 13947080 >>>>>>>>>>> Control Under Mouse <<<<<<<<<<< Size: X: 161 Y: 68 W: 95 H: 23 Control ID: 1 ClassNameNN: Button3 Text: OK Style: 0x50010001 ExStyle: 0x00000004 >>>>>>>>>>> Status Bar Text <<<<<<<<<<< >>>>>>>>>>> Visible Window Text <<<<<<<<<<< C:\Documents and Settings\rxbeeto0\My Documents\Drawing1 Layout (1) Billing Code 42046954.00010 42046954.00010 OK Cancel >>>>>>>>>>> Hidden Window Text <<<<<<<<<<< Reset Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 20, 2006 Share Posted December 20, 2006 While 1 If WinExists("Equitrac Office") Then ControlClick("Equitrac Office","","Button3") Endif sleep(100) Wend Link to comment Share on other sites More sharing options...
RussMuss Posted December 20, 2006 Author Share Posted December 20, 2006 okay looking at the help file I have tried this, but I get an error in my expression, the last line is incorrect ,any ideas what is wrong?If WinExists("Untitled -") Then MsgBox(0, "Equitrac Office", "Window exists")EndIfControlClick("Equitrac Office" "OK", "1", "left", "1") Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 20, 2006 Share Posted December 20, 2006 ControlClick ( "title", "text", controlID [, button] [, clicks]] ) Title of window Text of Window(not needed just leave it blank "") Control ID ( Button3) thats all u need i provided an example of it properly above why are you checking if Notepad Exists? Link to comment Share on other sites More sharing options...
RussMuss Posted December 20, 2006 Author Share Posted December 20, 2006 Many thanks for your patience - your line of code it finally worked! this Autoit stuff is not so bad! cheers Russ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now