Removing Geometry Manager Properties with a Script

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
stephenmcnutt
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 107
Joined: Fri Nov 10, 2006 8:58 pm
Contact:

Removing Geometry Manager Properties with a Script

Post by stephenmcnutt » Thu Dec 06, 2012 11:39 pm

My stack has become "infected" with Geometry Manager information. Using the "Remove All" button in the Geometry section of the Property Inspector apparently doesn't work, so I'm trying to do it with a script:

local tCount = 0
repeat for each line thisCard in the cardNames of stack "Heimdallr"
repeat with ctrlNumber = 1 to the number of controls on card thisCard
repeat with propLine = 1 to the number of lines in the custompropertysets of control ctrlNumber of card thisCard
if line propLine of the custompropertysets of control ctrlNumber of card thisCard is "cREVGeometry" then
put " " into line propLine of the custompropertysets of control ctrlNumber of card thisCard
add 1 to tCount
end if
end repeat
end repeat
end repeat
put tCount into message

That first "put..." line (about the middle line) is the problem. I get an error saying: Chunk: can't create a variable with that name (explicitVariables?)) near "custompropertysets", char 45

If I change that line from "put..." to "answer line propLine of the custompropertysets of control ctrlNumber of card thisCard", I get no error, but of course that doesn't get the job done.

If I change that line to "delete line propLine of the custompropertysets of control ctrlNumber of card thisCard", I get this error: (Commands: missing ',') near "of", char 28

Can you help me? I'm just trying to delete all the Geometry Manager properties from my stack.
Last edited by stephenmcnutt on Fri Dec 07, 2012 4:01 pm, edited 1 time in total.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Deleting a custom property set

Post by Mark » Fri Dec 07, 2012 2:38 am

Hi,

Try this:

Code: Select all

on mouseUp
     put the customPropertySets of this stack into myProps
     filter myProps without "cREVGeometryCacheIDs"
     filter myProps without "cREVGeometryCache"
     set the customPropertySets of this stack to myProps
     repeat with x = 1 to number of cards
          put the customPropertySets of cd x into myProps
          filter myProps without "cREVGeometryCacheIDs"
          filter myProps without "cREVGeometryCache"
          set the customPropertySets of cd x to myProps
          repeat with y = 1 to number of controls of cd x
               put the customPropertySets of control y of cd x into myProps
               filter myProps without "cREVGeometryCacheIDs"
               filter myProps without "cREVGeometryCache"
               filter myProps without "cREVGeometry"
               set the customPropertySets of control y of cd x to myProps
          end repeat
     end repeat
end mouseUp
Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

stephenmcnutt
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 107
Joined: Fri Nov 10, 2006 8:58 pm
Contact:

Re: Please Help Me Spot the Error

Post by stephenmcnutt » Fri Dec 07, 2012 3:51 pm

Thanks, Mark! That script seems to have done the trick. I've sampled the objects in my stack with Message Box scripts like:

put the custompropertysets of button "GoToCheckIn" of card "Welcome" of stack "Heimdallr"

...and I'm not seeing any geometry-related properties anymore. Super. Thanks again. You LiveCode Forum people are tops.

Post Reply