Extracting data from Multiple line clipboard

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jmcall10
Posts: 31
Joined: 25 Jan 2016, 21:27

Extracting data from Multiple line clipboard

24 Jan 2020, 15:10

Hi all,

I have data in the clipboard that is multi lined.

I am looking to extract only certain information from this.

For example get the data on line1 and 12 characters in and save that as a variable and then perhaps something from line 2 etc etc.

Is it possible to do this?

Regards,

jmcall10
User avatar
boiler
Posts: 16932
Joined: 21 Dec 2014, 02:44

Re: Extracting data from Multiple line clipboard

24 Jan 2020, 16:53

Without any more specifics provided, this grabs the rest of the line starting with the 12th character of the second line. You can have it operate on the Clipboard variable instead.

Code: Select all

Text =
(
First line
12345678901This is the data I want
Third line
)

RegExMatch(Text, "^.*?\v.{11}\K.*?\v", Data)
MsgBox, % Data
aircooled
Posts: 80
Joined: 01 Dec 2018, 08:51

Re: Extracting data from Multiple line clipboard

25 Jan 2020, 06:15

FileAppend, %Clipboard%, %My_Temp_File%
FileReadLine, LINE1, %My_Temp_File%, 1
FileReadLine, LINE2, %My_Temp_File%, 2
LINE2 := Mid(%LINE2%,2,4)
FileReadLine, LINE12, %My_Temp_File%, 12
FileDelete, %My_Temp_File%

FileAppend creates My_Temp_File if it is not already created.
Not sure if you need %. Probably not.
User avatar
boiler
Posts: 16932
Joined: 21 Dec 2014, 02:44

Re: Extracting data from Multiple line clipboard

25 Jan 2020, 06:44

aircooled wrote:
25 Jan 2020, 06:15
FileAppend, %Clipboard%, %My_Temp_File%
FileReadLine, LINE1, %My_Temp_File%, 1
FileReadLine, LINE2, %My_Temp_File%, 2
LINE2 := Mid(%LINE2%,2,4)
FileReadLine, LINE12, %My_Temp_File%, 12
FileDelete, %My_Temp_File%

FileAppend creates My_Temp_File if it is not already created.
Not sure if you need %. Probably not.
The function is SubStr(), not Mid(). You don’t need % signs around a variable in a parameter of a function call.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333 and 318 guests