xlordsaduj Posted March 24, 2019 Posted March 24, 2019 Hi everyone, I'm new to the Autoit scene and I'm looking for some guidance. I'm saving emails from thunderbird to file and would to know how I can get Autoit to find the Subject line and copy that as well as the email message that's between 2 lines of text. The email message is below some static text that never changes if this helps someone with an idea on how I can do this. Or if you think i'd be better off using some other tool, please let me know thank you. Below is a partial of the email. Thanks in advance. Subject: New text message from (000) 000-0000 <-----------------------(I WOULD LIKE TO COPY THIS LINE AFTER SUBJECT: From: "(000) 000-000" <xxxxxxxxxxxxxxxxx@txt.voice.google.com> To: xxxxxxxxxx@gmail.com Content-Type: multipart/alternative; boundary="000000000000ee478545554554" --000000000000ee478545554554 Content-Type: text/plain; charset="UTF-8"; format=flowed; delsp=yes <https://voice.google.com> <------------------------------(BELOW THIS LINE I WOULD LIKE TO COPY THE EMAIL MESSAGE ONLY AND STOP BEFORE IT GETS TO "YOUR ACCOUNT" This shirt features one of the main characters Pencilmiss from Pencilmation! Pencilmation is a cartoon channel for kids and not-too-serious grown-ups. It is made with love and a lot of fun by an international team helmed by Ross Bollinger who started the channel alone in his room a long time ago. Follow the new, wacky, and often times quite silly adventures of Pencilmate, Little Blue Man, Pencilmiss and other toons every Tuesday, Thursday and Saturday on our Youtube Channel "Pencilmation". YOUR ACCOUNT <https://voice.google.com> HELP CENTER <---------------------------STOPPING BEFORE IT GETS TO THIS LINE
mikell Posted March 24, 2019 Posted March 24, 2019 You might have a look at the _StringBetween function An other way is to directly use a regular expression $txt = FileRead("test.txt") ; text of the mail Msgbox(0,"Before", $txt) $m1 = "Subject: " $m2 = "<https://voice.google.com>" $m3 = "YOUR ACCOUNT" $res = StringRegExpReplace($txt, '(?s).*' & $m1 & '(\N+\R).*?' & $m2 & '(.*?)' & $m3 & '.*', "$1$2") Msgbox(0,"After", $res)
xlordsaduj Posted March 24, 2019 Author Posted March 24, 2019 Thank you for the quick reply/help with this.
xlordsaduj Posted March 24, 2019 Author Posted March 24, 2019 Your script worked perfect, thank you Mikell!
xlordsaduj Posted March 26, 2019 Author Posted March 26, 2019 Is there a way to copy both lines of text to clipboard? to have that text extracted to another app? Thanks in advance
xlordsaduj Posted March 26, 2019 Author Posted March 26, 2019 I've tried this code #include <MsgBoxConstants.au3> $txt = FileRead("FILENAME") ; text of the mail Msgbox(0,"Before", $txt) $m1 = "Subject: " $m2 = "<https://voice.google.com>" $m3 = "YOUR ACCOUNT" $res = StringRegExpReplace($txt, '(?s).*' & $m1 & '(\N+\R).*?' & $m2 & '(.*?)' & $m3 & '.*', "$1$2") Msgbox(0,"After", $res) Func Example() ; Retrieve the window text of the active window. Local $sText = WinGetText("[ACTIVE]") ; Display the window text. MsgBox($MB_SYSTEMMODAL, "", $sText) EndFunc ;==>Example
FrancescoDiMuro Posted March 27, 2019 Posted March 27, 2019 6 hours ago, xlordsaduj said: Is there a way to copy both lines of text to clipboard? ClipPut(). Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now