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 

check checkbox if unchecked on mousehover

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
eagle00789



Joined: 27 Nov 2006
Posts: 52
Location: Heerlen Country: Netherlands

PostPosted: Wed Jun 18, 2008 1:11 am    Post subject: check checkbox if unchecked on mousehover Reply with quote

I need te check a checkbox in a window (printer settings window), but the only thing i know is it's location. it is possible by getting the location of the checkbox, to get it's name and by the name get it's state and if it is checked, just close the window, or if unchecked, check it and close the window.
so basicly i want to make sure it is checked before my program runs. (it needs double sided printing enabled on many different types and makes of printers, as it controls around 24 printers at the same time)
_________________
Before asking a question try to read the manual
Always use the code sections when you paste some code
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1128

PostPosted: Wed Jun 18, 2008 2:55 am    Post subject: Reply with quote

Code:
MouseMove, %LocationX%, %LocationY%, 0 ; move the mouse over the control
MouseGetPos, , , , cHWND, 2 ; grab the control's handle
Loop 2 ; check it twice
{
   ControlGet, Checked, Checked, , , Ahk_ID %cHWND% ; get the state of the checkbox
   If (Checked) ; is it checked ?
      Break ; then leave the loop
   Else ; not checked ?
      Click ; click where the mouse is (right over the checkbox)
   Sleep 50 ; give the window time to update the control
}
Send {enter} ; close the window
; etc...
untested. You'll have to tweak it.
_________________
My Home Thread
More Common Answers: 1. It's in the FAQ 2. Ternary ( ? : ) guide 3. Post code with [code][/code] tags
Back to top
View user's profile Send private message
eagle00789



Joined: 27 Nov 2006
Posts: 52
Location: Heerlen Country: Netherlands

PostPosted: Wed Jun 18, 2008 5:55 pm    Post subject: Reply with quote

No tweaking needed. it does the job perfectly. thx mate
_________________
Before asking a question try to read the manual
Always use the code sections when you paste some code
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
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