Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Shell script & AppleScript

Shell script & AppleScript
Thread Tools
Fresh-Faced Recruit
Join Date: Apr 2001
Status: Offline
Reply With Quote
Apr 5, 2001, 12:33 PM
 
Hello
Is it possible to have a UNIX Shell Script that
calls for the execution of an AppleScript?
I tried to save the AppleScript as a MacOS X applet
but it does not work.
I am running MacOS X 10.0 on an iBook.
Thanks for any pointers.

Yorgos Kafkoulis
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Apr 5, 2001, 03:07 PM
 
You might like to investigate the osascript command. I'm sure there's been some discussion of it before, you might like to search the archives of this forum and the general discussion forum.
     
Fresh-Faced Recruit
Join Date: Apr 2001
Status: Offline
Reply With Quote
Apr 6, 2001, 08:16 AM
 
An update.
I was forced to use AppleScript in this case
since the cp command does not copy the resource fork of
a mac file (in HFS, HFS+).
However /Developer/Tools/CpMac does (thanks to Norman Lee for searching about it). So this solves my original problem.
The general problem of invoking an Applescript inside a unix shell
can be solved if someone knows how to execute in a terminal
a MacOS X applet, since the Applescript Editor allows you to save an AppleScript as an MacOS X applet.
Thanks again
Yorgos
     
mhencin
Guest
Status:
Reply With Quote
May 22, 2001, 11:43 PM
 
Angus,

I tired the osascript at the command line as follows

osascript scriptnamehere

and get the following error.

Syntax error -1750. Couldn't get error text because of error -1750.

I saved the applescript as a macox applet, and chose never show start upscreen.

If I can launch the script, and use cron, that would be sweet.

Any help is appreciated..

Mike
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
May 23, 2001, 02:58 PM
 
I'm not sure if you can use osascript with applets. Try a precompiled script file, or just a text script file.
     
mhencin
Guest
Status:
Reply With Quote
May 24, 2001, 09:24 AM
 
Angus,

Well, I read the man page again, and slower! Also got an email from the applescript guys. I was suprised how quick they replied.

I did get the osascript command to luanch my script. However I did need to use the full path to osascript, like "usr/bin/osascript"

This works fine. the scripts runs, I can tell becaue my classic app does what I then expect. Funny thing is I do not see the script application icon luanch in the dock. Oh well, it works I won't complain.

Mike
     
Fresh-Faced Recruit
Join Date: Jan 2001
Location: North Andover, MA, USA
Status: Offline
Reply With Quote
Sep 5, 2001, 08:35 AM
 
Originally posted by mhencin
:
<STRONG>

If I can launch the script, and use cron, that would be sweet.

</STRONG>
You can launch any program (Classic, Carbon or Cocoa) and open any folder in the finder by using the command "open"

here is the syntax:
open [ -a app ] [ -o ] [ -p ] filename ...

You can do "man open" to get more information. if all you want to do is launch your script that was saved as an applet simply type:

open scriptpath
ex. open /Users/admin/scripts/myscript
     
Fresh-Faced Recruit
Join Date: Jul 2001
Location: Rehoboth Beach DE
Status: Offline
Reply With Quote
Sep 5, 2001, 01:48 PM
 
mhencin,what is the e-mail of the applescript guys,I need to ask them a few questions.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:56 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2