Re: The sick power!
Re: The sick power!
- Subject: Re: The sick power!
- From: "Donald S. Hall" <email@hidden>
- Date: Fri, 07 Dec 2001 23:23:44 -0700
There was a related discussion about this in the Applescript Users Mailing
list about 3 weeks ago:
>
At 10:11 AM -0800 11/13/01, Christopher Nebel wrote:
>
> On Monday, November 12, 2001, at 09:54 PM, Gary Beberman wrote:
>
>
>
>> I am trying to make a script run automatically in OS X 10.1 using
>
>> crontab. Whenever I do, the script starts. And I immediately get
>
>> an error dialog telling me:
>
>>
>
>> "Application isn't running"
>
>>
>
>> The strange thing is that the application is running. Even this
>
>> simple script trips
>
>>
>
>> tell application "Finder"
>
>> open file "OS X:Users:Shared:somefile"
>
>> end tell
>
>>
>
>> And the stranger thing is that I can run the script from within
>
>> Terminal just fine. If, from the comand line, I call the script
>
>> the same way I call it in crontab, it runs perfectly.
>
>>
>
>> What's different in crontab? What can I do about it to get my
>
>> Applescripts to run?
>
>
>
> You're seeing a security "feature." It has to do with Mach
>
> messages, which form the guts of Apple Events on Mac OS X. For
>
> security reasons, processes in Mach are segregated into "process
>
> groups", and a process in one group is not allowed to send messages
>
> to a process in a different group. Because cron gets launched at
>
> boot time, it's in root's process group, while every application
>
> launched by your login (including the Finder) is in your process
>
> group. Therefore, a script run by cron can't talk to any
>
> application that you launched.
>
>
>
> There's something of a bug in AppleScript here, too -- at its level,
>
> it can see the application, so it tells the Apple Event Manager to
>
> send it a message, and you get a surprising error.
>
>
----------------------------------------------------------------------------
>
Ack, at 12/7/01, Ondra Cada said:
>
>
> Rosyna,
>
>
>
>>>>>>> Rosyna (R) wrote at Fri, 7 Dec 2001 14:29:52 -0700:
>
> R> You bring an interesting point up. However, I am not sure how'd you
>
> R> exploit it through applescript. AppleScript can only do what the
>
> R> application can do through its GUI. So you have no real power that
>
> R> the GUI doesn't have.
>
>
>
> Well, any app which can save can be pretty disastrous through its
>
> GUI, can't it?
>
>
>
> R> Sending this to an instance of BBEdit running as root causes
>
> R> LaunchCFMApp to crash:
>
>
>
> I presume it works well if BBEdit runs non-root, right?
>
>
Hmm, no it doesn't. So this is inconclusive. However, making an
>
application launch through a root application does not work either:
>
>
tell application "NetInfo Manager"
>
set blah to path to application "Terminal"
>
set blah to blah & "Contents:MacOS:Terminal"
>
tell application blah
>
--activate
>
end tell
>
end tell
>
display dialog (blah as string)
--
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
http://www.theboss.net/appsmore
email@hidden