Jump to content
Sign in to follow this  
shadowsin

text loop

Recommended Posts

shadowsin

okay I have a small problem I can't figure out on my own. I have a list of keywords or phrases and lets say I want to make a loop so that I open notepad and put the first keyword from the list and then loop it so that it opens notepad and puts the second keyword from the list and so forth. Any ideas would be great thanks in advance

Share this post


Link to post
Share on other sites
shadowsin

Maybe...

$String = "look now brown cow"

$split = StringSplit($String, " ")

For $x = 1 To $split[0]
    Run("notepad.exe")
    WinWaitActive("")
    Send($split[$x])
    Sleep(2000)
Next

8)

thanks for the fast reply however that's not quite it I want the macro to grab the keywords from an external notepad file, so going off your script it'll go:

Open notepad

Send first keyword from "keywords.txt"

Open same notepad

send second keyword from "keywords.txt"

and then just make it loop that

my only problem that I can't figure out is how to grab the keyword from the external .txt file and how to make it grab the second and third and fourth, etc.

Share this post


Link to post
Share on other sites
shadowsin

#Include <File.au3>

Dim $aRecords

If Not _FileReadToArray("keyword.txt",$aRecords) Then
   MsgBox(4096,"Error", " Error reading file:" & @error)
   Exit
EndIf

Run("notepad.exe")
WinWaitActive("")

For $x = 1 To $aRecords[0]
    Send($aRecords[$x] & @CR)
Next
that worked great just tested it however how can I make it so that it does the tasks before it and then grabs the second keyword rather then placing them all at once? thanks again! Edited by shadowsin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.