Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Copy Lines and Paste One line at a time

  • Please log in to reply
2 replies to this topic
  • Members
  • 1 posts
  • Last active: Feb 24 2014 07:45 PM
  • Joined: 24 Feb 2014

Hey Guys,


I am new just downloaded the program and thought I would ask if there is a script already made to do the following:


Copy data from Excel sheet - Like 48 lines of serial numbers.

Then Paste the Data into a field.


The paste has to go like this: Paste Line 1, Enter, Delay, Paste Line 2, Enter, Delay… and so on.


If you can help or guide me the right way, that would be awesome!


Thank you


  • Members
  • 270 posts
  • Last active: Apr 10 2015 05:10 PM
  • Joined: 23 Sep 2012
Loop, parse, clipboard , `r%A_Tab%
send, %A_LoopField%
sleep, 1000

This might be a start. Copy the data into clipboard. Open a notepad file(for testing) and press F1.

  • Members
  • 1652 posts
  • Last active:
  • Joined: 04 Mar 2013

 ; This will get a range of cells from Excel
; If Excel is open it will use that instance of Excel
; Otherwise it opens the excel workbook with the path stored in "MyFilePath"

MyFilePath := A_Desktop "\New Microsoft Excel Worksheet.xlsx"

Try oExcel := ComObjActive("Excel.Application") ; Get the active Excel application object if an instance of Excel is open.
if (!oExcel)    ; If there was no instance of excel open...
    oExcel := ComObjCreate("Excel.Application") ; Create an Excel Application object
    oWorkBook := oExcel.Workbooks.Open(MyFilePath) ; Open a workbook with the file path in the variable "MyFilePath"
oExcel.Visible := true    ; Make excel visible (Optional)

MyCells := oExcel.Range("A3:A40")    ; Get a range of cells A3:A40


; Now that we have stored the range of cells, we can loop through them with a for-loop
^p::    ; Ctrl+P Hotkey
for key, in MyCells
    Send, % key.Value "{Enter}"
    Sleep, 500

; This will optionally quit Excel:
; oExcel.Quit
; oExcel := ""



For more info on COM for Excel see Basic Ahk_L COM Tutorial for Excel and the COM object reference.