Not exactly a System Window???

Ken Ray kray at sonsothunder.com
Tue Oct 11 13:25:21 EDT 2005


On 10/11/05 11:52 AM, "Todd Geist" <tg.lists at geistinteractive.com> wrote:

> Hello,
> 
> I am building a tool that I would Like to appear in a window floating above
> everything but only when a certain other apps are in front.
> 
> The idea is that it should appear as a Tool Palette for some Apps but not
> all applications.
> 
> I know how to set the systemWindow prop to true, but I don't know how to
> make it only be true when some applications are in front but not others.
> 
> Initially this would be targeted at Mac OSX but Windows would follow
> immediately after.
> 
> Anybody have any ideas?

Well, you could constantly poll for the frontmost application process on OS
X using AppleScript, and then set the style of the window to 'system' only
when a particular app was in front, and to 'palette' all the other times.

Here's the AppleScript:

tell application "System Events"
    get the name of every application process whose frontmost is true
end tell

It will come back as a list item (like {"MetaCard"}), so you can either
strip the first and last two characters from it, or you can use this instead
(which uses the "as string" and value() functions):

on mouseUp
  put format("tell application \"System Events\"") & cr & \
      "set tProc to (the name of every application process" && \
      "whose frontmost is true) as string" & cr & \
      "get tProc" & cr & "end tell" into tAS
  do tAS as AppleScript
  put value(the result)
end mouseUp

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list