Jump to content

Controls


Recommended Posts

I can't figure out controls.

Can someone answer a few questions I have?

1. Is it possible to locate(x, y) a Java app? The control I'm trying to use has no Control ID and a ClassNameNN of "SunAwtCanvas2".

2. If I'm trying to get autoit to use a control, do I have to specify if I'm giving it an ID, ClassName, or something else?

3. Do Control IDs alwas stay the same? Like my address bar is

"Control ID: 41477"

"ClassNameNN: Edit2"

More questions to come...

Link to comment
Share on other sites

I can't figure out controls.

Can someone answer a few questions I have?

1. Is it possible to locate(x, y) a Java app? The control I'm trying to use has no Control ID and a ClassNameNN of "SunAwtCanvas2".

2. If I'm trying to get autoit to use a control, do I have to specify if I'm giving it an ID, ClassName, or something else?

3. Do Control IDs alwas stay the same?  Like my address bar is

"Control ID: 41477"

"ClassNameNN: Edit2"

More questions to come...

<{POST_SNAPBACK}>

When I saw your post title, I was all prepared to answer, "Very well" but then I saw your questions... :-)

Q1 ...locate x,y

A1 if the info tool shows an x,y unique to that java window, then yes.

Q2 ...have to specify...

A2 nope

Q3 ...stay the same

A3 I'm not sure, but would guess that they change, perhaps with software revs/upgrades or vary from computer to computer. My address bar is not "Edit2" for the ClassNameNN.

from the help file:

Note: AutoIt only works with standard Microsoft controls ..........

but give it a try

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Q1 comment: How could I do something like that? Toolbars are alwas throwing off where places are on the screen.

Q2 comment: Cool!

Q3 comment: Would it stay the same if there were no updates?

Mine (address bar) seems to have stayed the same from yesturday.

Also when you say "AutoIt only works with standard Microsoft controls ..........", what would that include/exclude?

Link to comment
Share on other sites

Q1 comment: How could I do something like that?  Toolbars are alwas throwing off where places are on the screen.

Q2 comment: Cool!

Q3 comment: Would it stay the same if there were no updates?

Mine (address bar) seems to have stayed the same from yesturday.

Also when you say "AutoIt only works with standard Microsoft controls ..........", what would that include/exclude?

<{POST_SNAPBACK}>

A1 - not easy to do or easy to explain. Also, it will not be fast, so if this is for a game, it might not work. If the area that you want to click on stays about the same color when you are ready to click, then search the forum for PixelChecksum.

This is a very brief description of how I would use PixelChecksum for this:

you define a small "area" around the part that you want to click on

write that into a small test script

...along with a msgbox to tell you the value returned by the function

PixelCoordMode

$value = PixelChecksum $X,$Y,$X+20,$Y+20

MsgBox $value ;;;; for example, $value = 121212

run the test script and you will know the "value" that the main script is to "look for"

in the main script:

write a loop that "scapes" a small portion of the screen

WinTitleMatchMode

;

;code to move and resize window (WinMove)

;code to turn off toolbars (for IE, alt-v and more)

;

For $X = 145 to 200 ;defines the left to right area to scrape

For $Y = 122 to 144 ;defines the top to bottom area to scrape

If 121212 = PixelChecksum $X,$Y,$X+20,$Y+20 Then

MouseClick $X+10,$Y+10

ExitLoop 2

EndIf

Next

Next

Caveat to the steps and pseudo-code above - I've never had to code something like this, if you need more details then perhaps others can post their code or correct my method described above.

A2 - yes, the AutoIt authors are great

A3 - I'm not sure how to tell what is a standard control and what is not... but since the controls sometimes work on non-standard controls - just experiment.

hope this helps

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Cool, I've only done pixel searches before so this should be interesting. Im wondering how the autoit window info program gets its infomation. How does it get the control's location as soon as you have your curser over it? Is it possible to do with autoit?

Link to comment
Share on other sites

Cool, I've only done pixel searches before so this should be interesting.  Im wondering how the autoit window info program gets its infomation.  How does it get the control's location as soon as you have your curser over it?  Is it possible to do with autoit?

<{POST_SNAPBACK}>

I do not know how AutoIt gets that info. I would post these questions to the chat area and see what you get from those that developed "The Magic that is AutoIt".

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

  • 2 weeks later...

In the chat? Isn't that off topic? Would they like that?

<{POST_SNAPBACK}>

I think that chat is pretty much open to anything: "General chat. Books, films, TV, whatever"

This is definately a "whatever" question. :-)

[size="1"][font="Arial"].[u].[/u][/font][/size]

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...