![]() Sounds like a bit of work on the handler might straighten this out, and then you would have "real" plain text with style info, but not font. I tried the following as a replacement, based on what the original poster said: - set seed_char to «class ktxt» of (("x" as Unicode text) as record)tell sttr to copy StyledTextToRecord(seed_char) to defaultStyleInfobut now the handler throws up an error claiming the clipboard has non-styled text. Therefore, Gevena becomes the default font for the clipboard. And the original poster's comments.It's to do with the seed value "x" on the line: - tell sttr to copy StyledTextToRecord("x" as Unicode text) to defaultStyleInfoUnfortunately, Applescript assigns this "x" a Geneva font right from the start. For some reason Applescript assigns what you might expect to be a plain text to a Geneva font! See my previous post on this. This is excellent! Does what it says on the tin! Well, almost.Although you get bolds etc, it isn't plain text - the font is Geneva. property sttr : missing value-> modify the following as neededif sttr is missing value then set sttr to load script alias "Macintosh HD:Library:Scripts:StyledTextToRecord:StyledText Record.scpt"end ifdisplay dialog "I will take the contents of the clipboard (styled text, please) and convert everything to plain text, except for bolds and italics" with icon noteset clipContents to (the clipboard) as styled texttell sttr to copy StyledTextToRecord(clipContents) to styleInfo-> get default styles to reset alltell sttr to copy StyledTextToRecord("x" as Unicode text) to defaultStyleInforepeat with i from 1 to count styleInfo's stylesOn set x to styleInfo's stylesOn's item i if x is not end repeatset the clipboard to (sttr's RecordToStyledText(styleInfo))beep 2here's the forum page where people helped me figure this out: Link As record splits out the style and text portions, and »class ktxt» grabs the plain text portion of that. However, If you have quick access to AppleScripts through Apple's Script Menu or iKey, then the following line of AppleScript will remove the formatting and leave the plain text (which should then take on the default formatting of whatever program you are pasting it into): set the clipboard to «class ktxt» of ((the clipboard as text) as record)How it works: The as text portion grabs the stylized text from whatever other junk may be surrounding it (which can be significant). Get over 5000 free apps for Mac OS Install Plain Clip on Mac OSX JAmber Jain About the App App name: Plain Clip App description: plain-clip (App: Plain Clip.app) App website: Install the App Press Command+Space and type Terminal and press enter/return key. for the text to make it look like the text I'm pasting it beside. The problem is that when I paste the text, it brings along the style of other program, which means I now have to change font, weight, size, etc. I frequently find myself wanting to copy and paste text between two programs that use completely different styles for their text.
0 Comments
Leave a Reply. |