This is a fairly basic question, and I'm not sure where it should go.
How can I hide a window, such as when pressing Apple+H, in Applescript? I used to be able to do it, but I cannot remember how to do so anymore!
Does this work?
tell application "System Events" to ?br />
set visible of first application process ?br />
whose frontmost is true to false
-- Rob
Carl V
05-11-2005, 10:41 PM
Does this work?
tell application "System Events" to ?br />
set visible of first application process ?br />
whose frontmost is true to false
-- Rob
Just what I wanted!
tell application "System Events" to set visible of process "Safari" to false
robot_guy
05-11-2005, 10:52 PM
An alternate approach, depending on what you're trying to do, would be to make all of an app's windows invisible; unlike with command-H, they'll stay invisible until your script tells them to become visible.
This script toggles visibility on and off for Safari windows. Note that the app itself is not hidden: you can still create new, visible windows while the existing ones are invisible.
In some applications (notably the Finder), open windows cannot be made invisible, but the script works with the other apps I tested (Safari, Mail, and iChat).
property notHidden : true
on run
if notHidden then
tell application "Safari" to set visible of every window to false
set notHidden to false
else
tell application "Safari" to set visible of every window to true
set notHidden to true
end if
end run
Carl V
05-11-2005, 11:09 PM
Thanks for the tip.
I have a backup program run every night at 6 automatically (to a server), and I was getting sick of the window popping up every night. A little applescript can go a long ways.
Paul Courtade
05-15-2005, 05:14 AM
I have used "Drop Script Backgrounder" to hide the running of any AppleScript.
When applied to an Applescript.app it keeps any Applescript.app running in the background. I believe it is freeware.
http://www.sentman.com/backgrounder/