Boblinski Posted August 31, 2011 Posted August 31, 2011 So I've started using AutoIt recently. I am having trouble getting it to work inside of several programs. At the moment I am trying to set up a design one for a drawing program to add dimensions onto certain spots etc and headers etc. For now though, I cannot get any script to work.. Even something simple like moving the mouse to top right, then bottom middle, then top left and click. The little script will work if I do not click over to (or WinActivate to) the design program.. however as soon as I change over to it... nothing happens, I have put sleeps before/between actions and it does not make any diff. Any reason why it wouldn't be working? Thanks for your help in advance!
sleepydvdr Posted August 31, 2011 Posted August 31, 2011 It sounds like you are trying to automate interacting with a program. Instead of using coordinates to click, how about using the AutoIt Info Window (comes with AutoIt) to get control IDs and use ControlClick to interact with them. If I am misunderstanding you, please give an exact example of something you are trying to do and maybe post the code you tried. #include <ByteMe.au3>
JohnOne Posted August 31, 2011 Posted August 31, 2011 Some applications actively resist automation, they do this in a number of ways, including using non standard controls, the point is, usually its because the application developers do not want the software to be automated. But not always, some people have had limited success with the likes of delphi applications, perhaps if you supply the name of the application you might find more specific help. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Boblinski Posted August 31, 2011 Author Posted August 31, 2011 the program is a mapping program used in th i am not 100% sure but i believe it is written indelphi+java. however i have no knowledge of these. i am replying VIA cellphone so do not have exact code with me.. but in short hand i tried both: sleep4000 ;click to program heremouseclick(left,1000, 700) sleep2000 mouseclick(1000,30) in this example.. it works if i don't click into map program. winactivate(agrimap editor) sleep2000 mouseclick(1000, 700) sleep2000 mouseclick(1000,50) in this example it changes to the program then does nothing. thanks for your help. sorry for the messy cellphone replywZealanddairy and beef industry to map farmland.
Boblinski Posted September 1, 2011 Author Posted September 1, 2011 (edited) Okay, just got home. The actual script I have been trying is: WinActivate("Agrimap Editor") Sleep(6000) MouseClick("left",200,600) sleep(500) MouseClick("left",850,300) This brings the editor to the forefront of my PC... but then the mouse just sits still. After about 5 seconds the system tray icon at the bottom right disappears. I have tried what you said about the ControlClick.. but I am not sure how exactly to use the control click function.. ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y ]]]] ) So do I just put "Argimap Editor" for the title? Or do I use the Class from Basic Window Info?("Agr_Main") Also, do I need a "text" and controlID? And do I use the ControlClick Coords for x and y? This is what I tried... it compiled.. but didn't work: WinActivate("Argimap Editor") Sleep(4000) ControlClick("CLASS:Arg_Main","","left",2,147,147) ;double click in northwest corner Once again, this switches to Argimap but then does nothing.. after a bit the icon disappears from system tray. Edited September 1, 2011 by Boblinski
Boblinski Posted September 1, 2011 Author Posted September 1, 2011 *bump* sorry, really want to start working on this.
JohnOne Posted September 1, 2011 Posted September 1, 2011 ControlClick("CLASS:Arg_Main","","left",2,147,147) Is that really the control ID? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
MvGulik Posted September 1, 2011 Posted September 1, 2011 (edited) *bump* sorry, really want to start working on this.Just don't make it a habit, bumping your topics in less than 24h ... Edited September 1, 2011 by iEvKI3gv9Wrkd41u "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
Boblinski Posted September 1, 2011 Author Posted September 1, 2011 (edited) Is that really the control ID? WinActivate("Agrimap Editor") SLeep(4000) ControlClick("Agrimap Editor","","","left",2,147,147) How about that? Cause it's still not working. Edited September 1, 2011 by Boblinski
Boblinski Posted September 1, 2011 Author Posted September 1, 2011 Thought it may be relevant to mention I am running Windows 7(64bit).. and the latest version of AutoIt
BrewManNH Posted September 1, 2011 Posted September 1, 2011 WinActivate("Agrimap Editor") SLeep(4000) ControlClick("Agrimap Editor","","","left",2,147,147) How about that? Cause it's still not working. To use ControlClick, you need a control ID, your command line above doesn't have one, it's blank. The X and Y parameters refer to the coordinates on the control you're trying to click, and not the location on the screen or window that it's located at. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
AdmiralAlkex Posted September 1, 2011 Posted September 1, 2011 To use ControlClick, you need a control IDNo you don't. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
BrewManNH Posted September 1, 2011 Posted September 1, 2011 No you don't.You're correct, I misstated that. You need something in there that relates to the control though in place of the actual control ID, it can't be blank A special description can be used as the controlID parameter used in most of the Control...() functions . This description can be used to identify a control by the following properties:ID - The internal control ID. The Control ID is the internal numeric identifier that windows gives to each control. It is generally the best method of identifying controls. In addition to the AutoIt Window Info Tool, other applications such as screenreaders for the blind and Microsoft tools/APIs may allow you to get this Control IDTEXT - The text on a control, for example "&Next" on a buttonCLASS - The internal control classname such as "Edit" or "Button"CLASSNN - The ClassnameNN value as used in previous versions of AutoIt, such as "Edit1"NAME - The internal .NET Framework WinForms name (if available)REGEXPCLASS - Control classname using a regular expressionX \ Y \ W \ H - The position and size of a control.INSTANCE - The 1-based instance when all given properties match. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
Boblinski Posted September 1, 2011 Author Posted September 1, 2011 I think the problem is that Agrimap won't let the commands work, how can I work around this perhaps?
Boblinski Posted September 2, 2011 Author Posted September 2, 2011 The only thing I can get to record on it is: Easy Macro Recorder.. And this works on there: Wait 16 MouseMove 907,351 Wait 125 MouseMove 907,351 KeyUp Ctrl Wait 100 KeyUp Alt Wait 100 I know not the same coding system but it does work... but I wanna use autoit cause it has the pixels detect and stuff.
Boblinski Posted September 4, 2011 Author Posted September 4, 2011 I just installed the exact same version of Agrimap Editor, and the exact same version of AutoIt onto an older PC running windows XP.... And on the older PC the MouseClicks and everything work...! The PC that I actually use (the one I have been struggling with) runs Windows 7. Are there any settings, or something that I might have installed (I have nothing out of ordinary... only running McAfee security), that could be causing the problems? Any help is greatly appreciated.
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