• 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 do I set folder action in Yosemite, please?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I set folder action in Yosemite, please?


  • Subject: How do I set folder action in Yosemite, please?
  • From: Brian Christmas <email@hidden>
  • Date: Sat, 29 Nov 2014 17:09:37 +1100

G’day scripters

I’m trying to automate the attachment of a folder action to a group of folders. A condensed script is attached, but I cannot get the terminology correct. Can anyone guide me on this please?

Regards

Santa


property FolderName : "ftp Downloads"

# The Folder Action script name
property ScriptName : "ftp Downloader.scpt"

property ActionFlag : true
set path2DesktopftpDownloadsFolder to ((path to desktop) & FolderName) as text
set path2FolderActionsScriptsFolder to (path to Folder Action scripts folder) as text
tell application "Finder" to set TempList to folders of folder path2DesktopftpDownloadsFolder as list
set p2me to path to me
tell application "Finder" to set path2ContainerOfMe to container of (path to me) as text
set saveFolderAction to (path2ContainerOfMe & ScriptName) as text
(*
# Check if old version exists, is so, trash it, then renew.
tell application "Finder"
if exists file saveFolderAction then
if exists file ((path2FolderActionsScriptsFolder & ScriptName) as text) then
move file ScriptName of folder path2FolderActionsScriptsFolder to trash
else
set FoundFlag to true # not installed, so set up to strip references to old ones if they exist
end if
copy file saveFolderAction to folder path2FolderActionsScriptsFolder
end if
end tell
*)
tell application "System Events"
set folder actions enabled to true
# This fails
# enable folder action (path2FolderActionsScriptsFolder & ScriptName)
# This fails
# enable folder action ScriptName
repeat with EachFolder in TempList
try
# This worked under Lion, but not Yosemite, now generates "can't make (alias path) into type specifier"
attach action to (EachFolder as alias) using ((path2FolderActionsScriptsFolder & ScriptName) as text)


# This doesn't work, and generates an error
tell (EachFolder as alias) to enable folder action ScriptName
# This doesn't work, and generates an error
tell (EachFolder as alias) to enable folder action (path2FolderActionsScriptsFolder & ScriptName)
set theCounter to theCounter + 1
on error errmsg
display dialog errmsg
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 do I set folder action in Yosemite, please?
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Re: Why is my code so slow
  • Next by Date: Re: Why is my code so slow
  • Previous by thread: Re: Why is my code so slow
  • Next by thread: Re: How do I set folder action in Yosemite, please?
  • Index(es):
    • Date
    • Thread