The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - Newcomers (http://hintsforums.macworld.com/forumdisplay.php?f=15)
-   -   Opening an app on a remote machine (http://hintsforums.macworld.com/showthread.php?t=24425)

lgrw3919 06-03-2004 04:46 PM

Opening an app on a remote machine
 
i was wondering if there is any UNIX command that would open an applicatioin on a remote machine (although the machine will be on my lan).

yellow 06-03-2004 04:58 PM

Sort of.. log into the remote machine and type:

open /Path/To/Application

But in order to have it work, you must be the same user as whomever is currently logged in on the remote machine. By that I mean, doing a 'whoami', the returned value (username) must match the username of the person who is currently logged into the remote Mac. Otherwise it won't work.

lgrw3919 06-03-2004 06:07 PM

how might i log in to the remote machine? ssh?

yellow 06-03-2004 07:49 PM

Nope, you have to be logged in to the GUI.

Clarification:

You have 2 Macs. 1 Local, 1 Remote. Say you want to start an Aqua app on the remote Mac (an app that requires the Aqua GUI in order to be displayed, like Safari for example) from your local Mac. Before you even bother sshing to the remote Mac, you (your user) MUST be logged into that remote Mac, as if you sat down at it and logged in. OR, after you have ssh'd into the remote Mac, you MUST be able to switch the shell to be 'owned' by the user that is currently logged in, which means you need to know their password. If you cannot meat either of those requirements, you cannot open an application that requires the Aqua GUI on the remote Mac.

GSGM 06-07-2004 10:40 AM

Running remote app locally
 
Now, if you want to run an application that is stored on a remote machine on your local machine, all you would need to do is use the "Connect to Server" command in your local machines finder. Once the remote machine's hard drive has mounted, you should be able to navigate and lauch any application that you have permissions to.

Note: this does require that you have a valid login to the remote machine, but does not require you to have a GUI launched (be logged in there too!) on the remote machine.

lgrw3919 06-07-2004 08:21 PM

thanks but that's not quite looking for...

when i tried logging into the remote machine, something weird happened. i had even created an identical user of the remote machine's user on my computer, to make sure everything would go fine. i tried SSHing into the the computer via the terminal. i had the same username as the one (logged in) on the remote machine. when putting in the password to the other user i was denied access. so i checked up on the system preferences on the remote machine, but i had remote login checked. again and again i was denied access when i had the same username, same password as the remote user. what's happening?

hayne 06-07-2004 10:20 PM

Your username and password on the local machine are not relevant when using ssh. You merely need to specify the name of the remote account by using the "-l" option (that's a lowercase L) and you give the password when prompted for it.

What command (in Terminal) are you using and what happens?

lgrw3919 06-08-2004 07:05 PM

so for when i try this at home, what will the line of command look like when i place it in the terminal?

yellow 06-08-2004 07:11 PM

You must be logged into the remote Mac. I don't mean ssh'd in, I mean that you must sit down at it and login (unless you use Timbuktu or something, where sitting is not required, and which would make all this pointless). Then on your home Mac, ssh into the remote Mac.

Code:

ssh -l youruserontheremotemac ip.address.oftheremote.mac
OR

Code:

ssh youruserontheremotemac@ipaddress.oftheremote.mac
Then type:

Code:

open /Path/To/Applications/you_want_to_open

Gnarlodious 06-08-2004 09:31 PM

Applescript
 
I just say:

ignoring application responses
tell application "Entourage" of machine "eppc://Gnarlodious-Cube.local" to quit
end ignoring



For this to work you need to have "Remote Apple Events" enabled in the Sharing Prefpanel. Starting an app should be the same as quitting it.

Keep in mind there are two names for some applications, for example this script needs "Entourage" but the official name is "Microsoft Entourage". Apple says they will fix it soon, but meanwhile just stab around.


-- Gnarlie's Applescript page
http://www.Gnarlodious.com/Mac/AppleScript/Page.html

lgrw3919 06-10-2004 12:37 AM

is there a close or quit command, to end the program?

Gnarlodious 06-10-2004 01:29 AM

The script I offered quits Entourage so I can synchronize the database.
There is a way to launch applications too but I don't know the terminology. If you figure it out please post it here!

acme.mail.order 06-10-2004 01:38 AM

if you really want to do it in applescript:

tell application "Finder" to launch application "Entourage"

lgrw3919 06-10-2004 01:46 AM

closing an application with the terminal
 
to close an app in the terminal type: osascript -e 'tell application "app name" to quit'

ex: osascript -e 'tell application "Mail" to quit'

i found this excellent advice in this thread.

Gnarlodious 06-10-2004 02:21 AM

Open a remote application
 
Ha! got it:


tell application "Finder" of machine "eppc://Gnarlodious-TiBook.local" to open ":Applications:iTunes"


I guess it's necessary to send the path to the file to open. If you don't the local app opens.

Strange.

loren_ryter 11-06-2005 03:52 PM

Me too
 
I'm having problems with this too.

I can't open the remote application via applescript. The chief problem is I can't get a path to the remote application, only to the local one. This fails with an error:

using terms from application "Finder"
tell application "Finder" of machine remotemachine
set theprocs to the name of every process
if "DevonThink Pro" is not in theprocs then
---open application "DEVONthink Pro"
---tell application "DEVONthink Pro" of machine remotemachine to open

set tp to path to (application "DEVONThink Pro" of machine remotemachine)
end if
end tell

end using terms from

set result to tp

loren_ryter 11-06-2005 03:56 PM

Quote:

Originally Posted by Gnarlodious
Ha! got it:


tell application "Finder" of machine "eppc://Gnarlodious-TiBook.local" to open ":Applications:iTunes"


I guess it's necessary to send the path to the file to open. If you don't the local app opens.

Strange.

This won't work if you don't know the path -- and I can't get it.

Gnarlodious 11-06-2005 04:45 PM

eppc now working in 10.4.3...
 
What do you mean you can't get the path? The path to the app you want to open?

I tried this just now and it's working:
Code:

tell application "Finder" of machine "eppc://Gnarlodious-Cube.local" to open ":Applications:iTunes"
Presto! It works from my 10.4.3 machine to my 10.3.9 machine but not the other way.
Wonder when they fixed it. Or at least, half fixed it.

loren_ryter 11-06-2005 05:07 PM

yes, I an't get the path to the app I want to open on the remote machine. of course i know the path, but I'm writing a studio application, and i have to have the remote finder GET the path somehow. unfortunately in the examples I cited the remote finder apparently mistakenly gets the path to the local version of the application i want to open with set tp to path to....

Gnarlodious 11-06-2005 08:17 PM

What versions OS are you running?

loren_ryter 11-06-2005 09:45 PM

Quote:

Originally Posted by Gnarlodious
What versions OS are you running?

now 10.4.3

Gnarlodious 11-06-2005 10:02 PM

Is "Remote Apple Events" enabled in the Sharing Prefpanel?

loren_ryter 11-07-2005 01:22 PM

Quote:

Originally Posted by Gnarlodious
Is "Remote Apple Events" enabled in the Sharing Prefpanel?

yes of course.

try this:
move an application to a different location on a remote mac than the same application is on on your local mac.

set remotemachine to "eppc://your.remote.mac.local"

using terms from application "finder"
tell application "finder" of machine remotemachine
set tp to path to (application "YOUR_MOVED_APPLICATION")
end tell
end using terms from

my guess is you'll also get the path to the local rather than the remote copy of the application.

loren_ryter 11-09-2005 10:39 AM

I found the syntax that works:

open (application file id "XXXX" as alias)
-- xxxx is the creator code


All times are GMT -5. The time now is 10:35 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.