Hi,
I have read that “run script” can not be used with OSX 10.4 when trying to run a script on a remote machine. Of course I have tried it and I get “… does not understand run script”. I need to run a script on a remote machine and pass arguments to it. How are others doing this with OSX 10.4?
Adam, I think, we’re talking about two different things.
I mentioned, it’s possible to talk to applications on remote machines,
but I don’t know, whether it’s possible to run scripts on remote machines
via the run script command
Hi,
According to what I have read targeting applications that are already running is not a problem but wanting to run a script is. I have an applescript running on one machine that transfers files to a File server. Once the files are transferred this applescript needs to pass, as parameters a path and a folder name, to an applescript on another machine which runs Photoshop. Starting the script seems to be my sticking point.
This was my last attempt. I thought I would try the osascript command but I have tried numerous other options like run script, etc…
This is the scrip which is calling the remote machine. I hardcoded the parameters for testing.
set custFiles to "44444_TestScript_0140"
set destinPath to "/X_DMSjobs/LiveJobs/NORTH_BRUNSWICK/"
-- variables - Paths
local remoteMachine
set remoteMachine to "eppc://adminuser:dmsHub@172.20.115.184"
tell application "Finder" of machine remoteMachine
using terms from application "Finder"
local remoteScript
set remoteScript to "BootX:Users:Shared:bin:AdobeAutomate:ProcessFiles.scpt"
tell remoteScript to set custFileList to custFiles
tell remoteScript to set destinationPath to destinPath
do shell script "osascript /Users/Shared/bin/AdobeAutomate/ProcessFiles.scpt"
end using terms from
end tell
This is the script on the machine running photoshop. The script works if launched locally with the parameters supplied
on run {custFileList, destinationPath}
-- local variables
local currentFolder
local linkArtPath
local linkArtReturn
local logFilePath
if (count of custFileList) > 0 then
repeat with n from 1 to number of items in custFileList
set currentFolder to item n of custFileList
-- need to extract the info for this folder -custName, jobNo, opCode
my collectCustomerFolders(currentFolder)
-- path to move the finished files back into
set linkArtReturn to destinationPath & custName & "/" & jobNo & "/LinkArt/"
-- create our from path
set linkArtPath to destinationPath & custName & "/" & jobNo & "/LinkArt/TempArt/"
-- create the path to the log file
set logFilePath to destinationPath & custName & "/" & jobNo & "/" & custName & "-" & jobNo & ".log"
try
-- process and resave all photoshop files
tell application "Adobe Photoshop CS2"
set scriptFile to ¬
"Home:Users:rsweeny:Documents:SVN_Code:Applescript:bin:AdobeAutomate:ProcessPhotoFiles.jsx" as alias
do javascript scriptFile with arguments {custName, jobNo, linkArtPath, logFilePath}
end tell
on error
display dialog "Error calling Remote Photoshop Server!"
end try
-- move the files back to the original LinkArt folder
my returnFinishedFiles(linkArtPath, linkArtReturn)
end repeat
end if
I just thought I would post how I got around this. I searched high and low and found no way to really get this to work. All files being edited are on a File Server. I wrote my parameters out to a file on the server drive called .ParameterList.txt. The “.” kept the file hidden to any users using the server. Then I launch the script on the remote machine which is also using the same server with the osascript command: do shell script “osascript /Users/Shared/bin/AdobeAutomate/ProcessFiles.scpt”
From this script I am opening the .ParameterList.txt file and reading in my parameters.
It seems like a long way around but I really couldn’t find any other way to luanch a script on a remote machine and pass paramters (variables) to it. I could pass a value to a script and it would work but I could not pass a variable to a script.
Just thought I would pass this on in case anyone is interested.
Rich