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
Extracting data from Multiple line clipboard
Re: Extracting data from Multiple line clipboard
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
-
- Posts: 31
- Joined: 21 Jan 2020, 22:01
Re: Extracting data from Multiple line clipboard
Loop, Parse, clipboard, 'n,
Re: Extracting data from Multiple line clipboard
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.
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.
Re: Extracting data from Multiple line clipboard
The function is SubStr(), not Mid(). You don’t need % signs around a variable in a parameter of a function call.aircooled wrote: ↑25 Jan 2020, 06:15FileAppend, %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.
Who is online
Users browsing this forum: doodles333 and 318 guests