function makePlainText tText
repeat for each char tChar in tText
put numToChar(charToNum(tChar)) after temp
end repeat
return temp
end makePlainText
It is useful when I need to strip all styles and properties from whatever I have copied to the clipBoard. I invoke it with a keyboard shortcut.
That is not the point. Might it be fun and useful to have a new pane ("Interesting Handlers"?) to showcase small gadgetry like this, more accessible than the "Sample Stacks" arena.
Not sure what you mean. If I copy some styled text from a web page, and paste it into a text field somewhere, the styles and properties are preserved.
Oftentimes I only want the "raw" text. No colors, no changes in textSize or fonts. Apparently there are several ways (see posts above) to change the clipBoardData into raw text. That was only an example, though if it engenders a new thread, great.
Any of the offerings, mine and others, will transform styled and property-laden text into "raw" text. The text I am speaking of is of the sort one gets when, say, one copies something from, say, a web page with lots of, er, styled text.
When one copies that text into, say, a LC field, all that style is preserved. Great.
I very often find transforming that styled text into simple raw text very useful.
Hey, I hate to change the subject, but I have an idea. Why don't we think about a new pane where cute, short utility gadgets can be posted? I bet that would be fun and instructive.
dunbarx wrote: Wed Apr 17, 2019 4:39 am
Richard, and Klaus, I guess.
Any of the offerings, mine and others, will transform styled and property-laden text into "raw" text. The text I am speaking of is of the sort one gets when, say, one copies something from, say, a web page with lots of, er, styled text.
When one copies that text into, say, a LC field, all that style is preserved. Great.
I very often find transforming that styled text into simple raw text very useful.
What is the format of the input string if not already text?
Styles require additional data. Usually this is done in binary form, such as within the inner operations of a field or the clipboard data. We can transform those into textual representations that include the formatting, such as htmlText or rtfText. But your script isn't working on binary structures nor parsing styled text representations, so I'm at a loss to conceive of an input that can be passed to it that isn't already plain text.
Hey, I hate to change the subject, but I have an idea. Why don't we think about a new pane where cute, short utility gadgets can be posted? I bet that would be fun and instructive.
Already built into the LC IDE: see Help -> Sample Stacks
Sob...
?
Richard Gaskin LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
FourthWorld wrote: Wed Apr 17, 2019 4:47 amWhat is the format of the input string if not already text?
Styles require additional data. Usually this is done in binary form, such as within the inner operations of a field or the clipboard data. We can transform those into textual representations that include the formatting, such as htmlText or rtfText. But your script isn't working on binary structures nor parsing styled text representations, so I'm at a loss to conceive of an input that can be passed to it that isn't already plain text.
I had early on mentioned the sample stacks. I was thinking more of sample handlers. I may start a new thread that has no examples. That has opened quite a discussion. I never meant it to.
Am I not making myself clear? If I copy a bit of text from a webpage, what lives in the clipBoard is likely very heavily styled and may contain properties (such as textSize) that may differ from one part of that text to another. If I then paste directly into a LC field, say, all that styling and all those properties are preserved.
Right?
Now then, oftentimes I want just the "raw" text. Not the styled text. The raw text. Not the styled text.
I think the pane is a great idea, if I understand it right, something like the scripters handbook but in a more general way, i.e. everyone contributes, it isn't just your script gems.
Kind of like MetaCards examples reference, again, if I'm reading you rightly.
Now I get it! (Maybe)
Not micro programs (like User Samples), but general handlers and the like.