the script - The ugly details of what I am trying to do.

Mark Schonewille europe at ehug.info
Fri Aug 13 19:33:39 EDT 2004


Hi Kevin,

I've notice that you have posted your question several times.
What about this very simple example:

on preOpenStack
   if the target is ("card" && quote & "revscript" & quote) then
     answer "You're going to edit a script" with "Okay" or ¬
     "Cancel"
     if it is "Cancel" then
       close stack "revScriptEditor 1"
     end if
   end if
   pass preOpenStack
end preOpenStack

Unfortunately, not passing the preOpenStack handler may mess up
objects in the stack revscript. So, please be careful and do
extensive tests before releasing anything with scripts like 
these. This script should be sufficient if you want to change 
scripts before they are opened.

The editScript message is sent before the script editor opens,
according to the docs. I have tested this and it is not true (in
Rev 2.2.1). I have filed this as bug 1973:

<http://www.runrev.com/revolution/developers/bugdatabase/show_bug.cgi?id=1973>

Not sure whether this is a real bug or a mistake in the docs.

The editScript message doesn't work while the development
environment is active, according to the docs. This is true most
of the time. Then again, I wonder what an editScript message is
good for if it doesn't work in the development environment. Who
wants to edit a script outside of the development environment???

The revEditScript message should be sent to plug-ins, but it
isn't. See bug 692.

<http://www.runrev.com/revolution/developers/bugdatabase/show_bug.cgi?id=692>

This has been announced to be fixed in Rev 2.5, but I can't test
that right now. In the next release of Rev, using a plug-in that
intercepts the revEditScript message and sends a message to your
stack might offer a solution, but not if your purpose really is
to prevent people from editing scripts.

For the latter, password protection is probably the right thing, 
but that could also have disadvantages (e.g. password protected 
stacks cannot be included as substacks in a standalone (Rev. 
2.2.1)).

Mark

K wrote:
> 
> The editScript message is a after the fact process. I need to
> munge the script prior to it being set. Since the script with
> my macros is not necessarily valid and may encounter several
> if a multitude of errors. I was wondering if I could place a
> setProp/getProp handler in the front scripts to intercept the
> script upon storage and retrieval. This would allow me to
> expand/collapse the code.
> 
> Parser Expand and Callopse are a implementation of the GOLD
> parser with whatever syntax table you would like to use.
> 
> 
> function parserExpand aScript
> 
> -- --Do Something --
> 
> return tExpanded
> 
> end parserExpand
> 
> function parserCollapse aScript
> 
> -- --Do Something --
> 
> return tCallapsed
> 
> end parserCollapse
> 
> setProp script aScript -- --Now here is the real problem will
> the call to set the script --go to the appropriate object
> since this is a front script? -- set the script to
> parserExpand( aScript )
> 
> end script
> 
> getProp script
> 
> 
> -- --Now here is the real problem will the call to set the
> script --go to the appropriate object since this is a front
> script? -- put the script into tScript
> 
> return parserCollapse( tScript )
> 
> end script
> 
> Kevin

-- 

eHUG coordinator
mailto:europe at ehug.info
fax: +1 501 633 94 04
http://home.wanadoo.nl/mark.sch
http://www.ehug.info



More information about the use-livecode mailing list