Reputation: 135
I am attempting to loop through the list in VarX and send the keystrokes requested until the list is done. Right now it seems to jumble up and not run the commands correctly in order. any ideas of what I have wrong? it should run like this:
ctrl f
48306237
enter
tab tab tab tab enter
shift space
ctrl -
then repeat with the next number...
^!G::
VarX=
(
48306237
48306642
48303423
48303612
48303797
)
loop, parse, VarX, `n,`r
{
Send, ^f
Send, %VarX%
Send, {enter}
Send, {tab}{tab}{tab}{tab}{enter}
Send, +{space}
Send, ^-
return
}
return
Upvotes: 0
Views: 1101
Reputation: 1015
ControlGetText
/ControlSetText
/AccViewer (MSAA: Microsoft Active Accessibility)/COM (Component Object Model).Send
, as the method of last resort, I often put a lot of sleeps in, and/or use SetKeyDelay
to increase pauses between keypresses. Also I would watch the first 10 or 20 iterations to make sure that the keypresses function correctly.IfWinActive
to stop the script if the original window is no longer active, otherwise if a random window pops up it will receive the keypresses.Send {Raw}%VarX%
to send the text as a precaution,
in case of characters such as +^#!{} that are treated specially by Send
.Return
inside the loop, which would only allow one iteration to take place, you probably did this temporarily for diagnostic reasons, but I should point that out to others.Upvotes: 0
Reputation: 7953
First thing, don't you want to "do something" with the result? e.g. wait to see if it found something, and then continue after you e.g. pressed a key?
Also If you want to see if a string is inside your text, why not use:
If YourTextVariable contains %YourStringNumber%
MsgBox, Found %YourStringNumber% in the text
If you need to use the internal "find" function, then I would suggest to use the AHK Spy to find the edit object ID and the [Find] button ID and use ControlSend to send the search criteria and ControlSend to "press the" [Find] button.
Upvotes: 1