System Events create Folder Actions stop suddenly
Hello
I has implemented a applescript in order to backup files to a external HD using folder actions
This script attaches the same script in each new folder recusively, and it adds a new one Folder Action with the same name of the folder.
1 - When a use the Finder to copy around 4000 files and 500 folder, the folder action list increases slowly, but i did not had so much patience to wait the proceeding to complete.
2- When i use the automator with shell script action execution, to copy the files and folder, the process finalizes with success, but the folder action list stops with 10 items instead of 569, that is the number of folders and subfolders. So i do not know what is happening...
3- So I changed the automator action to execute a applescript that executes a shell script, the folder action list stops with 200 folder action approximately. So i do not know what happen too.
What can i solve this backwardness problem?
There are a limit of amount to create of folder action ?
There are another user with tha same problems: BookOfPower
https://discussions.apple.com/thread/1233099?start=15&tstart=0
Because applescript is not reliable ?
Similar Messages
-
Create folder action in automator
I want to create a folder action that will move downloaded website backups into a specific folder.
I cribbed the automator folder action shown below from Macworld
The Folder Action appears not to work when left to just monitor the folder.
However, if I force the Action to run from within automator it works, albeit with an error message at the beginning saying that you can't execute the action from within Automator. Still it finds the file and moves it to the intended destination.
By way of checking this I looked at the "Set Up Folder Action" by right clicking on the downloads folder. After clicking there is a long delay but when the panel opens there is no content, see second image below. I tried clicking the + button to add the "Downloads" folder but after a long delay the "Open" dialog closes and nothing has appeared in the panel. I assume that any folder action should show up in this panel, but I've no experience in using it.
Any suggestions as to a problem with the Action or why the panel is blank and why I can't attach the Action using this setup panel?
Thanks
Folder Action
Note: Path and File have been omitted.
Note: OS X 10.10.2
Folder Action SetupI'm confused. You showed two Automator actions with the same name, one was a folder action one wasn't.
Are you sure the correct Automator action (the one that is a folder action) is attached to the folder?
If when the Folders Action setup window is opened and you select Articles_Folder.workflow and then edit script are you getting the right workflow?
Assuming you do I would start off very simply. Try this:
It will label green screen shot image files saved to the Desktop.
See if this works for you. -
Hi, my system runs on windows 8 on hp laptop envy series. All of a sudden, system event log on service stopped, errors which prevented the system to log on services. It displayed error of STOP 0xC000021A when i use system restore to roll back to previous
configuration. Also when I tried to refresh my pc, it says i can't do changes as log in was switched to prevent the changes by notification.I don't know what to do next, I tried to put recovery dvds which I made when system was bought, now not at all working.
Internet is not active, not able to resolve by trouble shooting and system taking lot of time to get dsktop. Previously I used to get my desktop in 10 seconds. Now its 10 min. May be I m infected with virus. My files, they are there. I tried to transfer some
files by pendrive to another system, now the new system(where i put my files in another system) crashed, windows 7 system which does not display desktop, icons etc and not at all workable.
Also in my hp system, i m unable to open control panel. if its opened, it will not go off, when i use task manager, it says explorer and shuts down. I had to force restart the system. Please resolve something to get my hp laptop workable. I m waiting for
my MS thesis to be working on that. My files are locked and no way to transfer, I fear of infected by virus to another computer also.
Pls give instructions to hw to set my hp laptop at the earliest without losing any of the files. Idon't want to reinstall and lose all the data for timebeing. Else, inform me the option for copying data safely. I tried to change the adv startup and recovery
by changing the boot sequence by DVD but this also shows error 0xC000021A and asks us to see the details. I didn't understand all this. Pls help asap.
Thanks
venkata
STOP 0xC000021AMV
If you can boot either from the win 8 dvd or in safe mode we need the DMP files
We do need the actual DMP file as it contains the only record of the sequence of events leading up to the crash, what drivers were loaded, and what was responsible.
WE NEED AT LEAST TWO DMP FILES TO SPOT TRENDS AND CONFIRM THE DIAGNOSIS.
Please follow our instructions for finding and uploading the files we need to help you fix your computer. They can be found here
If you have any questions about the procedure please ask
Wanikiya and Dyami--Team Zigzag -
Automatically Attach Folder Action
Is there a way to tell the OS to attach a folder action when the folder is created?
I do not want to see the window sidebar, never, and I do not want to hide it each time I create a new folder. A very simple folder action does the job, but then it must be attached to the folder... and I would want to see this action automatically attached. The folder action could be as simple as that:
on opening folder this_folder
tell application "Finder"
set the sidebar width of the window of this_folder to 0
end tell
end opening folder
BTW, I didn't find any global variable that I could modify to do this in a simpler fashion.
Not being an AppleScript expert and by far, I am kind of stuck...
G5 1.8Dual, 2GB RAM Mac OS X (10.4.8) 20" App Dsplay, ext. Lacie, iPod, Bach on Al-Lansing, Canon 5D, Canon L glass... and it works!!!
I will give you a "Solved on this", Budgie! This AppleScript language is pretty amazing when you know how to use it.
I had to make some modifs, because it stopped working when the action was already attached to some folders, and this caused major problems. I will also have to work on it to optimize it, i.e. for example attach the action when a folder is opened (if it's not already attached) in order to save time, because in its present state, the script attaches the action to each folder in the target window.. But the main difficulty was to attach an action automatically!
So now both scripts are in my own User library and look like this:
Script to attach action, most of it your code :-)
on adding folder items to this_folder
try
tell application "Finder"
set _Script to "LaBomba:Users:rgauthier:Library:Scripts:Folder Action Scripts:nosidebar.scpt"
repeat with each_folder in (get every folder of this_folder)
tell application "System Events"
try
attach action to (each_folder as alias) using (_Script as alias)
end try
end tell
end repeat
end tell
end try
end adding folder items to
... and my own very simple folder action:
on opening folder this_folder
tell application "Finder"
set the sidebar width of the window of this_folder to 0
end tell
end opening folder
I will come back to you in a day or two (or three, time is whort...) with my final code.
Thanks once again for a fast and precise answer!
RTP
G5 1.8Dual, 2GB RAM Mac OS X (10.4.8) 20" App Dsplay, ext. Lacie, iPod, Bach on Al-Lansing, Canon 5D, Canon L glass -
Folder Actions script no longer runs on new file creation
Hope this isn't trivial.......first time posting here...hopefully in the right place.I'm not a total Mac OS X newbie...and surely no techie, either. Dabbled a wee bit with Automator and scratchin' my head on this one. Help, please!
Any idea why folder actions not running when a new file is saved? A simple add-color-label script created in Automator was workin' fine before I did a Snow Leopard-to-Leopard downgrade clean-install & account migration from external HD (TimeMachine) backup. Folder actions are enabled and script runs only if I start it with Automator Runner. Previously, it would label the file as soon as I saved it....now it needs a manual start. Is this default behavior in Leopard? Or am I missing something or doin' something wrong? Or is this a consequence of downgrade? I was sure I had the same script workin ok in my original Leopard install - though possibly un-modified at that time.
I have no clue why, but the new version I created recently (cpl wks ago?)worked the first time I added a new file but not thereafter...and in that instance it only labelled the file in Finder upon quitting Preview (file is a Grab saved as pdf).
The reason for the downgrade was compatibility problems with Photoshop CS4 on SL (OS & app all updated yet crashin' at the drop of a hat) - maybe due to lack of RAM? (only 1GB). Saw quite a few posts regarding SL running CS4 problems, so now I'm back to running 10.5.8 ..again.. and PS actually runs smooth like it did before.
Maybe these console messages are a help......or am I barkin' up the wrong tree?
6/11/11 7:44:54 PM /System/Library/CoreServices/Folder Actions Dispatcher.app/Contents/MacOS/Folder Actions Dispatcher[91] CPSGetProcessInfo(): This call is deprecated and should not be called anymore.
6/11/11 7:44:54 PM /System/Library/CoreServices/Folder Actions Dispatcher.app/Contents/MacOS/Folder Actions Dispatcher[91] CPSPBGetProcessInfo(): This call is deprecated and should not be called anymore.
6/11/11 7:44:54 PM /System/Library/CoreServices/AppleScript Runner.app/Contents/MacOS/AppleScript Runner[264] CPSGetFrontProcess(): This call is deprecated and should not be called anymore.
6/11/11 8:19:12 PM Automator Runner[415] Error while processing arguments
6/11/11 8:20:31 PM /Applications/AppleScript/Folder Actions Setup.app/Contents/MacOS/Folder Actions Setup[420] CPSGetProcessInfo(): This call is deprecated and should not be called anymore.
6/11/11 8:20:31 PM /Applications/AppleScript/Folder Actions Setup.app/Contents/MacOS/Folder Actions Setup[420] CPSPBGetProcessInfo(): This call is deprecated and should not be called anymore.
6/11/11 8:20:32 PM [0x0-0x5b05b].com.apple.systemevents[421] com.apple.FolderActions.enabled: Already loaded
And for that matter....why does Automator throw these messages? All apps (except iWork '08 apps) and OS are up to date.
- Just a few of the many actions not loaded:
6/11/11 7:48:25 PM Automator[294] The action “Start iTunes Visuals” could not be loaded because the application “iTunes” is the wrong version.
6/11/11 7:48:25 PM Automator[294] The action “Stop iTunes Visuals” could not be loaded because the application “iTunes” is the wrong version.
6/11/11 7:48:25 PM Automator[294] The action “Update iPod” could not be loaded because the application “iTunes” is the wrong version.
6/11/11 7:56:33 PM Automator[294] name = name was not found
6/11/11 7:56:33 PM Automator[294] name = name extension was not found
6/11/11 7:56:33 PM Automator[294] name = file type was not found
6/11/11 8:00:29 PM Automator Runner[339] Error while processing arguments
6/11/11 8:00:30 PM Automator Runner[339] The action “Import Files into iTunes” could not be loaded because the application “iTunes” is the wrong version.
6/11/11 8:00:30 PM Automator Runner[339] The action “Add Songs to iPod” could not be loaded because the application “iTunes” is the wrong version.
6/11/11 8:00:30 PM Automator Runner[339] The action “Add Songs to Playlist” could not be loaded because the application “iTunes” is the wrong version.
6/11/11 8:00:30 PM Automator Runner[339] The action “Apply SQL” could not be loaded because the application “Xcode” was not found.
Do I need to wipe the drive again and re-install everything?
Any help is greatly appreciated. Apologies if this seems long-winded.Folder Actions are set up a bit differently in Leopard (they use an AppleScript wrapper), and several actions have been updated to use new technologies available in Snow Leopard. Looking at some of your console logs, it looks like some actions or workflows were just copied over from Snow Leopard. When changing versions like that, you should rebuild the workflows so that they link to the correct actions, and check added actions for any dependencies (an action won't be loaded if it requires resources that are not available).
Resaving your Folder Action workflow as a Folder Action Plug-in should do the trick. -
AppleScript 10.9.0 System Events -10006 Update property list file item
Have AppleScript that runs without error on Mountain Lion 10.8.5, but errors out on Mavericks 10.9.0.
At end of script, property list items need to be updated and this is when error occurs.
Put together a subset of the script, see below) that get the error
Statement reads "set value of property list item "ArrayList001" to ArrayList001"
Text of error:
error "System Events got an error: 'xxx.plist' is not a property list file."
number -10006 from contents of property list file "xxx05.plist"
=============================================================================
property myPListFile : "cbmck05.plist"
property myPListFilePath : ""
property constPreviousRunDay : "PreviousRunDay"
on run
set today to "Date01" as string
set List001 to {}
set List002 to {}
set myPListFilePath to ""
repeat with i from 1 to 8
set end of List001 to (i * 2) as string
end repeat
set myPListFilePath to path to desktop folder from user domain as string
set fileMyPList to (myPListFilePath & myPListFile) as string
clear_file(fileMyPList)
-- First time! need to initalize
tell application "System Events"
-- create an empty property list dictionary item
set the parent_dictionary to make new property list item with properties {kind:record}
-- create new property list file using the empty dictionary list item as contents
set new_plistfile to ¬
make new property list file with properties {contents:parent_dictionary, name:fileMyPList}
make new property list item at end of property list items of contents of new_plistfile ¬
with properties {kind:string, name:constPreviousRunDay, value:today}
make new property list item at end of property list items of contents of new_plistfile ¬
with properties {kind:list, name:"ArrayList001"}
make new property list item at end of property list items of contents of new_plistfile ¬
with properties {kind:list, name:"ArrayList002"}
end tell
set previousRunDate to today
set xxList to (repopulate_lists())
set ArrayList001 to List001
set ArrayList002 to List002
-- save info in the plist file
tell application "System Events"
tell property list file fileMyPList
tell contents
set value of property list item constPreviousRunDay to previousRunDate
set value of property list item "ArrayList001" to ArrayList001 -- <<< ------- error caused by the statement
set value of property list item "ArrayList002" to ArrayList002
end tell
end tell
end tell
end run
-- ==========================================
on repopulate_lists()
set newList to {}
set List002 to {}
repeat with i from 1 to 8
set end of newList to i as string
end repeat
set List001 to newList
return List001
end repopulate_lists
-- ==========================================
-- Does the file exist?
on fileExists(f)
try
f as string as alias
return true
on error errMsg number errNum
return false
end try
end fileExists
-- Delete the files if exist
on clear_file(aFile)
if fileExists(aFile) then
tell application "Finder"
set resultObject to delete aFile
end tell
end if
end clear_fileHere's an AppleScript handler that partially works around this bug (warning: it turns each list item into a string).
on plistWrite(plistPath, plistItemName, plistItemValue)
-- version 1.1, Daniel A. Shockley
-- 1.1 - rough work-around for Mavericks bug where using a list for property list item value wipes out data
if class of plistItemValue is class of {"a", "b"} and AppleScript version of (system info) as number ≥ 2.3 then
-- Convert each list item into a string and escape it for the shell command:
-- This will fail for any data types that AppleScript cannot coerce directly into a string.
set plistItemValue_forShell to ""
repeat with oneItem in plistItemValue
set plistItemValue_forShell to plistItemValue_forShell & space & quoted form of (oneItem as string)
end repeat
set shellCommand to "defaults write " & quoted form of POSIX path of plistPath & space & plistItemName & space & "-array" & space & plistItemValue_forShell
do shell script shellCommand
return true
else -- handle normally, since we aren't dealing with Mavericks list bug:
tell application "System Events"
-- create an empty property list dictionary item
set the parent_dictionary to make new property list item with properties {kind:record}
try
set plistFile to property list file plistPath
on error errMsg number errNum
if errNum is -1728 then
set plistFile to make new property list file with properties {contents:parent_dictionary, name:plistPath}
else
error errMsg number errNum
end if
end try
tell plistFile
try
tell property list item plistItemName
set value to plistItemValue
end tell
on error errMsg number errNum
if errNum is -10006 then
make new property list item at ¬
end of property list items of contents of plistFile ¬
with properties ¬
{kind:class of plistItemValue, name:plistItemName, value:plistItemValue}
else
error errMsg number errNum
end if
end try
end tell
return true
end tell
end if
end plistWrite -
Folder Actions will not work - tried everything
Recently Folder Actions simply stopped working on 10.6.4. They worked fine before then recently just stopped working.
I've tried everything I can think of, including:
1. completely removing enabling & disabling & enabling folder actions through the setup app.
2. trashing folder actions plist files in user domain and relaunching
3. disabling related launchd processes with lingon
4. trashing launch agents in user domain and also trying to unload them in terminal
5. trying to kill the folder actions dispatcher process in activity monitor (just relaunches, as it should)
6. emptying system caches including dyld shared cache using cocktail
7. doing most of the above and restarting
It's driving me nuts. Any other ideas?
here's some entries from syslog:
8/2/10 9:31:37 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.folders) Throttling respawn: Will start in 6 seconds
8/2/10 9:37:29 AM Folder Actions Setup[4403] * WARNING: Method selectedRowEnumerator in class NSTableView is deprecated. It will be removed in a future release and should no longer be used.
8/2/10 9:43:37 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.enabled[309]) Exited: Killed
8/2/10 9:46:23 AM [0x0-0x3a03a].com.apple.systemevents[360] com.apple.FolderActions.enabled: Already loaded
8/2/10 9:52:07 AM Folder Actions Setup[1083] * WARNING: Method selectedRowEnumerator in class NSTableView is deprecated. It will be removed in a future release and should no longer be used.
8/2/10 9:52:16 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.folders) Throttling respawn: Will start in 7 seconds
8/2/10 9:53:02 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.folders) Throttling respawn: Will start in 1 seconds
8/2/10 9:56:18 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.folders) Throttling respawn: Will start in 10 seconds
8/2/10 10:00:58 AM Folder Actions Setup[2190] * WARNING: Method selectedRowEnumerator in class NSTableView is deprecated. It will be removed in a future release and should no longer be used.
8/2/10 10:01:01 AM com.apple.FolderActions.enabled[2236] launchctl: Error unloading: com.apple.FolderActions.folders
8/2/10 10:01:30 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.folders) Throttling respawn: Will start in 10 seconds
8/2/10 10:01:42 AM com.apple.launchd.peruser.501[269] (com.apple.FolderActions.folders) Throttling respawn: Will start in 9 seconds
8/2/10 10:05:03 AM sudo[2622] lryter : TTY=ttys000 ; PWD=/Users/lryter ; USER=root ; COMMAND=/bin/launchctl unload -w /Users/lryter/Library/LaunchAgents/com.apple.FolderActions.enabled.plist
8/2/10 10:10:25 AM Folder Actions Setup[676] * WARNING: Method selectedRowEnumerator in class NSTableView is deprecated. It will be removed in a future release and should no longer be used.
8/2/10 10:10:27 AM com.apple.FolderActions.enabled[680] launchctl: Couldn't stat("/Users/lryter/Library/LaunchAgents/com.apple.FolderActions.folders.plist"): No such file or directory
8/2/10 10:10:27 AM com.apple.FolderActions.enabled[680] nothing found to unload
8/2/10 10:10:38 AM com.apple.launchd.peruser.501[268] (com.apple.FolderActions.folders) Throttling respawn: Will start in 8 seconds
8/2/10 10:13:17 AM sudo[943] lryter : TTY=ttys000 ; PWD=/Users/lryter ; USER=root ; COMMAND=/bin/launchctl unload -w /Users/lryter/Library/LaunchAgents/com.apple.FolderActions.enabled.plist
8/2/10 10:14:01 AM com.apple.launchd.peruser.501[268] (com.apple.FolderActions.folders) Throttling respawn: Will start in 4 seconds
8/2/10 10:14:14 AM com.apple.launchd.peruser.501[268] (com.apple.FolderActions.folders) Throttling respawn: Will start in 1 secondsI finally go Folders Action to work, after being unable to use it even for a simple beep for years now.
Here is what I did:
1. Changed permissions to 755 for the following folder and two contained files (note that 775 didn't work for me)
~/Library/LaunchAgents/
~/Library/LaunchAgents/com.apple.FolderActions.enabled.plist
~/Library/LaunchAgents/com.apple.FolderActions.folders.plist
2. Changed the following lines within ~/Library/LaunchAgents/com.apple.FolderActions.enabled.plist (using TextWrangler)
from:
<key>OnDemand</key>
<false/>
to:
<key>OnDemand</key>
<true/>
Prior to the permissions changes within #1 above, the value of <true/> kept getting changed back to <false/> by something in the system... and though
there was improvement by the permissions changes, the following console message appeared until false was changed to true.
com.apple.FolderActions.enabled[4127] launchctl: Error unloading: com.apple.FolderActions.folders
At this point true is staying true, and not being changed by unknown forces to false, and the above message is not appearing.
3. The only other thing I did prior to #1 and #2 above, was to run the script (unsaved),
tell application "/System/Library/CoreServices/Folder Actions Dispatcher.app" to tick
This little tell line caused something to occur where my Folder Action surprised me and worked for the first time though it took about 30 seconds and was erratic,
sometimes performing, sometimes not, though if I would do move something into the folder to trigger the action that should occur, and did not occur, then at the point
running the above tell line or script would cause the action to occur.
4. At this point I don't fool with the tell line or script from #3, and it seems that systemevents has gotten involved, as well as launchd, and with my simple Folder Action script
I'm getting the folder action within 10 seconds compared to 30 to 45 if ever seconds.
5. This is still too early to tell if this is the wonder pill I've needed since Leopard, and now Snow Leopard (and maybe Tiger as well: I forget when I even tried Folder Actions).
There was a time when I moved things around, so that the items normally found in the former AppleScript folder, were placed elsewhere in subfolders, so I don't know if that lead to this...
because I could get Folder Actions to work on Macs in the Applestore, but not my own Mac. Watching the console messages was helpful. I don't think it's a big concern that
deprecated messages are found sometimes. That's a just a normal part of the constantly rebuilding of things that goes on. It's more like a reminder that we've got an upgraded
OEM part were going to start using, and the older part won't be available after such and such date, so program accordingly, and in the meantime drive. -
I am getting a headache by now trying to figure out how to do a fairly simple thing...
I have created applesript that sorts my download folder
So i have couple of folders in there and any file that goes into
downloads folder is moved to coresponding folder based on extension
say i have 4 folders
-Media
-Text
-Install Disks
-Other
i then decided to take it one step further
and created folder action that takes files in a given folder and
puts them in a folder with corresponding date
so to put it simple say there is blah_blah.mp3 that i copy to downloads folder
my two scripts idealy if they would cooperate should work like this
___________________________\/ DateSort folder action \/
"Download folder" -->> "media folder" -->> "\[current date\] folder"
___\^download folder action\^
the problem thought they work separately but when i use them together
as i described... "DateSort" for some reason does not enter
^repeat with this_item in added_items^
to be honest added_items it such use case is blank for unknown reason...
And the question that is bothering me is WHYYYYYYY?
(because if simply put a file into "media folder" it works like charm...)I know it is very late to reply... But my attemps to create a chained folder script system did not work very well, and i just ended up baking the operations from the second script into the first.
Seems like on *new folder item* does not handle files placed by another apple script. Further working on it I've forsaken the idea of using folder script paradigm alltogether, It is very unreliable. Especially so when trying to deal with download folder. There are clashes all over the place. For example i dont want to touch safari/chrom download chache files, but If I dont treat them the first time around the script will never touch them again.
So I ended up writing an app that does all this and have it being triggered by launchd every so often. Much easier to handle. If you are still inrpterested i can give you my current version. It has much cleaner code, and it finally works without a hinge. -
Create Folder with the name of expense report number in SHAREPOINT ?
Hi All,
iExpence - In expense report confirmation page. There is custom link.
Requirement
When user click on link, system should create folder with the name of expense report number in SHAREPOINT and copy copies of expense receipts in the created folder in SHAREPOINT.
Please suggest.
Thanks,OAF no api as such for this kind of customization. Rather try developing some web service or something similar which can be invoked from the custom link to do the job.
--Shiv -
Folder Actions Dispatcher.app using 80% CPU
I just wonder why this item is using over 80% of my CPU. I have no idea what this application do. I would be grateful if somone could explain for me. I am hesitant to fidle with system items such a remove it. It is in the System Folder under Core Services.
Thank you
InnocentsI'm not sure this will help or not, but one thing I've found is that selecting the menu item Finder > Services > Folder Actions Setup... ONLY works if you have a folder currently selected in the Finder. This might explain why you're not seeing anything.
If you want to "force" the list of Folder Actions to display, right-click on any folder and select Folder Actions Setup. It will display a dialog showing scripts that can be applied. Just hit Cancel. You'll be left with the Folder Actions Setup showing all of your folder actions currently in place.
After letting my machine run over the weekend, I'm seeing that this issue is solved with 10.10.2 (at least for me). What I did was:
Turned on Folder Actions for 3 different LaunchAgents areas and 2 different LaunchDaemons areas (e.g. local, system).
Let the system run over the weekend (over 100 hours all told)
The Folder Actions Dispatcher process is no longer chewing up gobs of memory. It is using some (I'm seeing it go roughly between 40 and 140 MB). That's a little more than I would have thought for such a simple task, but it's by no means stressing the system.
The Folder Actions Dispatcher process is no longer chewing up CPU.
This is far different that what was seen under 10.10.1 with the same test. Under 10.10.1 I would see Folder Actions Dispatcher continue to grab RAM over time into the several GB range, then drop down, then work it's way back up...continually. The CPU usage would also periodically spike up.
So, from my POV, this seems to have been addressed. -
Need help creating a folder action for creating folders based on filenames.
I want to create a folder action that will monitor a folder and every time a file is added to the folder it will create a directory using the filename (minus the extension) and move the file the that directory
on run {input, parameters} -- create folders from file names and move
set output to {} -- this will be a list of the moved files
repeat with anItem in the input -- step through each item in the input
set {theContainer, theName, theExtension} to (getTheNames from anItem)
try
set destination to (makeNewFolder for theName at theContainer)
tell application "Finder"
move anItem to destination
set the end of the output to the result as alias -- success
end tell
on error errorMessage -- duplicate name, permissions, etc
log errorMessage
# handle errors if desired - just skip for now
end try
end repeat
return the output -- pass on the results to following actions
end run
to getTheNames from someItem -- get a container, name, and extension from a file item
tell application "System Events" to tell disk item (someItem as text)
set theContainer to the path of the container
set {theName, theExtension} to {name, name extension}
end tell
if theExtension is not "" then
set theName to text 1 thru -((count theExtension) + 2) of theName -- just the name part
set theExtension to "." & theExtension
end if
return {theContainer, theName, theExtension}
end getTheNames
to makeNewFolder for theChild at theParent -- make a new child folder at the parent location if it doesn't already exist
set theParent to theParent as text
if theParent begins with "/" then set theParent to theParent as POSIX file as text
try
return (theParent & theChild) as alias
on error errorMessage -- no folder
log errorMessage
tell application "Finder" to make new folder at theParent with properties {name:theChild}
return the result as alias
end try
end makeNewFolder
This script almost does what I need except for the fact that it screws up on files with periods in them
for example
1.2.3.4.txt
will create the directorys 1, 2, 3, and 4 instead of 1.2.3.4 -
Quality of JPEG when being converted by Folder Actions (Image Events)
I take a lot screenshots with Command + Shift + 3/4. They are in PNG and I love them. Yet, I need to send them via email sometimes.
I convert them to JPEG using Preview, but it is time-consuming when especially I have hundreds of them.
I have just learnt that it is possible to do convert in batch using Folder Actions. However, I meet few very serious problems.
1. In Preview, I could choose the quality of JPEG before converting. But, there is no such option in Folder Actions. I even searched online to try to modify the script and it seems that nobody cares about the quality of converted JPEG.
My question: What is the quality of JPEG converted? And, is it possible to modify it?
2. Since I do not know the quality of conversion using Folder Actions, I tried different qualities using Preview and match the outputs with those using Folder Actions. I got no result. As Preview is using Core Image as the processing architecture.
My question: What is the image processing architecture adopted by Image Events?
3. If the quality is unchangeable, can anyone teach me how to write a new script to do the conversion using Preview?
I really hope Mac OS gurus could explain these to me and possibly solve my problems. I am interested to learn the AppleScript part to modify it.
Thank you very much.It is the original folder action script from Mac OS. Here is the copy.
Could you help me as well where to add the "compression level"? Also, what do "high", "low" and "medium" mean, in % just like Preview, if they use the same image processing architecture?
Again, thank you very much for quick reply.
================
Image - Duplicate as JPEG
This Folder Action handler is triggered whenever items are added to the attached folder.
The script creates a JPEG version of the file, but leaves a copy of the file
in its original format. If the original file is already in JPEG format, the script does
not duplicate the file.
Copyright © 2002–2007 Apple Inc.
You may incorporate this Apple sample code into your program(s) without
restriction. This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours. You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes. If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.
property done_foldername : "JPEG Images"
property originals_foldername : "Original Images"
property newimage_extension : "jpg"
-- the list of file types which will be processed
-- eg: {"PICT", "JPEG", "TIFF", "GIFf"}
property type_list : {"TIFF", "GIFf", "PNGf", "PICT"}
-- since file types are optional in Mac OS X,
-- check the name extension if there is no file type
-- NOTE: do not use periods (.) with the items in the name extensions list
-- eg: {"txt", "text", "jpg", "jpeg"}, NOT: {".txt", ".text", ".jpg", ".jpeg"}
property extension_list : {"tif", "tiff", "gif", "png", "pict", "pct"}
on adding folder items to this_folder after receiving these_items
tell application "Finder"
if not (exists folder done_foldername of this_folder) then
make new folder at this_folder with properties {name:done_foldername}
end if
set the results_folder to (folder done_foldername of this_folder) as alias
if not (exists folder originals_foldername of this_folder) then
make new folder at this_folder with properties {name:originals_foldername}
set current view of container window of this_folder to list view
end if
set the originals_folder to folder originals_foldername of this_folder
end tell
try
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
set the item_info to the info for this_item
if (alias of the item_info is false and the file type of the item_info is in the type_list) or (the name extension of the item_info is in the extension_list) then
tell application "Finder"
my resolve_conflicts(this_item, originals_folder, "")
set the new_name to my resolve_conflicts(this_item, results_folder, newimage_extension)
set the source_file to (move this_item to the originals_folder with replacing) as alias
end tell
process_item(source_file, new_name, results_folder)
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
end tell
end if
end try
end adding folder items to
on resolve_conflicts(this_item, target_folder, new_extension)
tell application "Finder"
set the file_name to the name of this_item
set file_extension to the name extension of this_item
if the file_extension is "" then
set the trimmed_name to the file_name
else
set the trimmed_name to text 1 thru -((length of file_extension) + 2) of the file_name
end if
if the new_extension is "" then
set target_name to file_name
set target_extension to file_extension
else
set target_extension to new_extension
set target_name to (the trimmed_name & "." & target_extension) as string
end if
if (exists document file target_name of target_folder) then
set the name_increment to 1
repeat
set the new_name to (the trimmed_name & "." & (name_increment as string) & "." & target_extension) as string
if not (exists document file new_name of the target_folder) then
-- rename to conflicting file
set the name of document file target_name of the target_folder to the new_name
exit repeat
else
set the name_increment to the name_increment + 1
end if
end repeat
end if
end tell
return the target_name
end resolve_conflicts
-- this sub-routine processes files
on process_item(source_file, new_name, results_folder)
-- NOTE that the variable this_item is a file reference in alias format
-- FILE PROCESSING STATEMENTS GOES HERE
try
-- the target path is the destination folder and the new file name
set the target_path to ((results_folder as string) & new_name) as string
with timeout of 900 seconds
tell application "Image Events"
launch -- always use with Folder Actions
set this_image to open file (source_file as string)
save this_image as JPEG in file target_path with icon
close this_image
end tell
end timeout
on error error_message
tell application "Finder"
activate
display dialog error_message buttons {"Cancel"} default button 1 giving up after 120
end tell
end try
end process_item -
Help with creating Automator Folder Action
Hi
I want to create a folder action to empty my Caches from my both System and User Library files. I want a little help in creating the workflow. I tried to create a workflow, but the problem is it was asking for the system password when I selected the Library cache folder from my System. How can I create a workflow and save it as a plugin for my everyday action...
thanks in advance..HI,
Not sure if Automator can do that but AppleScript might. Post here for help.
(Applications/Utilities)
http://discussions.apple.com/forum.jspa?forumID=724
Carolyn -
Folder action to package and create pdf Applescript folder action
Hi
Does anyone have an Applescript Folder Action to package Indesign CS5.5 files and make pdfs.
Thanks, in advance.Hi Babs
I ended up paying someone to create the script. They did a fantastic job creating a droplet that has options to package, create PDFs to presets, print to presets, create an IDML file, retrosave this to CS4 and create a thumbnail. Sounds like a lot but that is what I ended up needing for one client and I can use it on anything.
Thanks
Mac
Sent from my iPhone -
Create folder in system matrix (incoming payment )
Hi, my friends
i like to create folder in runtime in system matirx. please post the code for regarding this. For example:incoming payment matrix create folder
advance thanksHi
You can check the samples provided by SAP in C:programm files>SAP>SDK>Samples>COM UI and systemformmanipulation example..
Thanks
Maybe you are looking for
-
Edit files on a server with dreamweaver CS5
I am having a problem editing files directly from a ftp server. I just updated to Cs5 from Cs3 and seem to of lost the ability to edit and change files on a live server. I understand that I can download an entire site, but with the amount of sites th
-
None of my fonts install into photoshop cs5. why?
I had my computer repaired a few months ago by Mac Medics and ever since my photoshop will not install fonts. Its photoshop cs5. I have an osx 10.6.8 system. The fonts install fine in all other adobe and microsoft programs. I tried doing what several
-
I've created a document in Pages which has images, then exported to Word format, then opened the .doc file up in Pages. The images aren't in the right places. What am I doing wrong? I've also opened it in Word and it looks ok there, but I really want
-
HTTP Adapter and DUNS scheme - possible bug ?
Hi Folks, I am using the HTTP adapter for posting an XML message which is then redirected towards IDOC adapter ... nothing special here ... I am using the scheme 'DUNS' and agency '016' to pass along the partner identification when calling the HTTP a
-
Here is one for you... Have you ever gotten home late, come in through the garage door and landed on the floor after tripping over the lacrosse stick, backpack, or football?! Well, I've been there, done that... but no more! Now I have a door sensor o