Page 1 of 1

Stack Manager

Posted: Wed Jul 01, 2009 8:13 pm
by SirWobbyTheFirst
I've got a stack in the front scripts which has a PreOpenStack and CloseStack handler in it to update a list whenever a stack is opened and closed.

Trouble is i cant figure out how to get the name of the stack which is opened/closed. Can anyone help?

Btw. The stack is set to automatically pass the message once complete so the stack being opened/closed can perform its own tasks on those messages.

Any help would be much appreciated.

Posted: Thu Jul 02, 2009 6:22 am
by Janschenkel
Look at the content of the long id of the target. In Rev's messaging system, the target is the original destination of the event message; in case of preOpenStack and closeStack messages, the current card of the target stack is the original destination; so we have to use the long id to extract the stack name.

Code: Select all

on preOpenStack
  put StackNameFromLongId(the long id of the target) into tStackName
  -- proceed as planned
  pass preOpenStack
end preOpenStack

on closeStack
  put StackNameFromLongId(the long id of the target) into tStackName
  -- proceed as planned
  pass closeStack
end closeStack

private function StackNameFromLongId pLongId
  -- determine where the 'stack "TheStackName"' part begins
  put wordOffset("stack", pLongId) into tWordOffset
  -- we only care about the name of the stack, so get the next word
  put word tWordOffset + 1 of pLongId into tStackName
  -- now get rid of the leading and trailing quote
  return char 2 to -2 of tStackName
end StackNameFromLongId
Jan Schenkel.

Thanks

Posted: Thu Jul 02, 2009 9:09 am
by SirWobbyTheFirst
Thanks Janschenkel, I hope this can help me.

Ps. Will it work for stacks which are opened but invisible?

Re: Thanks

Posted: Thu Jul 02, 2009 9:37 am
by Klaus
mickpitkin92 wrote:...Ps. Will it work for stacks which are opened but invisible?
Since computers do not have eyes like we do, the answer is YES :)

Posted: Thu Jul 02, 2009 1:36 pm
by SirWobbyTheFirst
Does a webcam not count? Lol :lol:

Anyways cheers for the help.

Posted: Thu Jul 02, 2009 6:40 pm
by Klaus
mickpitkin92 wrote:Does a webcam not count?
NO WAY, DUDE! :D