Thanks Richmond and Pete. What I want it for is to set the ID of the image I just created to theHighestID +1. Obviously, if I just created an image, those functions will return that image ID.
As promised, I have written a function that I think is fairly bullet proof. It checks for an invalid object type, as well as handling singular or plural forms of object types. It returns a sorted list of whatever property for whatever object type you tell it, excluding duplicates. I will probably enhance it to accept a scope, either card or stack. I'm wondering if this would be more useful to others if each line was a list of the long ID of the object followed by the property value? eg. put objectList("buttons", "short name", "descending") into theButtonNames function objectList theType, theProp, theSort if the last char of theType is "s" then put char 1 to -2 of theType into theType if theSort is empty then put "ascending" into theSort if theSort is not in "ascending.descending" then return "Error: Invalid sort" end if try do "get the " & theProp & " of " & theType & " 1 of this card" catch theError if item 1 of the last line of theError is "166" then return "Error: Invalid type" else return "Error: " & the last line of theError end if end try put empty into theObjectList put 1 into theLineNum put theType & "s" into thePluralType put the name of this card into theStartCard lock screen lock messages repeat with theCardNum = 1 to the number of cards of this stack go card theCardNum try do "put the number of " & thePluralType & " of this card into theTypeCount" repeat with theObjectNum = 1 to theTypeCount do "put the " & theProp & " of " & theType && theObjectNum & " into theValue" if theValue is not in theObjectList then put theValue into line theLineNum of theObjectList add 1 to theLineNum end if end repeat catch theError breakpoint end try end repeat go card theStartCard if line 1 of theObjectList is a number then do "sort theObjectList numeric" && theSort else do "sort theObjectList" && theSort end if return theObjectList end objectList On Mar 21, 2012, at 10:07 AM, Pete wrote: > Maybe "get the ID of the last image of stack "xyz"? Not sure if that would > work or not, I seem to remember having problems with using the "last" > keyword in the past but I think that was specifically to do with groups. > Pete > > On Wed, Mar 21, 2012 at 9:49 AM, J. Landman Gay > <jac...@hyperactivesw.com>wrote: > >> On 3/21/12 11:25 AM, Bob Sneidar wrote: >> >>> Can anyone think of a quick way (other than a repeat loop) to >>> determine the highest ID of all the image files in a stack? >>> >> >> The ID of the stack is the either the last-used ID or the next available >> one, I forget which. It doesn't discriminate between the kinds of controls >> though. >> >> -- >> Jacqueline Landman Gay | jac...@hyperactivesw.com >> HyperActive Software | http://www.hyperactivesw.com >> >> >> ______________________________**_________________ >> use-livecode mailing list >> use-livecode@lists.runrev.com >> Please visit this url to subscribe, unsubscribe and manage your >> subscription preferences: >> http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode> >> >> > > > -- > Pete > Molly's Revenge <http://www.mollysrevenge.com> > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode