Sign in to follow this  
Followers 0
Foaman

Locate Text Winwheretext?

11 posts in this topic

#1 ·  Posted (edited)

Hello.

It would really help with my scripting if I could use text locations in my scripting.

Basically I want to use like

$text = WinGetText("untitled - notepad", "blah")
If $text<>1 then
$pos = WinGetPos("untiled - notepad", "blah")"
MouseClick("left", $pos[0], $pos[1])
EndIf

Something like that?

I have no idea if that is even close to right, but I think that the general idea can be gathered. WinGetPos gives the location of a window, but it's in the form, and I quote " WinGetPos ( "title" [, "text" ] ).

What is "text" useful for, if it can't be used to get the position of the text itself?

I guess, more specifically, I want to get the X: and Y: under Mouse Details>Screen: in the AutoIt v3 Active Window Info tool.... I guess it's possible that I could just have the script find the text, bring the cursor to the text, somehow, and then read the x and y from that program? But I can't have the cursor go to the text without knowing its location. ANY advice or input is greatly appreciated. This would be SO SO helpful. Thanks.

Also, if this process could be recreated, but then a specific letter or word could be found within the findings. This is probably easier, and I may be able to figure it out myself if I get the answer to the original question, but this would help, also.

So a for instance would be to have the script do this:

"Find the sentence, "I like peanutbutter."

If the phrase exists, find "t" one time in the phrase, hit backspace 6 times, send return."

So then the sentence would say, "I like butter."

If you just have the script locate the sentence, "I like peanutbutter." And click randomly, then hit backspace, the first character deleted may be the 'B' or the 'R' or the 'I'; this would be undesired, and screw the whole sentence up.

This is only important to me because there is a button that I want to click on, and it is the words "Click Here". The button itself is only accessable for clicking at the space between the two words, then you will want to find the location of the space, not just the words, and click there! Dead center!

I know... Any work around ideas? Anything? Thanks

Edited by Foaman

Share this post


Link to post
Share on other sites



is this online?

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Is this a Control that is holding the text? (Does it have a control id?)


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

The program is online, but I don't know if the button? has a control ID. I should hope that it does, if that would help. Do you know how I might find out?

http://www.autoitscript.com/forum/index.php?showtopic=21048

If i remember correctly, the tutorial application above has a tutorial on using "AutoIt Window Info".

P.S. - How do you make a box that says "CODE"? Do you just use HTML?

Look here: http://www.autoitscript.com/forum/index.ph...nds&CODE=bbcode

#)

Edited by nfwu

Share this post


Link to post
Share on other sites

What's the applications name?


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

It is online. There is no control ID. The applications are Guild Wars and Mozilla.

Share this post


Link to post
Share on other sites

IE.au3 can get the source and you can parse accordingly to get the text, but the actual position of the text is hard to get...

Why do you need the position?


---Sparkes.

Share this post


Link to post
Share on other sites

I don't see any way to do this...

why do you need to do this? maybe there is some other way to solve the problem..?


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

There are a number of things I would like to do. I am trying to make a good script for Guild Wars, having it automatically loot items with specific names, like "Gold" and "Enchanted Stones", and anything stackable. Right now, there is a script made to automatically loot Gold, Purple, Green, and Blue items, but there is nothing that will automatically loot gold without filling your inventory with useless Black items. (The colors represent how rare the item is, black being least rare and including gold.) Also, if the text appears, 'You have been resurected by ___ Soulstone.' Meaning that your entire party died and is suffering from a death penalty (death penalties reduce hitpoints and mana points until you return to town), I would like to send 'm' to the game, then locate the closest town on the map, by name, and have a left click sent to that location, followed by a simple auto-walk out of town. Because you always end up being resurected in a differnet area, there is no telling whether or not you will click in the right spot to go to a town. Also, this would allow me to configure which monsters the character attacks. If the monster is below 600 pixels, it should not be attacked. It might be too low to be reached by arrows or pets. An obstructed target will make your character shoot the wall all night.

In Mozilla, I want to do something easier. I want to have whatever I write in Microsoft Word automatically spell checked and posted on my live journal. I already have the spell check part down pat, but I cannot get the script to send to my journal properly, because after browsing to the webpage, there is always a different number of objects before the login, and the login button often moves, depending on the ads.

If I could just get the text "Login" and have a left click sent ot its location, then the same for "Post Entry", there would be no problem with the script, but right now I am relying off of {TAB} sends. Each time I send tab, the link selected changes one time. Because the number of links to select keeps changing, it's not an alternative, and Mozilla does not have control IDs.

This would also save me a lot of time, because I have worked it out so that it will send multiple entries to my journal. This way, when I write several reports over the period of a day or two, I can just place them in my que for uploads, turn on my script, and drive to school, saving myself five or ten minutes worth of load and wait time on my cruddy modem and for uploads and whatnot. I don't have POP mail, either, so it would save me time and money when sending things to friends, and teachers, and so on, if I could do the same for my e-mail.

Appreciate all input.

'

I know that the gaming thing is stupid, but really the only reason that I do it is because I like playing with this program. I could care less about the game. It runs really laggy on my machine, anyway, because of the slow internet connection.

Share this post


Link to post
Share on other sites

#10 ·  Posted

It seem I have a similar but more simple question. I want to know is it possible or how can I get the text which mouse is over in dialog,msg box or some where else?

Share this post


Link to post
Share on other sites

#11 ·  Posted

For the web page, I'd really recommend learning how to make a User Agent or spider.

User Agents, literally pull web requests from servers, and then you can manually post the form

back into whatever CGI they have on the site. For example, I have made a simple spider

that goes out and resets email passwords for an external email server that only has a web

administration page (Since it isn't under our company's direct control).

User Agents are great, because you can make logic based on the HTML returned from a site.

If the login uses Javascript to create cookies, you'll probably have to go with IE::Mechanize,

rather than the LWP::UserAgent. Then again, these are perl libraries, and I'm not sure

if you want to learn a whole language just to make a proper solution to your problem.

If you want some advice on it.. feel free to PM me. I can get you started,

in the right direction. Had nobody to help me when I've made all this crap that I've made.

Just me and the documentation.

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