Sign in to follow this  
Followers 0
RussMuss

Autocad Lisp and Autoit

20 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Thatsgreat2345

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by RussMuss

Share this post


Link to post
Share on other sites

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")

Share this post


Link to post
Share on other sites

The button shouldnt be MDIClient1 it should be something like Button1 or Button2 :P

Share this post


Link to post
Share on other sites

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")

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

oKAY attached is a print screen dump of what I have. thanks if you could look at it

Russ

__TEST.doc

Share this post


Link to post
Share on other sites

could u maybe attach a .jpg and make it easy on me xD

Share this post


Link to post
Share on other sites

okay here is a jpg

post-19136-1166582832_thumb.jpg

Share this post


Link to post
Share on other sites

do you understand what the Window Info Tool im talking about?

Share this post


Link to post
Share on other sites

yes I do but I don't understand what it does.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Attached is the info box that I get.....

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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")

EndIf

ControlClick("Equitrac Office" "OK", "1", "left", "1")

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Many thanks for your patience - your line of code it finally worked! this Autoit stuff is not so bad!

cheers Russ

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0