Page 1 of 1

selectedObject lines or no lines?

Posted: Mon Aug 17, 2009 12:53 am
by hamlynart
Hi again,

any thoughts about this little conundrum:

Code: Select all

on mouseUp
   answer the number of lines in the selectedObject
   answer the selectedObject
end mouseUp
if 3 fields are selected the first dialog says "1" but the second dialog shows each one on a new line (as indicated in the documentation)??

Jim H

selectedObject lines or no lines?

Posted: Mon Aug 17, 2009 8:10 am
by jmburnod
Hi Jim,

No problem with the function selectedobject but i think it return empty because
you make it empty when you set the tool to browse to send a mouseup.

If you place an handler in the card script and you call it by the message box
the handler work

best

Jean-Marc

Posted: Mon Aug 17, 2009 9:44 am
by Klaus
Hi Jim,

I have no idea why this does not work, but I just tested a bit and foud this workaround (two buttons selected):
...
put the selectedobjects into tSelObj
put the num of lines OF the selectedobjects
## Got 0!!???

answer the num of lines of tSelObj
## I got "2"
...


Best

Klaus

Posted: Mon Aug 17, 2009 9:48 am
by hamlynart
The reason I need the script to be in a button is because I'm making a plugin. At the moment it works fine for single objects but I need it to cycle through ALL the selected objects.

I had the hope that this would work:

Code: Select all

on mouseUp
   repeat with x=1 to the number of lines in the selectedObject
      set the text of (line x of the selectedObject) to fld "Replacement"
   end repeat
end mouseUp
But because the lines of the selected object are not recognised it doesn't work?

Jim H

Posted: Mon Aug 17, 2009 9:49 am
by hamlynart
Hi Klaus,

That makes a lot of sense - I'll try it out.

Thanks

Jim

Posted: Mon Aug 17, 2009 10:18 am
by hamlynart
it works!!
on mouseUp
put the selectedObject into tSelObj
repeat with x=1 to the number of lines in tSelObj
set the text of (line x of tSelObj) to fld "Replacement"
end repeat
end mouseUp
Thanks again

Jim H