A really cool trick! (medium level scripting)

MisterX b.xavier at internet.lu
Sat Apr 30 01:16:33 EDT 2005


you probably dont know but this cool little script from HyperCard, somewhat
modified across the life of its utility, is great to keep around. 

Many plugins already do it anyway... But that's not the point...

on xy
  local lastxy
  repeat until the mouseClick
    get the mouseLoc && "  horz:" & the mouseH && "  vert:" & the mouseV
    if it is not lastxy then
      put it
      put it into lastxy
    end if
  end repeat
end xy

Here's the point... What about getting any property with the mousemove?
I wanted to make a color set and needed to grab a color from a control
nearby. 

-- RepeatShowGetItUntilClick is an ugly, hard to remember name. I noticed! 

on RepeatShowGetItUntilClick what
  local lastwhat
  repeat until the mouseClick
    do what
    if it is not lastwhat then
      put it
      put it into lastwhat
    end if
  end repeat
end RepeatShowGetItUntilClick

To use it, just pass a "get" <function> or <property of> as a parameter.
Note there's no error checking. Left as exercise... 

Example:

Type this in the message box: 

  RepeatShowGetItUntilClick "get the mousecolor"

Any "mouse" property (mouseChar, mouseCharChunk, mouseControl, mouseLine,
mouseLoc, mouseText,loc,h,v,etc... can be shown quite easily with this!!!). 

Here's the old (but updated) article on the stack i did with the previous xy
in Metacard. Handles most cases.
http://www.monsieurx.com/modules.php?name=News&file=article&sid=118

cheers
Xavier
http://monsieurx.com



More information about the use-livecode mailing list