Sign in to follow this  
Followers 0
JaySquared

Pixelsearch finding words?

12 posts in this topic

Ok, a few things before asked.. yes I have searched the forums for the answer but couldn't find it (maybe I missed it). Yes I'm not as advanced as many great programmers here, but I don't expect people to write my code for me either. I have tried this with IE.au3 but I have not found anything there that will assist.

Ok, now that that's out of the way. I'm working on a project to automate some tasks at work. We use a web based Onyx tool. The internet page is an .asp. AutoIt Info shows no control ID's and a class name of "Internet Explorer_Server1". I need to have autoit locate certain points on the page, for example 1 tab out of 8. I can program it based off one resolution, however when resolution changes it doesn't hit the tab. Yes I have tried accommodating for this, but the page doesn't recreate in any equation I can figure out. For example I have checked the following resolutions: 800x600, 1024x768, 1152x864 and 1280x1024. The SEARCH bar is the same place every resolution (10x 252y) however the support tab is at the following locations respectfully.

238x 388y

442x 481y

441x 514y

442x 622y

Since I can't use IE.au3 since I have no control info, can't do a standard pixel equivalent for mouse location I only see two possible options left, unless someone can point me in another direction.

1. Create multiple versions for each resolution

or

2. Is there anyway that I can do some type of pixelsearch to find a grey background and black word?

I've been banging my head against this for 2 days.. please help..


Aha.. I have unlocked it's secrets.. world domination is within my grasp...

Share this post


Link to post
Share on other sites



Actually, recently someone asked someone like this. I couldn't find the topic though, I scrolled back 15 pages.

Here's the math:

a = fixed x/y position found in a resolution

b = resolution of the positions found (say 800x600)

c = desired resolution ( current resolution @DesktopWidth @DesktopHeight)

new position x/y = a/b*c

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Ok, a few things before asked.. yes I have searched the forums for the answer but couldn't find it (maybe I missed it). Yes I'm not as advanced as many great programmers here, but I don't expect people to write my code for me either. I have tried this with IE.au3 but I have not found anything there that will assist.

Ok, now that that's out of the way. I'm working on a project to automate some tasks at work. We use a web based Onyx tool. The internet page is an .asp. AutoIt Info shows no control ID's and a class name of "Internet Explorer_Server1". I need to have autoit locate certain points on the page, for example 1 tab out of 8. I can program it based off one resolution, however when resolution changes it doesn't hit the tab. Yes I have tried accommodating for this, but the page doesn't recreate in any equation I can figure out. For example I have checked the following resolutions: 800x600, 1024x768, 1152x864 and 1280x1024. The SEARCH bar is the same place every resolution (10x 252y) however the support tab is at the following locations respectfully.

238x 388y

442x 481y

441x 514y

442x 622y

Since I can't use IE.au3 since I have no control info, can't do a standard pixel equivalent for mouse location I only see two possible options left, unless someone can point me in another direction.

1. Create multiple versions for each resolution

or

2. Is there anyway that I can do some type of pixelsearch to find a grey background and black word?

I've been banging my head against this for 2 days.. please help..

I think you may have given up on IE.au3 too easily. It does not depend on the ControlIDs like those displayed on AutoIT info. You can read from the page the identifiers of Frames, Tables, and Controls with it. This is NOT an area of expertise for me, so I hope Dale Hohm or someone with IE.au3 smarts jumps in here, but I am pretty sure that Windows ControlIDs are not required to use its functions.

:)

Edit: Spelled Dale's name wrong.

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Actually, recently someone asked someone like this. I couldn't find the topic though, I scrolled back 15 pages.

Here's the math:

a = fixed x/y position found in a resolution

b = resolution of the positions found (say 800x600)

c = desired resolution ( current resolution @DesktopWidth @DesktopHeight)

new position x/y = a/b*c

Actually I did read that post, and tried it, however the asp recreates the page differently. The math logic is good, but the page isn't an exact transition from resolution to resolution.


Aha.. I have unlocked it's secrets.. world domination is within my grasp...

Share this post


Link to post
Share on other sites

I think you may have given up on IE.au3 too easily. It does not depend on the ControlIDs like those displayed on AutoIT info. You can read from the page the identifiers of Frames, Tables, and Controls with it. This is NOT an area of expertise for me, so I hope Dale Holm or someone with IE.au3 smarts jumps in here, but I am pretty sure that Windows ControlIDs are not required to use its functions.

:)

With it being a server side app I wasn't able to return any of the information you mentioned.


Aha.. I have unlocked it's secrets.. world domination is within my grasp...

Share this post


Link to post
Share on other sites

With it being a server side app I wasn't able to return any of the information you mentioned.

Can you post the HTML of the page you wind up with?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

For example, the source code returned for the navbar..

__________________________________________________________________

navsource.txt


Aha.. I have unlocked it's secrets.. world domination is within my grasp...

Share this post


Link to post
Share on other sites

That example uses a common technique of <div> tags and javascript for the menus.

Here is an example of automating such a thing:

#include <IE.au3>

$oIE = _IECreate("http://www.dhtmlcentral.com")

$divs = _IETagNameGetCollection ($oIE, "div")

$divs.item("oM_m1").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m2").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m3").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m4").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m5").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m6").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m7").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m1").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m9").fireEvent("onmouseover")
Sleep(600)
$divs.item("oM_m9").click

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Actually I did read that post, and tried it, however the asp recreates the page differently. The math logic is good, but the page isn't an exact transition from resolution to resolution.

I was afraid you were going to say that. Good luck.

Share this post


Link to post
Share on other sites

@Dale

Forgive me, I just spent the last hour trying to figure this out. How did you find out "oM_m1" first of all, and how did you know what it was connected to? I really am trying to understand HOW this works not just accepting that it works. I see the oM.construct() in the DHTML.com source code and see it looks like it sets up some sort of odd array

new Array(192,avail+"-11",avail+"*2-8",avail+"*3-12",avail+"*4-7",avail+"*5-9",avail+"*6+5")

but I don't understand where it numbers them and lists which is which. Could you help me understand?


Aha.. I have unlocked it's secrets.. world domination is within my grasp...

Share this post


Link to post
Share on other sites

@Dale

Forgive me, I just spent the last hour trying to figure this out. How did you find out "oM_m1" first of all, and how did you know what it was connected to? I really am trying to understand HOW this works not just accepting that it works. I see the oM.construct() in the DHTML.com source code and see it looks like it sets up some sort of odd array

new Array(192,avail+"-11",avail+"*2-8",avail+"*3-12",avail+"*4-7",avail+"*5-9",avail+"*6+5")

but I don't understand where it numbers them and lists which is which. Could you help me understand?

You really need to study the source code for the page and understand what it is doing... it can get complicated.

A caution: the source you see with View Source is not always the real source of the page because, as in this case, the page is being generated on the fly by the Javascript code and View Source shouws you the original source, not what is actually rendered.

To see the real rendered source you should use _IEBodyReadHTML or _IEDocReadHTML becuase they will show you the real rendered source code for the page.

You may also find tools like MODIV2 or the IE Developer Toolbar useful (Google for them).

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

@Dale

THANK YOU.. that was just what I needed! I re-ran your code with an added line of

ClipPut(_IEBodyReadHTML ($oIE))
and was able to see the actual code and see where you got the names and what was associated with them. Thank you so much!

Aha.. I have unlocked it's secrets.. world domination is within my grasp...

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