Jump to content

Using CTRL+V to past a string and then trigger a new line to be added to clipboard


Recommended Posts

I have a text file that I am using as an array and I want to be able to paste the first line from the file using CTRL+V and then have it send the Ctrl+v command to windows. I don't seem to be able to interact with my array correctly after generating it. Here is what I have so far:

Global $aArray
Global $sTxtFile = ".file.txt"

If Not _FileReadToArray($sTxtFile, $aArray) Then
    MsgBox(4096, "Error", "Error reading file to Array   error:" & @error)
    Exit
EndIf

HotKeySet("{ESC}", "Terminate")
Func Terminate()
Exit 0
EndFunc

HotKeySet("{^v}", "Paste")
Func Paste()
For $iLine = 1 To $aArray[0]
  ClipPut($aArray[$iLine])
  Send("^v")
Next
EndFunc

Any Ideas?

Edited by demonachize
Link to comment
Share on other sites

Global $aArray
Global $sTxtFile = ".file.txt"

If Not _FileReadToArray($sTxtFile, $aArray) Then
    MsgBox(4096, "Error", "Error reading file to Array   error:" & @error)
    Exit
EndIf

HotKeySet("{ESC}", "Terminate")
Func Terminate()
Exit 0
EndFunc

HotKeySet("{^v}", "Paste")
Func Paste()
For $iLine = 1 To $aArray[0]
  ClipPut($aArray[$iLine])
  HotKeySet("^v", "")
  Send("^v")
  HotKeySet("^v", "Paste")
Next
EndFunc

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I think that I had the cycling right. I am having trouble with the putting into the clipboard from the array maybe. When I run the script, I can paste and the like but the clipboard content is just whatever was there already.

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...