Show/hide window triggering

Hello! I’m new to AppleScript, but could you give me a tip how can I use AppleScript to hide or show the window of the application with two conditions so that it would show the window of the app when it’s not at the front and hide it when it’s visible? When it will be done I want to bind it to the hotkey which will bring me its window or hide it like a swicher, (on/off). Hope it’s not too hard to implement. Thanks in advance guys! :slight_smile:

Hi eLDeus,

There’s a difference between an application being frontmost and its windows. Also, an application being visible is different from its windows being visible.

Edited: I deduce that you want to toggle the windows depending on whether the application is frontmost or not. In that case, It might be better to say what app, but then again it might not matter.


well all I need is bring the app in front when it’s not and simple hide it, when its in front.

So, your talking about a particular app and not the one that is frontmost.

when it’s need to show it’s best to see it as frontmost, but when it’s not… i think the same :smiley: well I just want to see it or not with the same switching action =)

i’m sorry, i think it’s about frontmost rather than not

Ok. So what you’re saying is that if a certain app is frontmost then you want its windows to not be frontmost. And, if the app is not frontmost, then you want its windows to be frontmost?

Indeed! But i’ll notice that when it’ll be hiding out (will be not frontmost) it’s better to use Hide option to make it fully disappear. Thanks! :slight_smile:

Hi eLDeus,

I’m quite sure that I did that in os10.8.5, placing the window oboe the app. I can’t do that now with AXRaise. If you’re using Mavericks, then I’m quite sure you can’t bring a window to the front without its application being frontmost. I don’t know about the opposite yet.


I have 10.8.4, maybe I have a chance?

Yeah you can easily make an app hide its windows, but you can’t make a window hide its app.


umm… I understand about what you mentioned, but the thing is in simple different action. All I want is to trigger my bottom left corner of my screen to open and close That’s all :slight_smile: I use for triggering to corners BetterTouchTool =) Thanks!

there’s an option in BTT to open an Applescript file when a corner is activated, so the real job with the trigger which must decide wether it must be enabled or disabled with the same corner activation.

ok, but where can i find Applescript 2.3 instead of my 2.5.1? I think i can’t save your script because of this…

ok i found 2.3 on my Macbook pro. may i also ask you where can i find scripting additions? so far i don’t see any actions when i run this script from AppWindowToggler folder :frowning:

Thanks to all! But i fount an easiest way to make trigger with QuickSilver and simple script

tell application "Finder"
	set visible of process "Application" to false
end tell

with just two actions on 1 hotkey: open an app and script above :D:D:D
How nicely pleasured feel one lever for one application! :stuck_out_tongue:
Thanks to all once more! :):rolleyes::slight_smile:


I am glad you found a solution that works for you, there is also hot corners in QuickSilver I believe. :slight_smile:

AppleScript 2.3 ships with Maverick, and goes along with AppleScript Editor version 2.6. And it just works, you don’t have to do anything but save the scripts at the paths given.

Thanks a lot!!


In this case I think I am to thank you, since I finally created the script to fetch the front window of the “second tier” of apps, in my workflows. :slight_smile:


I moved the scripts I wrote in posts above to this thread.