Copy to Group problems
alanira9 at mac.com
Fri Jan 13 23:15:43 CST 2012
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
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
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
Thanks in advance for your help in this matter.
More information about the use-livecode