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

Fwd: How do I set folder action in Yosemite, please?


  • Subject: Fwd: How do I set folder action in Yosemite, please?
  • From: Brian Christmas <email@hidden>
  • Date: Mon, 01 Dec 2014 14:11:24 +1100



G’day scripters

Thanks to Yvan, I’ve solved my problem.

However, two thing arose from trying to use Yvans MacScripter posting, and also merging ‘attach action’, which I posted....

1. If the ‘attach action’ is called more than once on a given folder, a second, third, fourth, etc, attachment is made. The command does not check that it’s already attached.

2. Yvans script did not restrict itself to folders within another folder, but was a 'blanket’ approach.

So, if you’re interested, this version restricts to a given folder, and checks if the Folder Action is already attached.

If anyone can spot any problems with the code, I’d appreciate knowing about it, please.

Regards

Santa

on run
set path2DesktopftpDownloadsFolder to ((path to desktop) & "ftp Downloads") as text # Our required Folder Actions folders container folder
set path2FolderActionsScriptsFolder to (path to Folder Action scripts folder) as text
tell application "Finder" to set everyftpDownloadsFolder to every folder of folder path2DesktopftpDownloadsFolder as list
tell application "System Events"
set p to 0
set folder actions enabled to true
set FolderActionNames to name of every folder action
set FolderActionPaths to path of every folder action
repeat with i from 1 to count FolderActionPaths
set item i of FolderActionPaths to item i of FolderActionPaths as text
end repeat
repeat with theFolderAction from 1 to count of everyftpDownloadsFolder
try
set eachFolderPath to item theFolderAction of everyftpDownloadsFolder as alias as text
set foundMatchingAction to false
set p to 1
if (count FolderActionPaths) > 0 then
set FAScripts to name of every script of folder action theFolderAction
else
set FAScripts to {}
end if
set p to 6
if "ftp Downloader.scpt" is not in FAScripts then
set p to 7
attach action to folder eachFolderPath using ((path2FolderActionsScriptsFolder & "ftp Downloader.scpt") as text)
end if
if foundMatchingAction then
set p to 10
if enabled of folder action eachAction is false then
set enabled of folder action eachAction to true
end if
end if
on error errmsg
display dialog "Setting Folder Action for 'ftp Downloads' folder folders. " & return & return & errmsg & "  p = " & p
end try
end repeat
end tell
 end run

 _______________________________________________
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: How do I set folder action in Yosemite, please? (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: [rant] "Never mind the quality, feel the width!"
  • Next by Date: Re: [rant] "Never mind the quality, feel the width!"
  • Previous by thread: Re: How do I set folder action in Yosemite, please?
  • Next by thread: Re: How do I set folder action in Yosemite, please?
  • Index(es):
    • Date
    • Thread