Page 1 of 1

How can I auto-indent text to look like a script?

Posted: Mon Apr 15, 2013 2:12 pm
by MouseUp
How can I auto-indent a block of text to look like a script? I have a stack that keeps my favorite scripts in a database for later use. If I have a block of text that needs to be indented as it would appear in the LC script editor, how can I automate this indenting without having to copy and paste into the script editor itself? I tried setting the script of an object then sending a tab key down to it but that didn't work. I want to format an un-indented script to look like an indented script in my card field.

Re: How can I auto-indent text to look like a script?

Posted: Mon Apr 15, 2013 2:21 pm
by Mark
Hi,

Send me an e-mail (see my website) and I'll send you a stack. The stack is a bit old, might need some adjustment, but it works well almost all the time.

Kind regards,

Mark

Re: How can I auto-indent text to look like a script?

Posted: Mon Apr 15, 2013 3:41 pm
by MouseUp
This used to work in HyperCard but it not longer works in LiveCode. Any ideas how to get it to work in LC?...

Code: Select all

function formatAsScript CONTAINER
   put script of target into TEMP
   set script of target to CONTAINER
   put script of target into CONTAINER
   set script of target to TEMP
   return CONTAINER
end formatAsScript

Re: How can I auto-indent text to look like a script?

Posted: Mon Apr 15, 2013 5:32 pm
by Mark
Hi,

I got your e-mail but I can't send you a reply because my IP address is blocked by Road Runner.

Kind regards,

Mark