Read text after line in clipboard Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
xmachinery
Posts: 15
Joined: 14 May 2016, 21:25

Read text after line in clipboard

16 Jan 2018, 05:42

Hello,

How can I save a text in clipboard after a line?

For example, I have clipboard contents which looks like this:

Code: Select all

line 1 Text 1
line 2 Text 2
line 3 Text 3
line 4 Full Name+
line 5 Jon Snow
line 6 Text 6
line 7 Text 7
etc.
Basically, I want to read the clipboard contents and then get the name after "Full Name+" (Jon Snow in this case) to be assigned to a variable. How can I do that? The line in which the name that I want to get is random, so A_Index will not work in this case.

Thank you!
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: Read text after line in clipboard  Topic is solved

16 Jan 2018, 06:13

Code: Select all

data=
(
line 1 Text 1
line 2 Text 2
line 3 Text 3
line 4 Full Name+
line 5 Jon Snow
line 6 Text 6
line 7 Text 7
etc.
)

clipboard:=data

;----------end creating clipboard demo-------------------

needle:="Name+"
status:=0
loop,parse,clipboard,`n,`r
{
  
  if status
    {
    msgbox %A_LoopField%
    break
    }

  else if instr(A_LoopField,needle)
  status:=1
}
xmachinery
Posts: 15
Joined: 14 May 2016, 21:25

Re: Read text after line in clipboard

16 Jan 2018, 07:28

noname wrote:

Code: Select all

data=
(
line 1 Text 1
line 2 Text 2
line 3 Text 3
line 4 Full Name+
line 5 Jon Snow
line 6 Text 6
line 7 Text 7
etc.
)

clipboard:=data

;----------end creating clipboard demo-------------------

needle:="Name+"
status:=0
loop,parse,clipboard,`n,`r
{
  
  if status
    {
    msgbox %A_LoopField%
    break
    }

  else if instr(A_LoopField,needle)
  status:=1
}
This works wonderfully! Thank you!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 174 guests