Suppir Posted January 26, 2010 Share Posted January 26, 2010 (edited) Hello! I have got text with hyperlinks in my program. If I'll copy this text in MS Word - hyperlinks will stay at the right place. But if I'll copy text in notepad - hyperlinks will dissappear. That is because notepad does not support RTF tags. The adress of each hyperlink consists of 8-digit number, and I want to rip-off these numbers from my text to array. How to do it with AutoIt? Does it support raw data and RTF tags? Thanks. Edited January 26, 2010 by Suppir Link to comment Share on other sites More sharing options...
James Posted January 26, 2010 Share Posted January 26, 2010 The adress of each hyperlink consists of 8-digit number, and I want to rip-off these numbers from my text to array. How to do it with AutoIt? Does it support raw data and RTF tags?I guess you could analyse the data in the clipboard and using a regular expression to look for these hyperlinks. If this is how you want to do it, then you'll need the ClipGet and StringRegExp. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Suppir Posted January 26, 2010 Author Share Posted January 26, 2010 (edited) I guess you could analyse the data in the clipboard and using a regular expression to look for these hyperlinks. If this is how you want to do it, then you'll need the ClipGet and StringRegExp.I've already try it. But text after ClipGet() function is "flat" like in notepad. So, all metadata(font, style, hyperlinks, tables) is clipped out. Edited January 26, 2010 by Suppir Link to comment Share on other sites More sharing options...
James Posted January 26, 2010 Share Posted January 26, 2010 I've already try it. But text after ClipGet() function is "flat" like in notepad. So, all metadata(font, style, hyperlinks, tables) is clipped out.Why are you going about it that way? Copy the data out from the clipboard as you copy from the RTF? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Suppir Posted January 26, 2010 Author Share Posted January 26, 2010 (edited) Why are you going about it that way? Copy the data out from the clipboard as you copy from the RTF?I did not understand properly your saying. I'm selecting some text with hyperlinks by mouse, then copying selected in clipboard (CRTL+c). Then I'm searching by regular expressions in clipboard, but there is no RTF tags, only "flat text" of selection. I think that is because ClipGet() returns text with no RTF tags. Edited January 26, 2010 by Suppir Link to comment Share on other sites More sharing options...
James Posted January 26, 2010 Share Posted January 26, 2010 I did not understand properly your saying. I'm selecting some text with hyperlinks by mouse, then copying selected in clipboard (CRTL+c). Then I'm searching by regular expressions in clipboard, but there is no RTF tags, only "flat text" of selection. I think that is because ClipGet() returns text with no RTF tags.Oh sorry, I see. How about _ClipBoard_GetData() does any of that help? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Suppir Posted January 26, 2010 Author Share Posted January 26, 2010 Oh sorry, I see. How about _ClipBoard_GetData() does any of that help?Thanks, I will try it Link to comment Share on other sites More sharing options...
Malkey Posted January 26, 2010 Share Posted January 26, 2010 This may give you a direction.If it nearly works, you may be able to adjust the regular expression pattern to extract exactly what you require.Instead of the StringRegExp() function, _StringBetween () in #Include <String.au3> might be easier to use.#include <Array.au3> ;Create "WithHyperlinks.rtf" with Word, insert hyperlinks, saved as rtf file. Local $sStr = FileRead("WithHyperlinks.rtf") Local $aHyperLks = StringRegExp($sStr, "(?s)HYPERLINK (.*?)\*\\datafield", 3) _ArrayDisplay($aHyperLks) Link to comment Share on other sites More sharing options...
Suppir Posted January 26, 2010 Author Share Posted January 26, 2010 (edited) This may give you a direction. If it nearly works, you may be able to adjust the regular expression pattern to extract exactly what you require. Instead of the StringRegExp() function, _StringBetween () in #Include <String.au3> might be easier to use. #include <Array.au3> ;Create "WithHyperlinks.rtf" with Word, insert hyperlinks, saved as rtf file. Local $sStr = FileRead("WithHyperlinks.rtf") Local $aHyperLks = StringRegExp($sStr, "(?s)HYPERLINK (.*?)\*\\datafield", 3) _ArrayDisplay($aHyperLks) I've done it. But rtf contains only hyperlinks to himself (local). And glogal hyperlinks (to others documents) had dissapeared. I'm copying text from my program to Word. Then I see, that only local hyperlinks are displayed and to be saved in rtf. I want to rip-off hyperlinks without using Word, just from the selection in my program. When I do a selection, I'm sure that all the data contains in buffer. But later, when I paste it to another program, my hyperlinks dissappear Edited January 26, 2010 by Suppir Link to comment Share on other sites More sharing options...
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