AutoHotkey Community

It is currently May 26th, 2012, 8:10 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: June 18th, 2008, 1:11 am 
Offline

Joined: November 27th, 2006, 1:44 pm
Posts: 61
Location: Heerlen Country: Netherlands
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2008, 2:55 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3328
Location: Simi Valley, CA
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.

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2008, 5:55 pm 
Offline

Joined: November 27th, 2006, 1:44 pm
Posts: 61
Location: Heerlen Country: Netherlands
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


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Google Feedfetcher, poserpro, sjc1000, Tilter_of_Windmills and 52 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