Re: OSX Coding Help
Re: OSX Coding Help
- Subject: Re: OSX Coding Help
- From: Nigel Smith <email@hidden>
- Date: Fri, 27 Jun 2003 17:44:17 +0100
On 27/6/03 15:55, "Jeff Grossman" <email@hidden> wrote:
>
If I remove the beginning part which deletes
>
the existing files the script will run fine via cron. If I add back in the
>
part about deleting files, the script will not run via cron. Is it not
>
possible to do what I want with Applescript and cron?
It's a security feature that seperates out root processes (cron) and user
processes (the Finder) -- I guess the rest works because the server daemons
are running in the root process space.
A previous post from Chris Nebel explains this better than I ever could --
see later.
One way round it would be to do the file deletion as shell script steps:
do shell script "rm -f path_to_file"
You don't even need to test for the file, or empty the trash. But there's no
going back afterwards!
Since all the files end with "Addresses", if they are the only files ending
in that way in that folder you could even do it in one step:
do shell script "rm -f path_to_enclosing_folder/*Addresses"
HTH,
Nigel
_________
Here's Chris Nebel's original message:
>
>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.
>
>
It's not clear what the truly correct solution is here -- there are
>
valid security reasons for keeping the process group restrictions in
>
place. In the meantime, what can you do? Well, scripting additions
>
should still work, so you can use those. cron unfortunately makes
>
sure that only one instance of cron is ever running at once, so you
>
can't launch your own personal cron, though if you're feeling extra
>
studly, you could get the source for cron (it is open, after all)
>
and modify it appropriately.
>
>
>
--Chris Nebel
>
AppleScript Engineering
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.