• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why doesn't this script work?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why doesn't this script work?


  • Subject: Re: Why doesn't this script work?
  • From: Christopher Nebel <email@hidden>
  • Date: Mon, 5 Nov 2007 09:14:53 -0800

On Nov 3, 2007, at 7:48 AM, Laine Lee wrote:

On 11/3/07 5:52 AM, "Mark J. Reed" <email@hidden> wrote:

On 11/2/07, Laine Lee <email@hidden> wrote:
OK, and why doesn't this script work?

[...]

do shell script tmpfile & space & "> /dev/null 2>&1 &"

I'm not sure, but if you get rid of the ">/dev/null 2>&1", you might receive a clue as to why it's not working. :)

Well, having since reviewed some of the release notes, I now see that I
don't need to quote quite so deeply if I want to execute a script file:


("...you can make a plain text AppleScript script into a Unix executable by
beginning it with the line #!/usr/bin/osascript and giving it execute
permission...").

As of Leopard, yes.

However, I was also able to construct this version of the original script,
which appears to do the job.


set dutydaemon to
"Dora:System:Library:LaunchDaemons:com.apple.backupd-auto.plist"
do shell script "chmod" & space & "a+w" & space & (quoted form of (POSIX
path of dutydaemon)) with administrator privileges
tell application "System Events"
tell property list file dutydaemon
set value of property list item 4 of it to 7200
end tell
end tell
do shell script "chmod" & space & "go-w" & space & (quoted form of (POSIX
path of dutydaemon)) with administrator privileges

That's equivalent to my original suggestion to Michelle -- change the permissions on the file. The reason your original didn't work is that the privileges of the executing script are not transmitted to applications that you "tell", such as System Events. execme may have been running as root, but System Events wasn't, and therefore did not have privileges to change that file.



--Chris Nebel AppleScript Engineering

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Re: Why doesn't this script work? (From: Laine Lee <email@hidden>)

  • Prev by Date: Re: QuickTime document file in Leopard
  • Next by Date: Re: AppleScript release notes released
  • Previous by thread: Re: Why doesn't this script work?
  • Next by thread: Bugs in 'automatic login' property of System Events
  • Index(es):
    • Date
    • Thread