 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
N00b_autoer Guest
|
Posted: Fri Apr 29, 2005 2:04 pm Post subject: Several questions |
|
|
I was making this script for responding to something if I click on it and it turns a certain color or whatever. I couldn't figure out how to make a mouseclick on the screen if a certain pixel turns a different color, so if anyone could help me there that would be great.
Also, I can't figure out how to make a delay, not setkeydelay or setmousedelay, but just a delay. Like when I click on the pixel or whatever and it turns a different color, I need to wait ten seconds before I can click it again. I also need it to continue clicking unless the pixel changes color (but keep a delay after every two clicks) and it can't be any setsomethingdelay. I thought there was a way to do this, but I just can't seem to figure out how. |
|
| Back to top |
|
 |
Rubberduck
Joined: 24 Apr 2005 Posts: 96
|
Posted: Fri Apr 29, 2005 3:50 pm Post subject: Maybe this helps |
|
|
I made a little script for you:
This script was done quick (Not tested).
| Code: |
;/// Build up a little Gui for the script
gui, color, FFFFFF
gui, add, text, x10 y10,*** Click Test ***
gui, add, button, x10 y30,Clicktest
gui, add, button, x10 y60,Quit Script
gui, show
;//Pause/Resumes the script if you don't want the clicking
Pause::Pause
ButtonClicktest:
loop
{
;//Search on a specified position on screen for a specified color
;//change the values to your values
PixelGetColor, RealColor, 639, 264
if (Realcolor = 0x08144A) ;//YES we found the color at that position
{
MouseMove, 639, 264, 0 ;// Move Mouse where you want to click
MouseClick, left ;//Click it
sleep, 500 ;//Wait. Set Milliseconds to your needs
}
}
return
ButtonQuitScript:
exitapp
|
_________________ Wer keine Antworten hat muss nicht dumm sein,
dumm ist nur der welcher keine Fragen hat. |
|
| Back to top |
|
 |
N00b_autoer Guest
|
Posted: Fri Apr 29, 2005 4:04 pm Post subject: |
|
|
I dont really understand that... this is like my first script. I need it kinda simple, and could you tell me what some of that means? I don't know if that's what I need. heres part of the extremely simple coding script i made, it took like 10 seconds cuz i stopped when I encountered the problem.
^s::
loop
{
Mouseclick, right, , ;///havent figured out coordinates yet
Mouseclick, left, ,
}
;///I only made this much because I couldn't figure out any of the rest |
|
| Back to top |
|
 |
N00b_autoer Guest
|
Posted: Fri Apr 29, 2005 4:16 pm Post subject: Lemme explain better |
|
|
Maybe I need to explain this a little more detailed.
First, I need the script to right click one spot, and then left click another, really fast, and keep on doing that. (i know how to do that part)
But after each series of the right and then left click, I need it to check the screen to see if a certain pixel is this wierd shade of green. (I can do that also)
The part I cant do is make the mouse left click in an area on a different part of the screen if the pixel DOES turn that color, and then have a delay, or sleep, then click back to the place that it was normally clicking.
Also, after the series of all these commands, I need it to wait 10 seconds (I suppose I can just put sleep, 10000) and then loop. (I can do this part also)
Thank you sooo much in advance, this is really helping with my project. Oh yeah, and if you could explain some of the words and commands in your script (gui, button click test, and the pause resume thing) that would help. |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5390 Location: /b/
|
Posted: Fri Apr 29, 2005 4:35 pm Post subject: |
|
|
Hi N00b_autoer,
Here's an example script with commenting which you can work around. You can find documentation for commands on the Documentation page or by looking them up in the AutoHotkey Help file found in the installation directory.
| Code: | SetBatchLines -1 ; For fastest performace
SetMouseDelay -1 ; For fastest mouse movements
#Persistent ; Keeps hotkeys alive
SetTimer, Action, 100 ; Change this speed (ms) to your prefrance
SetTimer, Action ; Turn this off until turned on
Return ; Nothing will be done now until hotkey is triggered
; Sets timer of 'Action' to on if it was off or vice versa
^s::SetTimer, Action
Action:
; First Right click once
MouseClick, Right, [X COORD.], [Y COORD.] ; Put in values here
; Now Left click 10 times
Loop, 10
MouseClick, Left, [X COORD.], [Y COORD.] ; Put in values here
; Get pixel colour of specified area
PixelGetColor, PixelColour, [X COORD.], [Y COORD.] ; Put in values here
If PixelColour = [COLOUR] ; Put in your colour code here
{
; ... do actions for when the colour in specified area matches the one you choose
}
Sleep, 10000 ; 10 seconds = 10000 milliseconds
Return ; End of this routine |
_________________
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|