Copy to Group problems

Thomas McGrath III mcgrath3 at mac.com
Sat Jan 14 10:11:22 EST 2012


Alan,

nextName is not just a number, but text and a number and you are trying to do math on an item of it, so I don't think you can just add a number to it. Try:

set itemDelimiter to "_"
put last item of nextName into tLastNumber
add 10 to tLastNumber
put tLastNumber into last item of nextName

in place of the line -- add 10 to last item of nextName

Hope that helps


-- Tom McGrath III
http://lazyriver.on-rev.com
3mcgrath at comcast.net

On Jan 14, 2012, at 12:15 AM, user wrote:

> Hi everyone,
> 
> I have a script intended to add, name and position a label and field group (which I refer to as a "doublet) into a group that already has a number of such doublet groups.
> 
> Here's the script:
> 
> on addFldDoublet theGroup
>   put the number of grps in grp theGroup into lastDoublet
>   put the short name of grp lastDoublet of grp theGroup into lastName
>   put the left of grp lastName into newLeft
>   put (the bottom of grp lastName +2) into newTop
>   put lastName into nextName
>   set itemDelimiter to "_"
>   add 10 to last item of nextName
>   set itemDelimiter to ","
>   copy grp lastName to grp theGroup
>   set the name of the last grp to nextName
>   answer the short name of the last grp -- confirms the correct name
>   put the short name of the last grp into newGrp
>   answer newGrp -- confirms the correct name
>   set the left of grp newGrp to newLeft
>   set the top of grp newGrp to newTop
> end addFldDoublet
> 
> FYI - assume the name of grp lastDoublet is "DB_Doublet_160"
> 
> Group newGrp is supposed to be "DB_Doublet_170" and this appears to be confirmed by the two "answer" commands I've inserted in the script to verify.
> 
> But after the script runs, it turns out that the new group is also named "DB_Doublet_160" instead of "DB_Doublet_170" (which does not seem to exist, even though the second "answer" test shows that it did ), and the new group is positioned right on top of the old group, and not offset to to newTop as desired (2 pixels below the bottom of the old group.
> 
> Anybody have any idea as to what is causing this script to not work as intended?
> 
> Thanks in advance for your help in this matter.
> 
> Kind regards,
> ALAN GAYNE
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list