AutoHotkey Community

It is currently May 27th, 2012, 12:56 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: September 13th, 2011, 7:52 am 
Code:
#IfWinActive ahk_class #32770 
msgbox,kkkkk
PixelGetColor, color,791,328
if %color%=0xe8e8e8
click 791,328
ControlClick,Button2


Report this post
Top
  
Reply with quote  
PostPosted: September 13th, 2011, 8:13 am 
#Persistent
IfWinActive, ahk_class #32770
{
msgbox,kkkkk
return
}
Changed to this ,cannot run,too.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2011, 9:48 am 
Offline

Joined: March 23rd, 2005, 7:53 am
Posts: 321
Location: Germany
Code:
#IfWinActive ahk_class #32770
msgbox,kkkkk
PixelGetColor, color,791,328
if %color%=0xe8e8e8
click 791,328
ControlClick,Button2

#IfWinActive is used to define window specific hotkeys. But you have not defined any hotkey in your code at all!
Try this:
Code:
#IfWinActive ahk_class #32770
#x::    'Hotkey Windows key + x
msgbox,kkkkk
PixelGetColor, color,791,328
if %color%=0xe8e8e8
{
click 791,328
ControlClick,Button2
}
return
#IfWinActive


_________________
Hasso

Programmers don't die, they GOSUB without RETURN


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 13th, 2011, 9:58 am 
Offline

Joined: July 10th, 2008, 8:49 am
Posts: 1865
Location: Brussels, Belgium
Or you can use the opposite :

Code:
#x::
IfWinActive MyWindow
    Msgbox MyWindow is active
IfWinActive MyOtherWindow
    Msgbox MyOtherWindow is active
Return


@Hasso
Note you can use #IfWinActive if he use a previous hotkey to run this script, so the #IfWinActive directive will be execute anyway.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: thank you all!
PostPosted: September 14th, 2011, 2:37 am 
I'd like to let the code the CLOSE the certain window or click the ok button on the certain window when the POP-window apppears.I needn't any hotkey.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2011, 2:57 am 
Offline

Joined: March 19th, 2009, 5:08 pm
Posts: 548
Location: Texas, USA
So then you need something more like this:

Code:
IfWinActive, ahk_class #32770
{
msgbox,kkkkk
PixelGetColor, color,791,328
if %color%=0xe8e8e8
click 791,328
ControlClick,Button2
}

_________________
Aren't you glad that I didn't put an annoying gif here?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2011, 4:21 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
don't forget to make it run periodically, try SetTimer, or any of the looping functions found in mt home thread (link in my sig)

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2011, 4:22 am 
camerb wrote:
So then you need something more like this:

Code:
IfWinActive, ahk_class #32770
{
msgbox,kkkkk
PixelGetColor, color,791,328
if %color%=0xe8e8e8
click 791,328
ControlClick,Button2
}

But how to let it run all the time?
I run it ,it had not find the window,then the code finished.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2011, 4:44 am 
engunneer wrote:
don't forget to make it run periodically, try SetTimer, or any of the looping functions found in mt home thread (link in my sig)

Thank you,I'll try.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 14th, 2011, 11:37 am 
Offline

Joined: July 10th, 2008, 8:49 am
Posts: 1865
Location: Brussels, Belgium
An other example :

Code:
SetTimer AutoWindow, 1000

AutoWindow:
IfWinActive Window1
WinClose
IfWinActive Window2
Send {Return}
IfWinActive Window3
Msgbox Window 3 is Active
Return


This script doesn't use any hotkey and do the actions by itself.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, chaosad, Google Feedfetcher, MSN [Bot], Yahoo [Bot] and 22 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