Jump to content

Copying and pasting line from notepad

Recommended Posts

This is the script for copying and pasting a random line from a notepad

$notepad10 = WinGetText("qpwords.txt - Notepad")

$lines10 = StringSplit($notepad10,@crlf,1)

$randomline10 = Random(1, $lines10[0], 1)



I dont wish anymore to take a random line, i want to take the line in order each time the script restart. Lets say I want to copy/paste line 1 the first time, then when the script restart, copy/paste the second line and so on. What would be the function to use?

Thank you

Edited by anyways
Link to comment
Share on other sites

i did a little modification. This will copy the next line form notepad every time you press Home. it's easier than trying to save the current line between script restarts. Also, i used fileread instead of WinGetText. You don't need to have notepad open!


Global $Line=1

While 1

Func NextLine()
$Path = "qpwords.txt" ;if not in scriptdir, use full file path
$File = FileOpen($Path,0)
$Current = FileReadLine($File,$Line)
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

  • Recently Browsing   0 members

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