Jump to content

Things not working inside program


Recommended Posts

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!

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by Boblinski
Link to comment
Share on other sites

*bump* sorry, really want to start working on this.

Just don't make it a habit, bumping your topics in less than 24h ... Edited 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 ...
 

Link to comment
Share on other sites

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 Gude
How 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

Link to comment
Share on other sites

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 ID
  • TEXT - The text on a control, for example "&Next" on a button
  • CLASS - 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 expression
  • X \ 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 Gude
How 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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...