Jump to content

text loop


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

#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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...