AutoHotkey Community

It is currently May 27th, 2012, 12:04 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: October 4th, 2009, 10:33 pm 
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!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2009, 11:08 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
keavon2 wrote:
P.S. Please try to answer it quickly ...
:lol:

You may want to try ImageSearch.

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thanks jethrow.
PostPosted: October 5th, 2009, 12:19 am 
Offline

Joined: October 4th, 2009, 10:20 pm
Posts: 22
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2009, 3:37 am 
Online

Joined: March 10th, 2008, 12:55 am
Posts: 1907
Location: Minnesota, USA
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.
"I think Bigfoot is blurry, that's the problem. It's not the photographer's fault, Bigfoot is blurry. So there's a large, out-of-focus monster roaming the countryside."


Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 6th, 2009, 12:56 am 
Offline

Joined: October 4th, 2009, 10:20 pm
Posts: 22
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 6th, 2009, 6:08 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6068
Location: San Diego, California
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 6th, 2009, 11:34 pm 
Offline

Joined: October 4th, 2009, 10:20 pm
Posts: 22
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 6th, 2009, 11:48 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
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.

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject: ErrorLevel
PostPosted: October 8th, 2009, 4:58 am 
Offline

Joined: October 4th, 2009, 10:20 pm
Posts: 22
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
???


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 8th, 2009, 5:16 am 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
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.

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 9th, 2009, 12:42 am 
Offline

Joined: October 4th, 2009, 10:20 pm
Posts: 22
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 9th, 2009, 9:03 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6068
Location: San Diego, California
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 10th, 2009, 12:41 am 
Offline

Joined: October 4th, 2009, 10:20 pm
Posts: 22
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 10th, 2009, 5:07 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6068
Location: San Diego, California
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 ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 10th, 2009, 4:50 pm 
Offline

Joined: October 4th, 2009, 10:20 pm
Posts: 22
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!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Leef_me, Pulover, XstatyK, Yahoo [Bot] and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group