AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Please help me quick! Help with screen reading
Goto page 1, 2  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
keavon2
Guest





PostPosted: Sun Oct 04, 2009 9:33 pm    Post subject: Please help me quick! Help with screen reading Reply with quote

Thanks, is it possable to have autohotkey read and an area of your screen? I have this game that will ask you random questions (there is about 20 questions that is asked in a random sequence) currently I have it answering randomly, but that is a 1/27 chance of it being correct, because it asks 3 questions and there is 3 answers. What I want is for it to read the question and then for it to eather turn the picture it finds into words or for it to remember the pic it just took and say "oh I remember that one, the answer is the middle answer and then it will click on the cords of the middle one.

Thanks everyone! Im new to autoHotKey, but I have allready found it very useful!

~Keavon

P.S. Please try to answer it quickly because the game is about to end and im trying to win something
The game is at www.septimusheap.com, if you want to check it out, just sign in as guest and click on a random place that is highlited and use the gold rind to find a RED stone with a Q on it, then click on it. That's the quiz thing i want to have it do!
Thanks!
Back to top
jethrow



Joined: 24 May 2009
Posts: 1907
Location: Iowa, USA

PostPosted: Sun Oct 04, 2009 10:08 pm    Post subject: Reply with quote

keavon2 wrote:
P.S. Please try to answer it quickly ...
Laughing

You may want to try ImageSearch.
_________________
Very Happy - in case I forgot to smile
Basic Webpage Controls
COM Object Reference
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Keavon



Joined: 04 Oct 2009
Posts: 22

PostPosted: Sun Oct 04, 2009 11:19 pm    Post subject: Thanks jethrow. Reply with quote

jethrow wrote:


You may want to try ImageSearch.


Thanks jethrow, you responded at most hours after I posted it! Thank you, but do you think you could tell me how to use it?? I would REALLY appriciate it!
Thanks again!
PS How can I PM you to ask more? I just started on this forum today, Thanks.
Back to top
View user's profile Send private message
tidbit



Joined: 09 Mar 2008
Posts: 1807
Location: Minnesota, USA

PostPosted: Mon Oct 05, 2009 2:37 am    Post subject: Reply with quote

why PM?
then any other users with similar/same questions wouldn't get an answer.
PM'ing is really a bad feature, IMO.

PS: to see how a command works, read the manual. at the bottom of almost every page are examples. usually many.
_________________
rawr. be very afraid
*poke*
Note: My name is all lowercase for a reason.
Even monkeys fall from trees. - Japanese proverb
Back to top
View user's profile Send private message
Keavon



Joined: 04 Oct 2009
Posts: 22

PostPosted: Mon Oct 05, 2009 11:56 pm    Post subject: Thanks again. But I have an other question if u dont mind Reply with quote

Hmm... I guess That might make since, also if i wanted to manually do it, I have to click on the correct answer then push accept, I want to push the number pad: 1, 2, or 3 so it will auto click on the correct one (1 = top, 2 = middle & 3 = bottom), but then I want it to ALSO push accept, I already made it be able to click on the answer, but i cant make it click on accept, afterward, which it wont do. It would be ideal if it would count up to 3 different times, so it would push play again afterward. like every time it pushes a button, it will add to a variable and when it reaches 3 it will also push the play again button, then reset it to 0.

Thanks, Im sorry for being a nub, but maby when I learn enough I will be able to help other noob's questions!

Thanks again.
~Keavon
Back to top
View user's profile Send private message
Leef_me



Joined: 08 Apr 2009
Posts: 5333
Location: San Diego, California

PostPosted: Tue Oct 06, 2009 5:08 am    Post subject: Reply with quote

When you first posted, It seemed like you wanted a script to run through the questions automatically. Your last post seems to indicate you want a helper script, to push buttons. Which do you want?

If you want the helper script, you could use autoscriptwriter to record 3 quick scripts each consisting of click 1 of the three answers and then the next/accept button. Then you could trim the scripts and add hotkeys for each.

If you want the script to "recognize" and answer the question then you have to screen capture each of the question & answers and then tie the answers to the above scripts.
Back to top
View user's profile Send private message
Keavon



Joined: 04 Oct 2009
Posts: 22

PostPosted: Tue Oct 06, 2009 10:34 pm    Post subject: Reply with quote

Ya, I first wanted it to run automaticly and i still do, but that was an other question about it manualy
I still dont understand about the screen reading tho, should i do something like:

if
ImageSearch, FoundX, FoundY, 40,40, 300, 300, C:\My Images\question_1.jpg, click 100, 125
else
if
ImageSearch, FoundX, FoundY, 40,40, 300, 300, C:\My Images\question_2.jpg, click 100, 150
else
if
ImageSearch, FoundX, FoundY, 40,40, 300, 300, C:\My Images\question_3.jpg, click 100, 175
else
BlowUpComputer
(^Just Kidding^, Lol)


So is that kind of thing that should be done?
If so, Can someone PLEASE tell me exactly how to do it, the example isnt that easy to understand.

THANKS!
~Keavon
Back to top
View user's profile Send private message
jethrow



Joined: 24 May 2009
Posts: 1907
Location: Iowa, USA

PostPosted: Tue Oct 06, 2009 10:48 pm    Post subject: Reply with quote

documentation wrote:
ErrorLevel is set to 0 if the image was found in the specified region, 1 if it was not found, or 2 if there was a problem that prevented the command from conducting the search (such as failure to open the image file or a badly formatted option).

Code:
ImageSearch, FoundX, FoundY, 40,40, 300, 300, C:\My Images\question_1.jpg, click 100, 125
If Not Errorlevel
   ...do something...


