Example of scrolling group?

Richard Gaskin ambassador at fourthworld.com
Fri Jun 4 17:42:47 EDT 2010


Marty Knapp wrote:

> When setting the passKey of a protected stack, is there a way to catch
> if is valid or not? I made a change in the password of some of my stacks
> along the way, and so there are two possible passKeys. If there's a way
> for me to try one, then if it fails try another, I'd be a lot happier
> today! My guess is that it can't be done, but maybe?

In earlier versions of Rev you could check is a stack is protected with 
this:

    return (the passkey of stack tStack = the password of stack tStack)

...to return true if the password had never been set or if the passkey 
has been entered during the current session.

Unfortunately this broke with the new, more secure, method of encrypting 
scripts in v4.0.

Now the only reliable method I've found also works in earlier versions 
but is a little longer, requiring a try/catch block:

function IsPasswordProtected pStack
   try
      get the script of stack pStack
   catch tErr
      return true -- couldn't get script
   end try
   return false -- got it OK
end IsPasswordProtected

You can use a similar try/catch setup to attempt to set the password, 
with the catch part coming into play if it fails.

--
  Richard Gaskin
  Fourth World
  Rev training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com
  revJournal blog: http://revjournal.com/blog.irv



More information about the use-livecode mailing list