Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Will Cheyney

macrumors 6502a
Original poster
Jul 13, 2005
701
0
United Kingdom
Can somebody tell me the code I need to create an AppleScript that will hide an application when I press a the scroll 'nipple' on my Mighty Mouse?

I have no AppleScript experience :(


Many thanks!
 

Will Cheyney

macrumors 6502a
Original poster
Jul 13, 2005
701
0
United Kingdom
You can't just tell it to hide the front application?

I found a script that hides all open applications... It's from Apple site.
http://www.apple.com/applescript/toolbar/
(Under 'Window management' and called 'Hide Application Windows' - direct download: http://images.apple.com/applescript/toolbar/scripts/hideapps.sit).

I just want the current app to be hidden though!

This is the code the script above uses:
Code:
tell application "Finder"
	activate
	set visible of every process whose visible is true and name is not "Finder" to false
end tell
 

HexMonkey

Administrator emeritus
Feb 5, 2004
2,240
504
New Zealand
You can use this code to hide the front application:
Code:
tell application "Finder" to set visible of every process whose frontmost is true to false

However, as robbieduncan said, AppleScript can't automatically respond to events such as pressing the scroll button, although there might be a third party application that you could use to run the script when the button is pressed.
 

Will Cheyney

macrumors 6502a
Original poster
Jul 13, 2005
701
0
United Kingdom
Can you not just compile is as an app and then have it set to launch (and therefore run) when a button is pressed (set through System Preferences)?
 

HexMonkey

Administrator emeritus
Feb 5, 2004
2,240
504
New Zealand
I think you're right actually, I don't have such a feature available to me but looking at the resources inside the Keyboard and Mouse preferences pane it looks like it does allow it for Mighty Mouse users.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.