Hi Leston,

Leston Drake wrote:
> 
> Hi all,
> 
> Is there a way to globally replace a string in all the scripts in a stack?

You could add a handler to your home stack that does something similar
to Hypercard's "searchscript" handler; only it could be simpler than
that one:

on changeScripts pOldValue, pNewValue
  -- stack script
  get the script of this stack
  replace pOldValue with pNewValue in it
  set the script of this stack to it

  -- card scripts
  put (the number of cards) into xMax
  repeat with x = 1 to xMax
    get the script of this card
    replace pOldValue with pNewValue in it
    set the script of this card to it

    -- control scripts
    put (the number of controls) into yMax
    repeat with y = 1 to xMax
      get the script of control y
      replace pOldValue with pNewValue in it
      set the script of control y to it
    end repeat

  end repeat
  beep
end changeScripts 

(DISCLAIMER: You're on your own if you use this script. I ain't
'sponsible for any destruction it may cause!)

You can probably improve on this example.

You could make sure the desired stack is the defaultStack and then run
this script (or a better one) from the message box.

Regards,
Phil Davis


PS - One facet of MC's beauty is that you can hammer out some very
useful things in a very short time.

> 
> TIA,
> Leston
> 
> ------------------------------
> Leston Drake
> LetterPress Software, Inc.
> http://www.lpsoftware.com
> ------------------------------

-- 
Phil Davis
------------------
[EMAIL PROTECTED]

Reply via email to