AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: June 16th, 2005, 4:51 pm 
Offline

Joined: June 9th, 2005, 4:20 pm
Posts: 21
I am writing a script to automate entry of search strings in the fields
in a typical Search & Replace window in an editor ..

e.g.

Find What: [ ]
Replace With: [ ]

I can deal with the above text fields by clearing field before entering fresh data.

But the radio buttons are trickier.

e.g.
[ ] Case sensitive
[ ] Whole word only
[ ] Regular expression

I can use Alt+C, Alt+W, Alt+X etc. to go to each button position ..

but how to measure their status - ticked or not ticked - so that they can be set to required option? They do not revert to default blank, but retain values of previous search pattern.

I can only see Color change at "Now Under Mouse Cursor" to perhaps test.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2005, 5:52 pm 
The same beaviour as with MS-WORD ---> \Tools\Options\View Checkboxes? A single Control but it seems not possible to capture the status of one of those multiple CheckBox Control. Correct?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2005, 6:20 pm 
Offline

Joined: June 9th, 2005, 4:20 pm
Posts: 21
Correct .. identical problem there ...

e.g. toggle radio button "Startup Task Pane"

how to detect if there is a tick or no tick in box?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2005, 6:26 pm 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2250
Location: switzerland
(maybe I understand you wrong )
saves the last input
Code:
Gui, Show, x270 y110 h150 w180, tEST12            ;WINDOW
Gui, Font,  S10 CDefault Bold, Verdana          ;TITLE
Gui, Add, Text, x80 y10 w140 h20, EXAMPLE-1
Loop, read, TEST12.txt
{
  Loop, parse, A_LoopReadLine, CSV
  {
    if a_index = 1
      C5 = %a_loopfield%
  }
}
Gui, Font,  S10 CDefault Bold, Verdana
Gui, Add, Radio,x10 y50 vC5,Case sensitive
Gui, Add, Radio,x10 y70 ,   Whole word only
Gui, Add, Radio,x10 y90 ,   Regular expression
Gui, Font,  S8 CDefault Bold, Verdana
Gui, Add, Button, x10 y120 w70 h20, CLEAR
Gui, Add, Button, x90 y120 w70 h20, OK
;------------------------------------------
if C5 = 1
  Control, check,,Case sensitive,tEST12
else
  Control, Uncheck,,Case sensitive,tEST12

if C5 = 2
  Control, Check,,Whole word only,tEST12
else
  Control, Uncheck,,Whole word only,tEST12

if C5 = 3
  Control, check,,Regular expression, tEST12
else
  Control, Uncheck,,Regular expression, tEST12

Return

ButtonClear:
FILEDELETE TEST12.TXT
reload
return

ButtonOK:
GuiClose:
GuiEscape:
Gui, submit,nohide

FILEDELETE TEST12.TXT
ifNotExist,TEST12.TXT
FILEAPPEND,%C5%, TEST12.TXT
ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 16th, 2005, 6:50 pm 
Offline

Joined: June 9th, 2005, 4:20 pm
Posts: 21
Thanks .. but I am not trying to replace the existing GUI window

Quote:
.. saves the last input ..


the question is .. what is the original input at start, since only toggle can apply?

Perhaps they are in registry?

..

Here is a simpler example .. in IE browser go to Edit > Find

With Window Spy running ..

how to detect status of buttons ..

Match whole word only
Match case
Up
Down


Report this post
Top
 Profile  
Reply with quote  
PostPosted: June 16th, 2005, 7:56 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
dragonfly wrote:
but how to measure their status - ticked or not ticked
I might be misunderstanding what you want, but I think it can be achieved via "ControlGet, OutputVar, Checked"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2005, 8:28 am 
Quote:
I might be misunderstanding what you want, but I think it can be achieved via "ControlGet, OutputVar, Checked"
No, I think your correct. But as said in my example above (using Winword as it should be available on most of your desktops) it looks like not each RadioButton/CheckBox can be detected separately.

That seems to be the issue. :roll:


Report this post
Top
  
Reply with quote  
 Post subject: ControlGet
PostPosted: June 17th, 2005, 4:54 pm 
Offline

Joined: June 9th, 2005, 4:20 pm
Posts: 21
Chris:-

I was able to capture control status in EditPlus Replace window using this script:-

Code:
SetTitleMatchMode, 2  ; partial match
WinActivate, EditPlus

; open replace window
Send, ^h


; &Case sensitive
ControlGet, OutputVar08, Checked, , Button8, Replace

; &Whole word only
ControlGet, OutputVar09, Checked, , Button9, Replace

; Regular e&xpression
ControlGet, OutputVar10, Checked, , Button10, Replace

; &Up
ControlGet, OutputVar12, Checked, , Button12, Replace

; &Down
ControlGet, OutputVar13, Checked, ,  Button13, Replace

; Wra&p at the end of file
ControlGet, OutputVar14, Checked, , Button14, Replace

; Curre&nt file
ControlGet, OutputVar16, Checked, , Button16, Replace

; &Selection
ControlGet, OutputVar17, Checked, , Button17, Replace

; All &open files
ControlGet, OutputVar18, Checked, , Button18, Replace


MsgBox,
(LTrim

OutputVar08 = %OutputVar08%
OutputVar09 = %OutputVar09%
OutputVar10 = %OutputVar10%
OutputVar12 = %OutputVar12%
OutputVar13 = %OutputVar13%
OutputVar14 = %OutputVar14%
OutputVar16 = %OutputVar16%
OutputVar17 = %OutputVar17%
OutputVar18 = %OutputVar18%

)
; Exit application
Exit



_______________________________________

BoBo:-

You are correct. It seems that ControlGet will not work in MS-Word similar problem .. Tools > Options window

.. because all the MS-Word radiobuttons have the same value
ClassNN: bosa_sdm_Microsoft Word 10.01

So how can ControlGet target controls in that MS-Word scenario?

...

Meanwhile, I can now target EditPlus Replace window controls using ControlGet.

Thanks.

_________________________

p.s. .. I also tried this useful script which, when cursor hovers over control, displays HWND.

http://www.autohotkey.com/forum/viewtopic.php?t=3563

In MS-Word all displays of controls in Replace window are identical.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: chaosad, Exabot [Bot], Google Feedfetcher, jrav and 19 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