Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
269 views
in Technique[技术] by (71.8m points)

autohotkey loop through txt and send each line

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...