Just converted a large product to LC8, and came across something new in the property inspector. Since I don't understand Livecode internals too well, I would really appreciate if you could shed a little bit of light on the below. Thanks big time!
There are lots of custom properties added to every stackfile that aren't added by my developers. E.g. CompilesForArchive, CompilesForSave, alreadyHidden, breakPoints, debugObjects, scalefactor scripteditorselection, code, dirty, handlers, props, varChecking etc etc etc.
A number of these look like HTML and seem to resemble a formatted version of scripts, lists of handlers, etc.
When we make changes to our scripts, the script text is of course altered, but the HTML codes resembling the scripts are not. So when I use a diff tool to compare an old and a new version of a script, lots of differences appear that aren't really differences.
Anyway, just wanted to know:
1) What are those custom properties for? Is there any documentation for each of their purpose?
2) Why is HTML stored in the stack file? Isn't that just garbage since it isn't the same as what it seems to represent?
3) Can we safely remove them all, and how would I do that? Since I don't understand the purpose of the custom props very well, could there be any problem deleting them?
4) Could I write a saveStackRequest handler for each stack and delete the custom props? What would be the command to do this, as I can't find this the Dictionary
Thank you very much for any help!
Understanding and removing custom/system properties
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 7
- Joined: Tue Aug 18, 2015 7:25 am
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Understanding and removing custom/system properties
These are properties used only by the IDE, which track various things such as the last state of the saved script (as html, used for reverting,) the undo stack for the current session, the location(s) of any saved breakpoints, and some other things. If you delete them, you will lose the ability to relaunch your stack in the same state it was in when you last saved it. (Scripts won't be lost, but state changes will be.)1) What are those custom properties for? Is there any documentation for each of their purpose?
2) Why is HTML stored in the stack file? Isn't that just garbage since it isn't the same as what it seems to represent?
3) Can we safely remove them all, and how would I do that? Since I don't understand the purpose of the custom props very well, could there be any problem deleting them?
4) Could I write a saveStackRequest handler for each stack and delete the custom props?
These properties are not included when you build a standalone, they are stripped out so there's no need to remove them. They are for use only in the IDE.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 7
- Joined: Tue Aug 18, 2015 7:25 am
Re: Understanding and removing custom/system properties
Thank you Jacque. If I want to delete them, just as a one-off cleanup, how would I do that? (using programming code rather than deleting one-by-one?)jacque wrote:These are properties used only by the IDE, which track various things such as the last state of the saved script (as html, used for reverting,) the undo stack for the current session, the location(s) of any saved breakpoints, and some other things. If you delete them, you will lose the ability to relaunch your stack in the same state it was in when you last saved it. (Scripts won't be lost, but state changes will be.)1) What are those custom properties for? Is there any documentation for each of their purpose?
2) Why is HTML stored in the stack file? Isn't that just garbage since it isn't the same as what it seems to represent?
3) Can we safely remove them all, and how would I do that? Since I don't understand the purpose of the custom props very well, could there be any problem deleting them?
4) Could I write a saveStackRequest handler for each stack and delete the custom props?
These properties are not included when you build a standalone, they are stripped out so there's no need to remove them. They are for use only in the IDE.
Thank you for you help.
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Understanding and removing custom/system properties
There's no point in removing it, it will just get recreated. It changes constantly. Most document files keep information like this, if you've ever opened a Word file in a text editor you'll see similar things. The IDE relies on the info, and since none of it is included in a standalone, it does no harm.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 7
- Joined: Tue Aug 18, 2015 7:25 am
Re: Understanding and removing custom/system properties
Thanks Jacque for the response, much appreciated. I get your point.jacque wrote:There's no point in removing it, it will just get recreated. It changes constantly. Most document files keep information like this, if you've ever opened a Word file in a text editor you'll see similar things. The IDE relies on the info, and since none of it is included in a standalone, it does no harm.
There may be some reason anyway to remove that stuff (removing it is after all one of the things the standalone builder does!), e.g.:
- you work with multiple people on a project and don't want IDE symbols (e.g. someone else's breakpoints) lying around
- you use a diff tool and don't want changes in the IDE symbols to show up as differences
- you converted a very old project to the most recent LC and suspect many custom property sets contain unused properties, or even cause bugs
- you want to reduce the size of your .livecode files
- you are like me and like things clean
For what it''s worth to others, I found the way to clean up IDE symbols before saving a stack:
I traced the clean-up code in the Standalone builder to revsaveasstandalone.livecodescript
I made copies of revSetStackProps and revSetObjectProps and put them in one of my own libraries
Added code to delete a whole lot of other useless custom property sets and custom properties
Added code to clean up substacks as well (the Standalone Builder forgets to do this apparently!)
Added a saveStackRequest handler to activate the cleanup code: (you put this in the script for every stack)
Code: Select all
on saveStackRequest
mySetStackProps the long id of me
pass saveStackRequest
end saveStackRequest
on mySetStackProps pStack
local tCard,tControl,tSetTo,tRemoveAll,tIncludeList,tCardNum,tControlNum,tSubStacks
local tStandaloneSettingsA
lock screen
lock messages
set the wholeMatches to true
--remove profiles from all objects
put the customProperties["cRevStandaloneSettings"] of stack (the mainstack of stack pStack) into tStandaloneSettingsA
if tStandaloneSettingsA["setToProfile"] is not "" then put true into tSetTo
-- stack properties
set the customKeys["cREVStandaloneSettings"] of stack pStack to ""
mySetObjectProps the long id of stack pStack,tSetTo,tStandaloneSettingsA["includeProfiles"],tStandaloneSettingsA
-- card properties
put the number of cds in stack pStack into tCardNum
repeat with tCard = 1 to tCardNum
mySetObjectProps the long id of cd tCard of stack pStack,tSetTo,tStandaloneSettingsA["includeProfiles"],tStandaloneSettingsA
-- control properties
put the number of controls of cd tCard of stack pStack into tControlNum
repeat with tControl = 1 to tControlNum
mySetObjectProps the long id of control tControl of cd tCard of stack pStack,tSetTo,tStandaloneSettingsA["includeProfiles"],tControl,tStandaloneSettingsA
end repeat
end repeat
put the substacks of pStack into tSubStacks
repeat for each line tSS in tSubStacks
get the long id of stack (tSS) of stack pStack
mySetStackProps it
end repeat
unlock screen
end mySetStackProps
on mySetObjectProps pObject,pSetTo,pIncludeList,pStandaloneSettingsA
local tKeys,tProfileSets,tLine,tFinalList
put the customProperties["cREVGeneral"] of pObject into tKeys
if pSetTo then put pStandaloneSettingsA["setToProfile"] into tKeys["profile"]
if pIncludeList = "" then
delete local tKeys["profile"]
delete local tKeys["masterName"]
delete local tKeys["profileList"]
end if
if pIncludeList is not "*" then
--only include specific profiles in pObject
put the customPropertySets of pObject into tProfileSets
put tProfileSets into tFinalList
repeat for each line tLine in tProfileSets
-- delete unlisted propsets with names that begin with "cREVDiverged"
if char 1 to 12 of tLine is "cREVDiverged" then
delete char 1 to 12 of tLine
if tLine is not among the lines of pStandaloneSettingsA["includeProfiles"] then
delete line lineOffset(("cREVDiverged"&tLine),tFinalList) of tFinalList
end if
else if tLine is among the items of "uRIP,cConsNo,cConsLast,cGlxGeneral,cGlx2General,cREVGeometryCache,cREVGeometryCacheIDs,cREVTable" then
-- delete other common propsets
delete line lineOffset(tLine,tFinalList) of tFinalList
end if
end repeat
set the customPropertySets of pObject to tFinalList
end if
-- delete common props from the cREVGeneral propset
delete local tKeys["bookmarks"]
delete local tKeys["handlerList"]
delete local tKeys["scriptSelection"]
delete local tKeys["prevHandler"]
delete local tKeys["tempScript"]
delete local tKeys["script"]
delete local tKeys["scriptCheckSum"]
delete local tKeys["AlreadyHidden"]
delete local tKeys["breakPoints"]
delete local tKeys["breakpointconditions"]
delete local tKeys["breakpointstates"]
delete local tKeys["debugObjects"]
delete local tKeys["scalefactor"]
delete local tKeys["scripteditorselection"]
delete local tKeys["scripteditorvscroll"]
delete local tKeys["revUniqueID"]
if pSetTo then unlock messages --activate profile libraries
set the customProperties["cREVGeneral"] of pObject to tKeys
if pSetTo then lock messages --activate profile libraries
end mySetObjectProps