• 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: Folder Action for changing privileges
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Folder Action for changing privileges


  • Subject: Re: Folder Action for changing privileges
  • From: Brett Conlon <email@hidden>
  • Date: Mon, 2 Jul 2007 12:32:18 +1100


Many thanks for responding, J.

Unfortunately it didn't fix my issue.

In fact I have done further testing and the script below fails on my computer (10.4.9) and 2 other 10.4 systems in the studio (10.4.7 & 10.4.8) but using the same script on the three 10.3.9 users I tried, it works fine! So it appears to be a 10.4.x issue - tighter restrictions on setting privileges or just a bug???

To see if it was processing all of the repeat I added the beep after the shell script and I get no beep on the 10.4 Macs but the success dialog shows... weird! On the 10.3 Macs the beep happens, the success dialog appears and the permissions are changed correctly.

on adding folder items to theFolder after receiving theAddedItems
        try
                repeat with ThisItem in theAddedItems
                        log ThisItem
                        set FilePath to quoted form of POSIX path of (contents of ThisItem)
                        beep
                        do shell script "chmod -R 777 " & FilePath
                end repeat
                display dialog "Permissions changed successfully." buttons {"Thanks!"} default button 1
        on error
                display dialog "Changing permissions failed. Please try it manually" buttons {"OK"} default button 1
        end try
end adding folder items to

Could someone on a 10.4 setup please try this so I know if it is something specific to our setups?

Ta muchly,

Brett



"J. Stewart" <email@hidden>
Sent by: applescript-users-bounces+brett.conlon=email@hidden

29/06/07 06:53 PM

To
email@hidden
cc
Subject
Re: Folder Action for changing privileges





On 6/29/07 at 2:45 AM, Brett Conlon <email@hidden>
spake thusly:

>repeat with thisItem in theAddedItems set FilePath to quoted
>form of POSIX path of thisItem do shell script "chmod -R 777 "
>& FilePath end repeat

You may be getting bitten by a long standing gotcha of repeating
by reference. Try this instead (I didn't test).

  repeat with thisItem in theAddedItems
   set FilePath to quoted form of POSIX path of (contents of thisItem)
   do shell script "chmod -R 777 " & FilePath
  end repeat


When you loop using the above form what you are really getting
when you refer to "thisItem' is "item x of theAddedItems" and
not a file path. The addition of "contents of" to the script
forces it to resolve the reference into the actual file path it contains.



JBS
--
It is inaccurate to say I hate eveything. I am strongly in favor
of common sense, common honesty, and common decency. This makes
me forever ineligible for any public office.  - HL Mencken
_______________________________________________
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


 _______________________________________________
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

  • Follow-Ups:
    • Re: Folder Action for changing privileges
      • From: Brett Conlon <email@hidden>
  • Next by Date: Re: Rép : Folder Action for changing privileges
  • Next by thread: Re: Folder Action for changing privileges
  • Index(es):
    • Date
    • Thread