AutoHotkey Community

It is currently May 26th, 2012, 11:28 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 68 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
PostPosted: November 18th, 2009, 12:17 pm 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
hey ahk community.

Ok so i have a code that creates a gui transparent window...

it is quite small, and i was wondering how could i use pixel search in corprated with this script, the easist way to explain is with an example.

eg.
i have a small window centerd in the screen, if a selectred color becomes visible underneath this window then send the control "leftclick"

here is my current script

Code:
bDim = 35 ; Change this to desired size.
xPos = % (A_ScreenWidth/2) - bDim
yPos = % (A_ScreenHeight/2) - bDim

Gui, -Caption Border AlwaysOnTop ToolWindow
Gui, Color, C0C0C0
Gui, Show, NA W%bDim% H%bDim% X%xPos% Y%yPos%, hitBox

WinWait, hitBox
WinSet, TransColor, C0C0C0 255, hitBox



if anyone has any pointers or genral links on what i need to learn i would be most greatfull=)

~cyber

_________________
---{+.-}---


Last edited by Cyber on November 19th, 2009, 4:07 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 18th, 2009, 4:56 pm 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
PLease can somone answer my qestion?

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 18th, 2009, 6:50 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Possibly something like this:
Code:
bDim = 35 ; Change this to desired size.
xPos = % (A_ScreenWidth/2) - bDim
yPos = % (A_ScreenHeight/2) - bDim

Loop
{
   PixelSearch,x,y,% xPos,% yPos,% xPos + (bDim*2),% yPos + (bDim*2),C0C0C0,0,RGB
   If !ErrorLevel
      Click
}

Esc::ExitApp

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2009, 3:46 am 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
ok, so far iv go this.

Code:
bDim = 35 ; Change this to desired size.
xPos = % (A_ScreenWidth/2) - bDim
yPos = % (A_ScreenHeight/2) - bDim

Gui, -Caption Border AlwaysOnTop ToolWindow
Gui, Color, C0C0C0
Gui, Show, NA W%bDim% H%bDim% X%xPos% Y%yPos%, hitBox

WinWait, hitBox
WinSet, TransColor, C0C0C0 255, hitBox

Loop
{
   PixelSearch,x,y,% xPos,% yPos,% xPos + (bDim*2),% yPos + (bDim*2),0x31FCFD,10,RGB
   If !ErrorLevel
      Click
}

^z::ExitApp


i have a brief understanding of what it does, i can read better then i can write it =s

anyway, stilltherer is a problem,
1: it isnt always ontop- eg, when i play a fullscreen game.
2: it doesnt left click the desired color in the box.

any ideas anyone?

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2009, 5:43 am 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
anyone?
i would realy like somehelp with the script=S

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2009, 6:28 am 
Offline

Joined: March 6th, 2008, 11:54 pm
Posts: 167
try this for the AlwaysOnTop problem

Code:
bDim = 35 ; Change this to desired size.
xPos = % (A_ScreenWidth/2) - bDim
yPos = % (A_ScreenHeight/2) - bDim
Gui, +alwaysontop
Gui, -Caption Border AlwaysOnTop ToolWindow
Gui, Color, C0C0C0
Gui, Show, NA W%bDim% H%bDim% X%xPos% Y%yPos%, hitBox

WinWait, hitBox
WinSet, TransColor, C0C0C0 255, hitBox

Loop
{
   PixelSearch,x,y,% xPos,% yPos,% xPos + (bDim*2),% yPos + (bDim*2),0x31FCFD,10,RGB
   If !ErrorLevel
      Click
}

^z::ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2009, 2:21 pm 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
still doesnt stay on top.
=s

and still doesnt click the dseired color.

prety much all i have done is made a square in the middle of the screen that doesnt do anything , accept disapear when its suposed to be there =s

great XD

anyone else?
would really aprciate help

once agin these are my problems

1: it isnt always ontop- eg, when i play a fullscreen game.
2: it doesnt left click the desired color in the box.
3:and a new problem is when the script is loading it slows down my computer a fair bit, but thats just a minor problem to be fixed later on

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2009, 3:28 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Cyber wrote:
1: it isnt always ontop- eg, when i play a fullscreen game.
2: it doesnt left click the desired color in the box.
3:and a new problem is when the script is loading it slows down my computer a fair bit, but thats just a minor problem to be fixed later on


As far as I know, in a fullscreen game it might not click as it uses direct input:
1. not possible
2. still do not understand what you want to do
3. must be due to PixelSearch, you could put a Sleep before starting search.

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2009, 3:59 pm 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
well in regards to question number 2.

i am trying to make a small centred box that is always on top and in the midle of the screen. if "green" becoms behind the box then send the command left click.
and example.
say your playing a game.. and you have a crosshair, make the square box the same size as the crosshair, now if a npc or character runs infront of the cross hair and it green then send the command leftclick.

does that make sense.

can someone please give me a hand with making this possible.

thanks
~cyber

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2009, 6:00 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Cyber wrote:
does that make sense.


The box does not make any sense :?

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 4:07 am 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
iv tryed to explain it as best as i can.
here si the script, run it and you wil se the box.

[/code]

bDim = 35 ; Change this to desired size.
xPos = % (A_ScreenWidth/2) - bDim
yPos = % (A_ScreenHeight/2) - bDim
Gui, +alwaysontop
Gui, -Caption Border AlwaysOnTop ToolWindow
Gui, Color, C0C0C0
Gui, Show, NA W%bDim% H%bDim% X%xPos% Y%yPos%, hitBox

WinWait, hitBox
WinSet, TransColor, C0C0C0 255, hitBox

Loop
{
PixelSearch,x,y,% xPos,% yPos,% xPos + (bDim*2),% yPos + (bDim*2),0x31FCFD,10,RGB
If !ErrorLevel
Click
}

^z::ExitApp
[/code]

As you will see the pixel search wont work within it.
and if you play aroudn with it yo will also notice it wont alwyas be ontop=s

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 8:16 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
So you need the window to exclude this area from PixelSearch?

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 2:22 pm 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
no the oposite.

only inside this window i whant a pixel search.
so it searches the color green.. only inside the window.

thanks

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 3:33 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
This again makes no sense.

Why do you want to search in window?

In Pixelsearch you can specify the area where to search (X1, Y1, X2, Y2) :?:

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2009, 4:18 pm 
Offline

Joined: October 25th, 2009, 6:10 pm
Posts: 17
I'm a n00b, so take this with salt.

From manual: The region to be searched must be visible; in other words, it is not possible to search a region of a window hidden behind another window.

Is this the problem?


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Cerberus, Leef_me, Maestr0, Pulover, rbrtryn, Yahoo [Bot] and 68 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