A bit of a hack, but may help?

on deconstruct_Object someObject, @someControl, @cardObject, @stackName
  -- <hack>
  put extract_StackObject(someObject) into stackObject
  put the last word of stackObject into stackName
  delete char 1 of stackName
  delete last char of stackName
  -- put the short name of stackObject into stackName
  -- </hack>

put "(^.*) of (card .*) of stack" && quote & "(.*)" & quote into someReg if matchtext(someObject, someReg, someControl, cardObject, stackNameBit) is true then
    return stackObject
  else if word 1 of someObject is "stack" then
    put "^stack" && quote & "(.*)" & quote into someReg
    if matchText(someObject, someReg, stackNameBit) is true then
      -- a stack
      put empty into someObject
      put empty into cardObject
      return stackObject
    else
      return "Not a well formed MC object"
    end if
  else if word 1 of someObject is "card" then
    put "(^card .*) of stack" && quote & "(.*)" & quote into someReg
if matchtext(someObject, someReg, cardObject, stackNameBit) is true then
      put empty into someObject
      return stackObject
    else
      return "Not a well formed MC object"
    end if
  else -- it's a group not on a card
    put "(^.*) of stack" && quote & "(.*)" & quote into someReg
if matchtext(someObject, someReg, someControl, stackNameBit) is true then
      put empty into cardObject
      return stackObject
    else
      return "Not a well formed MC object"
    end if
  end if
end deconstruct_Object

function extract_StackObject someObject
if someObject is empty then put the long name of the target into someObject
  setOffsets_StackObject someObject, stackNameStart, stackNameEnd
return char stackNameStart to stackNameEnd of someObject into longStackName
end extract_StackObject

on setOffsets_StackObject someObject, @stackNameStart, @stackNameEnd
  -- hack assumes last char is quote
  put the number of chars of someObject into stackNameEnd
  put "stack" && quote into stackStart
  put offset(stackStart, someObject) into stackNameStart
end setOffsets_StackObject


On 17 Oct 2005, at 17:00, David Burgun wrote:

Hi,

Does anyone know of a function that will extract name of the Control, Group, Card and Stack from a long name string?

e.g. I have a string of the form:

control "A" of group "B" of card "C" of stack "D"

And I would like to have:

local myControlName  = A
local myGroupName = B
local myCardName = C
local myStackName = D

Any tips of how to write some code to do this would be greatly appreciated if there is not a standard function available.

I haven't used the string function in RunRev much and I'm having difficulty in working out the best way to do this.

Thanks a lot
All the Best
Dave
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to