PDA

View Full Version : Hide Terminal Window on Startup?


quantass
09-25-2009, 01:58 PM
I'm using OSX 10.5.8. I have a terminal script launching at startup and i want the launched window to be hidden on startup. I've already tried Accounts | Login Items | Hide but this has no affect on the launched file.

Any ideas on how to launch the simple batch file on startup but prevent the Terminal window from showing?

Tx

tlarkin
09-25-2009, 02:58 PM
well W is the key stroke to hide an application window from the Finder. I am sure you can Apple script the start up of your app/script with that key stroke executed right after.

trevor
09-25-2009, 03:24 PM
Command-W closes the application window without quitting the program, but if you actually want to hide the application window, that would be Command-H.

Trevor

quantass
09-25-2009, 03:28 PM
My script simply launches the Synergy client to connect with my PC. So you're saying i need to add COMMAND+W or H to the beginning of the script? What is the ascii equivalent of typing COMMAND+W or H ?

Here's the contents of my SynergyStartup file:

cd /Applications/synergy-1.3.1
synergyc -f 192.168.2.13

The file is set to be an executable. On startup launch, Terminal auto pops up and runs the lines.

I am a PC user so the workings of the OSX are still somewhat of a mystery.

Thanks for the assistance.

tlarkin
09-25-2009, 03:28 PM
Command-W closes the application window without quitting the program, but if you actually want to hide the application window, that would be Command-H.

Trevor

That is what I meant to put.....

Long night last night, and long day, and I didn't have any coffee

quantass
09-25-2009, 05:06 PM
I'm sorry. I'm still not clear on how to implement the COMMAND+H within my startup text file. Is there some special syntax for stating within the batch file to execute a hot key?

Again, all my text file has within it is:

cd /Applications/synergy-1.3.1
synergyc -f 192.168.2.13

I set the text file to be executable and launch it on startup. It opens a Terminal window and runs the contents. I 'm hoping to hide the window. If COMMAND+H can do this "automatically" by having it inserted in the text file then i'm game.

Thanks for clearing it up.

trevor
09-25-2009, 05:57 PM
There's assuredly a better and more efficient way to do it, but one way is to use the osascript command to execute an applescript. So, if the correct Applescript to hide something is:

tell application "System Events"
set visible of process "synergyc" to false
end tell

then I think that you could add that to a shell script by adding this to the end of your shell script:
osascript -e 'tell application "System Events"' -e 'set visible of process "synergyc" to false' -e 'end tell'

This is untested.

Trevor

quantass
09-26-2009, 05:31 PM
I wasn't able to test the provided script as the "synergyc" statement doesn't return allowing for the next line to execute.

Any clues around this?

Thanks for the assistance so far!