[X-Unix] Using AppleScript to Start Apps... Hidden

Bill White billwhite at mac.com
Fri Nov 11 09:30:29 PST 2005


On 11/11/05 12:18 PM, Larry Helms <lhelms at sonic.net> wrote:

> Does anyone know how, using Apple Script, to 'Hide' a running application...
> Either when it's launched, or after it's running?
> 
> Essentially, I'm re-working my the login-items.  I don't like how Apple
> starts up everything all at once... And want to put delays between certain
> apps.  But... I do like how the login-items has the 'Hide' button and want
> to do that in my new Apple Script.
> 
> Thanks in Advance for the help...
> 
> Larr.
> __________
> on run
>     tell application "Entourage-X"
>         activate
>     end tell
>     
>     delay 4
>     
>     tell application "Spamfire1.6"
>         activate
>     end tell
>     
>     delay 2
>     
>     tell application "SETI at home_OSX"
>         activate
>     end tell
> end run

It's not really a Unix topic, but the answer's easy enough. Use System
Events to set a process's visibility to false. Also, in AppleScript,
"activate" (as used above) causes the app to come to the front, while
"launch" keeps it in the background; launching some apps will keep them
hidden by default, like Photoshop.

Try the following:

on run
    
    set myProcesses to {"Entourage-X", "Spamfire1.6", " SETI at home_OSX"}
    
    repeat with aProcess in myProcesses
        
        tell application aProcess to launch
        
        tell application "System Events"
            
            repeat until exists process aProcess
            end repeat
            
            set visible of process aProcess to false
            
        end tell
        
    end repeat
    
end run

HTH,

-- Bill




More information about the X-Unix mailing list