Also, about the output variables (FoundX, FoundY):
documentation wrote:
Either or both of these parameters may be left blank, in which case ErrorLevel ... can be used to determine whether a match was found.

_________________
Very Happy - in case I forgot to smile
Basic Webpage Controls
COM Object Reference
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Keavon



Joined: 04 Oct 2009
Posts: 22

PostPosted: Thu Oct 08, 2009 3:58 am    Post subject: ErrorLevel Reply with quote

so in the example 40, 40 is under the section FoundX and 300, 300 is under FoundY, right?
and:
If Not Errorlevel
should it be like:
If Not Errorlevel 1
???
Back to top
View user's profile Send private message
jethrow



Joined: 24 May 2009
Posts: 1907
Location: Iowa, USA

PostPosted: Thu Oct 08, 2009 4:16 am    Post subject: Reply with quote

Documentation wrote:
ImageSearch, OutputVarX, OutputVarY, X1, Y1, X2, Y2, ImageFile

X1,Y1 ... The X and Y coordinates of the upper left corner of the rectangle to search ...
X2,Y2 ... The X and Y coordinates of the lower right corner of the rectangle to search ...


Keavon wrote:
If Not Errorlevel
should it be like:
If Not Errorlevel 1

Nope. If you wanted to us that syntax, you should do:
Code:
If(Errorlevel <> 1 && Errorlevel <> 2)

; but this is simpler:
If !Errorlevel

Remember, Errorlevel is set to either 1 or 2 if there is an issue.
_________________
Very Happy - in case I forgot to smile
Basic Webpage Controls
COM Object Reference
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Keavon



Joined: 04 Oct 2009
Posts: 22

PostPosted: Thu Oct 08, 2009 11:42 pm    Post subject: Ok... I didnt really understand that... Reply with quote

well... this is the code i have so far...

CoordMode, Pixel
ImageSearch, FoundX, FoundY, 311, 247, 966, 446, C:\Documents and Settings\Keavon\Desktop\MQP\WITNOSFS.gif
If ErrorLevel = 2
MsgBox, An error has occurred and the search could not be completed
Else If ErrorLevel = 1
MsgBox, Icon could not be found on the screen.
Else
click 472, 561


is there anything that i should change? It's problem is that it doesn't sence it, and it pops up saying "Icon could not be found on the screen" (that i programed) and it isn't seeing the image, even thought it's percisly on the right area. Am I doning something rong? thanks!

PS sorry for the typos, i had some really numb ringers when i was typing this, THANKS
Back to top
View user's profile Send private message
Leef_me



Joined: 08 Apr 2009
Posts: 5333
Location: San Diego, California

PostPosted: Fri Oct 09, 2009 8:03 am    Post subject: Reply with quote

Please use [code][/code] tags for your scripts Wink

The code looks good, except I don't like that you left off the ,screen parameter for coordmode.

Here is a snippet of working code. It is for the page with a question and three answers. It will search for the check-box without it checked.

Download the BMP I made and try it out http://www.autohotkey.net/~Leef_me/check_box.bmp


Code:

;http://www.autohotkey.net/~Leef_me/check_box.bmp

#q::

imagesearch, X, Y, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, check_box.bmp
msgbox error=%errorlevel% !%X%!%Y%! ; ! helps me determin if  results are present or missing
sleep, 1000
mousemove, x+25,y+25,10


Report back your results.

Leef_me
Back to top
View user's profile Send private message
Keavon



Joined: 04 Oct 2009
Posts: 22

PostPosted: Fri Oct 09, 2009 11:41 pm    Post subject: Reply with quote

but the thing is, the cords are for the full screen. I cant use , screen if it is for the FULL screen, right?
hmm, could you please tell me the code for this?

Wait... am I using imageserch for the rong thing? is image serch made to find an image and click on it, or is it made to see if an image is persent in a cirten position and if it is do what you say, The cords I have set it in my earlyer example, are for the image of the question, then it is suppose to go and click on the cords I set if that image is present, if it's not, it will see if next image is present, and so an and so forth.

That's what I want it to do, am I using image search for the rong thing though?

Thanks, Keavon
Back to top
View user's profile Send private message
Leef_me



Joined: 08 Apr 2009
Posts: 5333
Location: San Diego, California

PostPosted: Sat Oct 10, 2009 4:07 am    Post subject: Reply with quote

Imagesearch searches for an image, and reports if and where it was found. What you do with that is up to you.

If I had a display with 1024 x 768 resolution but I opened the website with I.E. in less than full screen, then the location of a paticular 'thing' such one of the checkboxes could have a different location depending on whether you use 'screen' or 'relative'. Do you understand this so far?

I just looked at your Tue Oct 06, 2009 post. I'm not sure what part of the webpage or what part of the image you are looking for.

I suggest you don't really care where the the image is, just if exists or not.

Did you try the code and the image I provided? What was the result ?
Back to top
View user's profile Send private message
Keavon



Joined: 04 Oct 2009
Posts: 22

PostPosted: Sat Oct 10, 2009 3:50 pm    Post subject: Reply with quote

Hmmm, the example you gave me had some kind of error.
What i want it to do is it want it to find the question witch for me is top left: 311, 247 and bottom right: 966, 446. What I want it to do is see IF and not WHERE the image is. Since I can tell it where the image is, but I want it to respond if the image is THERE or not, so if it's not there, It can go to the next if, to see if that one is there, if it is, it will click on one of the checks, with the cords i program it. if it's not that image, it will keep going down the stream with the if and else statments.

That what I want it to do, Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group