Jump to content
Macro Express Forums

Need A Whole Line From .txt File


Lon

Recommended Posts

Using ME I have notepad open with a large text file. I am using the "find" command in Notepad to locate the specific phrase "Closing case" Everything good to here.

 

What I need to be able to do is to capture the whole text line (has dates, path, etc) "closing case" resides on and save it to a variable.

 

What I am having a problem with is the actual selection of the whole line of text. I don't know of any commands to get the whole line "blued" to copy it. I don't know of any shortcut keys to get the whole line.

 

Any ideas?

Link to comment
Share on other sites

To highlight a line in Notepad you need to do a Shift Down, Arrow Down, Shift Up. Depending on where 'closing case' appears on the line you may need to do a Home first. Once the line is highlighted you can copy it to the clipboard and then copy from the clipboard to a variable.

 

Something like this:

Text Type: <HOME><SHIFTD><ARROW DOWN><SHIFTU>
Text Type: <CONTROL>c
Variable Set String %T1% from Clipboard

You may discover that you need some slight delays:

Text Type: <HOME><SHIFTD><ARROW DOWN><SHIFTU>
Delay 0.1 Seconds
Text Type: <CONTROL>c
Delay 0.1 Seconds
Variable Set String %T1% from Clipboard

Another completely different approach would be to use the Text File Begin/End Process commands, like this:

Text File Begin Process: "test.txt"
 If Variable %T1% contains "closing case"
   Break
 End If
Text File End Process

// Here T1 contains the line that has 'closing case' on it

This method could be much quicker since you do not have to open Notepad.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...