Bringing apps to front in Finder via SSH?

Gwailo

B.A. Economics (Hon)
I was just wondering, is it possible to hide or to bring to front (activate) applications in the Finder via SSH?

This dawns on me simply because I understand the foremost application is given more processing time by the kernel, and I've got Fold@Home going but in the background--wanted to pull it forward.

Cheers!
 
I believe the foreground app is no longer given more CPU cycles. I think that was just in OS 9, to 'camouflage' the fact that it lacked proper multitasking.

Anyway, unless you've got a foreground app doing something to actively eat up cycles, a CPU-hungry background app would get all the CPU anyway. If the foreground app is just sitting there waiting for someone to click a button, it wouldn't use any cycles, even if it was given first dibs.
 
You can put a window in front using SSH by making a textfile with pico or whatever you like that contains

Code:
Tell Application "[i]applicationname[/i]" to activate

where applicationname is the name of your application (like "Finder" or "Adobe Photoshop" - then you save the file and use the command

Code:
osascript [i]savedfilename[/i]

This will run the saved applescript and should put your desired application frontmost!

Hope this helps!
 
Then put it all together:
Code:
#!/bin/sh
osascript -e "tell application \"$*\" to activate"
Save that to /usr/local/bin/bringfront (for example), chmod it to 755, and you can run
Code:
bringfront Project Builder
bringfront Finder
 
Also, check out a command line utility called 'launch', it might be useful for you. I have installed it via Fink.


dani++
 
Back
Top