PowerPaste for sequential pasting

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
mikeyww
Posts: 27169
Joined: 09 Sep 2014, 18:38

PowerPaste for sequential pasting

04 Apr 2019, 11:13

This AutoHotkey script will sequentially paste lines from a text file when F12 is pressed. The script will then delete the text file and exit.

Code: Select all

file = %1% ; Get the command-line parameter, which is the file to read.
If (file = "") ; Check for a missing parameter.
{
 MsgBox File was not specified.
 ExitApp
}
If !FileExist(file) ; See if the file exists.
{
 MsgBox File '%file%' was not found.
 ExitApp
}
txt := FileOpen(file, "r") ; Open the text file for reading.
if !IsObject(txt)
{
 MsgBox Can't open '%file%' for reading.
 ExitApp
}
F12:: ; Read and paste the next line.
line := txt.ReadLine() ; Read the next line from the text file.
If (line > "") ; See if a line was found.
{
 Clipboard := line ; Copy the line to the Windows clipboard.
 Sleep, 50
 Send ^v ; Paste the line into the active window.
}
Else ; The line is null or did not exist (i.e., end of file).
{
 MsgBox, Done.
 txt.Close() ; Close the file.
 FileRecycle, %file% ; Delete the file.
 If (ErrorLevel = 1)
  MsgBox, '%file%' could not be deleted.
 ExitApp
}
Return
micasa
Posts: 24
Joined: 29 Dec 2018, 04:21

Re: PowerPaste for sequential pasting

04 Apr 2019, 21:13

Thanks for this. How are you using it?

I think it could be useful with a file full of links. However, I probably wouldn't delete the file afterwards.

I had always used FileDelete. Never heard of FileRecycle before, but I will be using it now that I know!
User avatar
mikeyww
Posts: 27169
Joined: 09 Sep 2014, 18:38

Re: PowerPaste for sequential pasting

05 Apr 2019, 06:27

Yes, would be good for pasting URLs. You can delete the FileRecycle line as needed, of course. I use this script to paste information into online forms that will accept only one line at a time.
carno
Posts: 265
Joined: 20 Jun 2014, 16:48

Re: PowerPaste for sequential pasting

07 May 2019, 23:15

Good, niche script that could come handy sometimes. :D

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: Google [Bot], kczx3, silverrs8, Skrell, zhang and 46 guests