• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how to hide the frontmost app?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to hide the frontmost app?


  • Subject: Re: how to hide the frontmost app?
  • From: Kai Edwards <email@hidden>
  • Date: Sun, 23 Dec 2001 14:21:19 +0100

Have you tried temporarily hiding the applet?

This would briefly return the previously frontmost app to the front - and
allow your script to get the necessary information about it. The applet
could then push itself the front again to complete the task.

This approach might be a bit clunky for your purposes - but, in case you
don't get any more sophisticated suggestions, it might give you a starting
point from which to refine further.

At the moment, I'm working on a machine running 8.1 (don't laugh) - so the
following script has yet to be tested on 9 (though it should work in
theory)!

**********************************

property myProcess : ""
--(recompile script before saving as an applet)

tell application "Finder"
if myProcess = "" then set myProcess to process (name of (path to me))
try
set visible of myProcess to false
set p to every application process whose frontmost is true
set nextToFrontmost to item 1 of p
set frontmost of myProcess to true
set visible of nextToFrontmost to false
on error errMsg number errNo
if errNo  -10000 then tell me to display dialog errMsg & return &
return & errNo
--(error -10000 occurs when there are no other visible processes)
end try
end tell

**********************************

HTH. What's the betting it prompts one of the list experts to come up with a
smart one-liner that does the lot? ;)

> Date: Sat, 22 Dec 2001 00:15:51 -0700
> Subject: how to hide the frontmost app?
> From: "Donald S. Hall" <email@hidden>
> To: AppleScript Mailing List <email@hidden>
>
> One feature I like about OS X is the ability to hide the frontmost app by
> typing command-H. I wanted to do something similar in OS 9 by creating a
> script applet and attaching it to a function key. Then I could just hit the
> function key instead of going to the Application menu. Unfortunately, this
> does not work - my script applet becomes the frontmost app on launch.
>
> Does anyone have any suggestions as to how to make this work? If I could
> find out what the next to frontmost app was I could use that, but apps are
> listed by Applescript in alphabetical order, not order on screen.
>
> Here is my script:
>
> tell application "Finder"
> set p to every application process whose frontmost is true
> set visible of item 1 of p to false
> end tell
>
> If run from the Script Editor, this hides the Script Editor as expected. If
> run from the function key, it only hides itself.

--

**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************


  • Prev by Date: 9.2.2: UI lookup fixed in AS 1.7
  • Next by Date: 9.2.2: 'run script' changed
  • Previous by thread: how to hide the frontmost app?
  • Next by thread: Re: how to hide the frontmost app?
  • Index(es):
    • Date
    • Thread