• 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
How to check and set a folders folder action?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to check and set a folders folder action?


  • Subject: How to check and set a folders folder action?
  • From: Brian Christmas <email@hidden>
  • Date: Tue, 09 Oct 2012 00:44:15 +1100

G'day scripters

I'm trying to automate the process of adding Folder action scripts to a multitude of folders.

I can set the Folder Action Scripts, but want to check (and offer to reset) any action that is turned off.

I can't get the scripting right to get the enabled of each Folder Action, nor how to set the enabled.

Anyone know how please.

Regards

Santa

set p2ftpDownloads to ((path to desktop) & "ftp Downloads") as text
set p2me to path to of me
tell application "Finder" to set p2cofme to container of (path to me) as text
set p2FAS to (path to Folder Action scripts folder) as text

set saveFolderAction to (p2cofme & "ftp Downloader.scpt") as text
try
tell application "Finder"
if exists file ((p2FAS & "ftp Downloader.scpt") as text) then
move file "ftp Downloader.scpt" of folder p2FAS to trash
end if
copy file saveFolderAction to folder p2FAS # 'with replacing' not allowed 
end tell
on error errmsg
display dialog errmsg
end try

tell application "Finder"
set TempList to folders of folder p2ftpDownloads as list
end tell
tell application "System Events"
set folder actions enabled to true
repeat with eachFolder in TempList
try
attach action to (eachFolder as alias) using ((p2FAS & "ftp Downloader.scpt") as text) # works
say name of eachFolder as text
on error errmsg number errNum
if errNum = -48 then -- Folder action already exists, but is it active?
if not (folder action "ftp Downloader.scpt" of eachFolder is enabled) then # ??????
--set enabled of eachFolder's folder action (("ftp Downloader.scpt") as text) to true
end if
end if
display dialog errmsg & return & errNum
end try
end repeat
end tell
 _______________________________________________
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: How to check and set a folders folder action?
      • From: "koenig.yvan" <email@hidden>
    • Re: How to check and set a folders folder action?
      • From: Alex Zavatone <email@hidden>
  • Prev by Date: Re: AppleScript-Users Digest, Vol 9, Issue 400
  • Next by Date: Re: How to check and set a folders folder action?
  • Previous by thread: Re: AppleScript-Users Digest, Vol 9, Issue 400
  • Next by thread: Re: How to check and set a folders folder action?
  • Index(es):
    • Date
    • Thread