Jump to content

Filtering string and saving as file


Recommended Posts

How can I filter out everything in a string except for text between specific tags, specifically between <title>Message title</title> and <body id="msgFeedSummaryBody" selected="false">Summary text</body>

 

I also want to extract the URL, which is given three times:

     1. Message-Id: <https://www.linktopage.htm@localhost.localdomain>

     2. Content-Base: https://linktopage.htm (no closing tag for this, just a line feed with the next one beginning with “Content-Type: “)

     3. <base href="https://www.linktopage.htm">

 

Having extracted the Message title, Summary text, and URL, I want to save that in one of various text files, with a prompt for user input giving me a way (such as entering a letter, word, or clicking a radio button; the latter is preferable) to specify which file.

 

Here is the code I have so far:

 

#include <MsgBoxConstants.au3>

Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

HotKeySet("^h", "_copy")


While 1

Sleep(100)

WEnd


Func _copy()

Send("^u") ; opens the message source of the news feed in my e-mail client (Thunderbird) showing all of the desired information

Sleep(1000)

Send("^a") ; select all of it

Sleep(1000)

Send("^c") ; copy it to clipboard

EndFunc

Now how can I filter the clipboard contents (as above), add to it (adding “-----------------------” as a separator, display it to the screen (for confirmation), and append it as plain text to one of several different files?

 

Thank you!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...