get the color of this card at x,y

Wilhelm Sanke sanke at hrz.uni-kassel.de
Fri Nov 20 05:24:23 EST 2009


"Bill Marriott" <wjm at wjm.org> wrote:

> That code didn't work for me ... Probably need something more like,
>
> lock screen
> put the screenmouseLoc into coord
> set the screenmouseLoc to 350,350
> put the mousecolor
> set the screenmouseLoc to coord
> unlock screen
>
> Alternately, one can export snapshot consisting of a single pixel and 
> parse
> its contents.
>
> Wilhelm Sanke wrote"
> >> >> get the color of this card at x,y
> >> >>  and I would expect it to contain r,g,b
> > >
> > > "click at x,y
> > > put the mousecolor"


You are right.
My test here was too quick, but the two-liner worked for me, because the 
point I had chosen for the test was inside an image whose script 
contained "put the mousecolor", as I now found out.

For your solution I would recommend to add "globalloc()" to easier 
access points on the card, like

   "put 545,410 into tloc
   lock screen
   put the screenmouseLoc into coord
   set the screenmouseLoc to globalloc(tloc)
   put the mousecolor
   set the screenmouseLoc to coord
   unlock screen"

Regards,

Wilhelm Sanke
<http://www.sanke.org/MetaMedia>



More information about the use-livecode mailing list