On Tue, 3 Apr 2007 07:06:31 -0400, "Gardner, Paul G."
<[EMAIL PROTECTED]> wrote:
>
>It depends on what is used to display the text. If you can reference the
>control by an id, then you can using the win plugin to retrieve the text.
>Some times you can get that, and sometimes you can't. For example, the
>below is an older script I used to use to retrieve a value from a text label
>on a dialog box:
>
> CmdBtn = win.childtextbyindex("c=TWARNINGSCREEN",4)
>
>The CmdBtn variable would be filled by the text on the 4th control of the
>active window. See "win plugin" in the Help index for some more
>information.
>
>Below is an older script from Alan Martin ( I believe) that would retrieve
>all the text on a window and display it. The caption list is passed into
>the script. Try it to see if you can retrieve the text you want. If so,
>then you can replace the "4" above with the number associated to the text in
>the file. I have a hot key that calls the script. I pass in the active
>caption to this script. Watch for line breaks.
>
>Local HandleList = Win.HandleList(Arg(1), 1)
>If(Not(HandleList))
> Quit(MessageBox("Warning", "No windows match the given caption list:\n"
>++ Arg(1), "Window Info"))
>Local Output
>For(Local HandleIter = 1; ; HandleIter = HandleIter + 1)
> Local Handle = Word(HandleList, HandleIter)
> If(Not(Handle))
> Break
> ;below is 1 line.
> Output = Output ++ HandleIter ++ ". " ++ Win.Caption(Handle) ++ "
>(Handle " ++ Handle ++ ", Class C=" ++ Win.Class(Handle)
> Output = Output ++ ", Owner =" ++ File.Name(Win.EXEPath(Handle)) ++
>")\r\n"
> For(Local ControlIter = 1; ; ControlIter = ControlIter + 1)
> ;below is 1 line
> Local ControlText =
>ReplaceChars(ReplaceChars(ReplaceChars(Win.ChildTextByIndex(Handle,
>ControlIter), "\r\n", "¶"), "\r", "¶"), "\n", "¶")
> If(ControlText != "")
> Output = Output ++ " " ++ ControlIter ++ ". " ++ ControlText
>++ "\r\n"
> If(_EOF_)
> Break
> EndFor
> Output = Output ++ "\r\n"
>EndFor
>
>File.WriteAll(Env("Temp") ++ "\\Window Info.txt", Output)
>"%Temp%\Window Info.txt"
>
>Paul
>
Hi Paul,
Thanks for that. I have found a second way to do the same thing. I
wrote an AutoIt script to check for the window and to click the No
button. The only thing is that I don't want the script to be running
all the time, only when the window actually pops up. So, I thought of
using PowerPro to detect the window, and then to run the script. The
only problem is that when I put an entry in the HookWindowEvents
group, PowerPro and AutoIt went crazy. I'm pretty sure it was due to
the command I used:
Wait in the Command field, and
until (activewindow("Sygate*")) in the Command Parameters field.
Anyway, the AutoIt script began opening tens of different instances of
it, and PowerPro crashed (couldn't handle the load I guess)
I then tried:
Wait in the Command field, and
for (activewindow("Sygate*")) in the Command Parameters field.
Exact same thing. What would be the correct command to use within
PowerPro to wait for a window titled "Sygate Personal Firewall Pro"?
The script I wrote will actually check the text of the window, so if
it isn't exactly what I want, the script will do nothing and exit. I
just need to work out how to get PowerPro to run it when that window
pops up.
--
Regards,
CM