Workflow vs. Script

I have a workflow that moves a large file to an external drive when saved (and deletes earlier versions), allowing me to exempt it from Time Machine backups that would write the entire (200K+) file every time I add a comma. It worked fine until OS 10.5.2.

Now, it fails at the final write step. In trying to attach the workflow to the pertinent folder in 10.5.2, I run into a seeming anomaly. The "Attach Folder Action" command is limited to attaching scripts. On the other hand, Automator is limited to saving either workflows or applications. Accordingly, even though I can get the workflow to work in Automator, I can't get it saved in any form that is recognized by the "Attach Folder Action" command.

What am I missing?

Mac Pro 2.66, 3 GB RAM, Mac OS X (10.5.2)

Posted on May 21, 2008 3:40 AM

Reply
13 replies

May 21, 2008 3:29 PM in response to Peter Sims

You are missing the "Save As Plug-in..." in Automator's File menu. 🙂

With that, you can save as a "Folder Actions" plug-in and attach it to the folder in one step.

Automator will automatically create an appropriate AppleScript script that will reference the saved workflow, attach that script to the folder, and save the workflow in the default folder for Automator Folder Actions in your Library/Workflows folder. Just use Spotlight to find it again if you forget, or Automator's "Open Recent" menu.

As you probably already know, in the Finder you can also right-click on a folder that has a script attached to it and use the "More" menu at the bottom to open the script instead. While the script Automator creates isn't anything special, it does have the path to the Automator workflow inside it.

There are other plug-in types, too, so Automator isn't quite as limited as you first wrote. 😉

May 22, 2008 1:40 AM in response to Community User

Azqi, thanks for the suggestion. I didn't get as far as saving as a plug-in, because the workflow won't run anymore.

It's actually pretty straightforward:

Get Specified Finder Items (from a folder on the internal HD)
Get Folder Items (same folder)
Filter Finder Items (include those whose name includes "Backup")
Move Finder Items (to folder on external drive)

The workflow presents an error at Move Finder Items - Check the item's properties and try again. There's no obvious reason for this error, particularly since the workflow worked fine for months.

I've had several anomalies since installing OS 10.5.2, mainly that Spotlight has become useless because it fails to find files that I know to exist (indeed I see them onscreen). Also, when accessing an older computer, using Ethernet and screen-sharing, I was curiously denied access to several files - I'm the sole user of both machines.

Initially, I attributed these oddities to the 10.5.2 Repair Permissions message: "ACL found but unexpected on 'Library'". Apple got rid of that error message with a subsequent update, but I suspect that they simply suppressed the message's appearance, without curing the underlying problem. I.e., Spotlight still misses those files.

I think I'll wait for a real correction from Apple. If the problem gets to be seriously burdensome, I'll probably set up the repository for Backup somewhere outside the Library folder.

BTW, I'm not the only one experiencing the Spotlight problem. There are threads here and at MacFixIt. Either Apple made a permissions error with 10.5.2, or there's some aberration on my (and several other) machines that results in problems running 10.5.2.

Thanks again.

May 22, 2008 4:00 PM in response to Peter Sims

Spotlight doesn't search certain places like the Library folders, but you can search those from the Finder if needed. Leopard uses Access Control Lists on several system folders, so you need to be careful with using the "Get Info" window, and things like "apply to enclosed items". Both of these technologies do what they are supposed to do - the problem is understanding what that is, which Apple really missed the boat at documenting.

May 22, 2008 4:13 PM in response to red_menace

Thanks for mentioning that about Spotlight. I know Spotlight used to find the workflows in Library, perhaps before 10.5.2, as I tried it out before recommending it long ago. I'm sure it helps to leave out all of those files in the Library, so it makes sense it's not indexed anymore. Oh well, I guess I won't suggest that anymore. 🙂

May 23, 2008 1:11 AM in response to red_menace

Where is it written that Spotlight doesn't search places like the Library folders? I would think that folders such as Library and Documents would be prime search locations, since they're the places people are most likely to archive things they're likely to want to find later. Any such exclusion from a Spotlight search should be explicit to avoid having people unwittingly bury things where they won't be found. Since both Spotlight and the Automator workflow worked through OS 10.5.1 (assuming I would have noticed things then missing from a Spotlight search), I assume somebody at Apple messed up with 10.5.2. The probability of a mistake at Apple is strengthened by the fact that Spotlight's results are no longer in categories (no more "View top five") – they're presented as just one long list. Can't imagine how that got turned off, and I'm pretty certain it wasn't anything I did.

Getting back to the Automator problem: I did place the repository folder outside any Library folder. The current path is MyExternalDrive/Users/Myfolder/Documents/Word.

Still, upon Automator's Run (the workflow), the final action Move Finder Items (to ...Word) presents the error message: The action Move Finder Items encountered an error - Check the item's properties and try again. The only property obviously available to check is the path, which is as stated above.

If this had happened when I first tried to workflow, I would have assumed that Automator is not for me and moved on. The fact that it worked for months and provides a neat way to avoid having Time Machine add 200k to its backup every hour makes me pursue the matter.

One other variable is that I recently installed the update to Office 2008. In some significant ways, Office is not quite a "Maccish" application. And, it is a Word document that I want to Move. But the only identifier in the Filter Finder Items action is that the name contains Backup and the type of document shouldn't matter (also the workflow doesn't fail there).

Thanks for the help, folks. It seems, however, that I'm still looking (more accurately, hoping for a fix from Apple).

May 23, 2008 3:08 PM in response to Peter Sims

Spotlight will search where the user has permissions, although the System folders aren't searched by default (you can specify system items in a Finder search). The Access Control Lists are a bit of a surprise to most users, so there may be search restrictions relating to those. Leopard's Spotlight search has also been tweaked a bit to keep confusing items such as cache files out of the default search results, but you would have to do some investigation for specifics since the documentation is a bit sparse.

I didn't see a Leopard update, but Tiger's Spotlight search locations are documented here.

May 24, 2008 12:37 AM in response to red_menace

Hi, red-menace:

We're almost on the same page. All that you say is true, but:

I have manually (and tediously) turned read & write permissions on for me, Admin, and Staff at every folder in the path to the repository folder. No success!

That's why I was originally focused on the ACL. As mentioned, Apple caused the error message: "ACL found but not expected on Library" not to appear any longer. I suspect they have not yet determined how to undo the damage imposed by the ACL. I read someplace that the ACL was introduced to avoid inadvertent (and nefarious?) deletions/corruptions of important files. A good purpose but, apparently, carried out in an overbroad manner.

As also mentioned, the reason I'm certain it is Apple and not me is that the categories in Spotlight's display (PDF, Applications, Photos, etc.) have disappeared. I don't know how to turn the categories off and I doubt that I did it without knowing. It's more likely that Apple has changed permissions somewhere where I can't modify them, changed Spotlight, or changed the way that Spotlight is hooked into the System.

It's possible that some anomaly on my machine corrupts Spotlight upon installation, but there have been enough other people complaining about Spotlight being unreliable (threads here and at MacFixIt) to cause that possibility not to be high on my list. A couple of people in those threads recommended EasyFind, a free application that is reasonably quick (without an index) and reliable, i.e., it finds everything that I'm aware it should find – apparently, without regard to permissions.

Everything you say is correct if Spotlight were working as advertised. Unfortunately, it is not.

I think your results differ from mine because, if your info here is up to date, you're using Tiger, where Spotlight worked, and works, as expected. I'm using Leopard, where Spotlight worked correctly until OS 10.5.2 (which is when the ACL message appeared and was then suppressed – leaving the error(s) intact).

Fortunately, EasyFind takes the sting out of waiting for Apple to put things back together and, otherwise, the machine is still a pleasure to use.

Thanks for sticking with this.

May 24, 2008 1:10 PM in response to Peter Sims

Hmm, I've got Leopard and I've categories in the Spotlight menu, if that's what you mean. No problems there. And I've got categories in the System Preferences for Spotlight, no problems there either. Likely it's your computer and your circumstances if you don't have those.

On the other hand, I do believe the system did change a little, since there's no longer several different types of search windows. IIRC in 10.4, choosing to show all results from the Spotlight menu would give a window that resembled an RSS page in Safari. However, there were also other types of windows for searching and creating Smart Folders available from the Finder. I believe they dropped all the different types for the sake of consistency and much less confusion. Now there's just one type of search window (and it doubles as a normal Finder window) regardless of whether search is initiated from from the Spotlight menu, the Finder with Cmd-F or Cmd-Shift-F, or from within a Finder window. It's also the same window for creating a Smart Folder.

You can still organize the listing by category with the Kind column, and focus on just one kind by adding a search criteria if there isn't already one. By default, the first criteria is automatically set to Kind and has "Any" chosen to show everything. Just change the type to instantly switch back and forth between different document categories such as Images, Documents, Movies, PDFs, and so on.

The only other interesting thing about the old RSS style results was being able to organize by time. That's just another search criteria that can easily be adjusted. It's also been addressed by default saved searches (aka Smart Folders) in the "Search" category in the Finder's sidebar, via Finder's preferences. So, any search from the Spotlight menu or Finder can be adjusted for kind (category), time, or practically anything else (other) and saved for easy access from the Finder.

It is a little different from Tiger, but I find it's also a lot more flexible and less confusing to use this way. Also, the consistency keeps Spotlight from appearing as a separate entity that needs special training. Instead, it's just another name for searching in whatever app there's a search field, that happens to transparently enable the possibility of smart folders or saved searches (same thing really, different only by thought).

If the lack of various search windows isn't something you feel are missing, then as I suggested before it's likely your own circumstances and computer. You've probably made some changes I haven't made, and that others also without your problem haven't made. After fiddling as much as you seem to have done trying to get things to act the way it's expected without starting from scratch, it's probably time to give in and start from scratch.

Have you tried a fresh install and testing it out before making any changes from the standard install? By doing that and slowly making the changes a little at a time, you can troubleshoot what changes you are making that is causing the issue.

It sounds like you have a few different things not going as expected. Try to not ball them all up into one problem too quickly. Hopefully, some of it was just a matter of perception or expectations based on how search windows appeared in 10.4 compared to 10.5 instead. Sounds like there are other issues, but it seems like too many different issues are being combined and making an unwieldy problem. It can get excessively challenging to troubleshoot when overly frustrated by such a Frankensteinian monster of a problem. 😉

Good luck in breaking it down. 🙂

May 25, 2008 8:40 PM in response to Peter Sims

The "ACL found but not expected" message means just that - Apple says you can ignore the message, but my guess is that an "Apply (permissions) to enclosed items" was used from the Get Info window. Most of the system folders have a "deny delete" ACL item that isn't readily seen in the Get Info, so if the permissions are applied to the enclosed items then they will wind up with an ACL that wasn't expected (I think everyone got surprised by this one). This may also be a problem with copying to the backup volume (if you are using the same name and replacing it, for example). If you are comfortable with using the Terminal, the chmod command can be used to remove or modify the ACL entries, although repairing permissions should restore things (on the system disk) to what the receipts/bom say they should be. Using the Get Info window to change permissions can be an issue, since there are a few new things that can trip up an unsuspecting user.

As for spotlight not showing the categories, those are selected in the Spotlight preferences, so if they are enabled but still not showing up, you might try removing the preference .plist to get it reset. A corrupt Spotlight database can still cause problems, so rebuilding it is an option - EasyFind works a little bit differently (and slower), since it doesn't build a database.

I run both Leopard and Tiger, but am still figuring out the differences, which appear to be tricky in a few places.

May 26, 2008 2:38 AM in response to Community User

Azqi -

We are talking about different searches. I seldom use Spotlight from the MenuBar. I more often use Spotlight from the the Finder ToolBar after choosing in the SideBar a place to search. I prefer this for several reasons: to avoid duplicative results from my external (Time Machine) drive, overbroad results from my internal drive, to define a context for the inquiry, and, while adding the components of a path name may take longer, on these already-fast machines, it seems worth it for a more focused result.

When I use Spotlight in the MenuBar, I do get categorized (duplicative and overbroad) results. Until recently, I got a categorized result from the more limited ToolBar search. I am also offered a number of categories in System Preferences for Spotlight – they are all turned on.

If you mean by Spotlight menu what I call a MenuBar Spotlight search, then that result is a drop-down menu/dialogue, which is quite unlike the the other ToolBar (you say Finder), Cmd-F and Cmd-Shift-F windows.

None, repeat, none of these windows/searches includes every file that I know to reside in visible, non-arcane locations on my hard drive.

I'm aware of the additional search criteria available w/ Cmd-F and have added File Visibility and System Files to the default list. The files that are not found fall into neither of those categories.

I think the RSS display issue is pretty far afield. I certainly prefer having the display show the top five in every available category. More importantly, any search is useless if I can't rely upon all items being found.

Also, this was originally an Automator question having to do a workflow failing under OS 10.5.2. I introduced the Spotlight issue because I thought there might be a common cause.

Just received a message from another helpful participant in this discussion . You might be interested in my reply there.

Thanks for the help.

PS

May 26, 2008 2:40 AM in response to red_menace

red_menace –

This is in the ballpark that I suspect is at the heart of these problems.

I have indeed manually altered permissions – after the ACL message appeared. And, there does seem to be an interaction between my alterations and the appearance of "ACL". Fortunately(?), two successive runs of Disk Utility's Repair Permissions will undo my alterations, cause "ACL" to appear after the first run, and clear itself after the second (in accordance with the Receipts). I hope that "everyone got surprised" by this. That means that Apple will hear about it from enough people to get it fixed.

My backup to the external drive does indeed re-use the same name and "Replace existing files" is selected (I don't want to add 200k to the external every time I save the file).

I would resort to Terminal's chmod command if I thought it would "take." Since the file that Spotlight misses is also missed by Terminal's locate command, the "deny delete" that you mention is likely to be farther down in the system than anything I'm willing to change. If Apple takes too long to come up with a fix, I may resort to chmod, but I'd rather not (I'm not overjoyed to be tweaking permissions in Get Info to get the OS to do something it should do without tweaking). Given your comments, one solution may be to remove the Replace existing files from the workflow. The system will then add 1... to the filename, and such files will be easier to delete than copies of a Time Machine backup file (though they too can be trashed).

Overall, I'm glad to know that I'm not alone in recognizing this problem. This is not the first time there's been an Apple permissions glitch. One that comes to mind was something like: "Error -3xxxx occurred. We are correcting by ..." That went on for months.

All categories are selected in my Spotlight System Preferences. I have trashed the Spotlight.plist and then re-indexed the drive. I haven't yet trashed the Spotlight database. It seems like a reasonable next step for me (after I find it). And, if it works, it may well indicate that the Automator and Spotlight problems are distinct and separate. No small gain.

Thanks for the help.

PS

May 26, 2008 7:33 AM in response to Peter Sims

The Terminal commands will definitely "take", since they are what ultimately gets used by the system. The permissions are doing what they are supposed to, it is just that ACL's in Tiger were turned off by default, so there was some confusion when Leopard's were turned on (and used) without any documentation to that fact. Modifying (or removing) the ACL for your backup file should take care of any issues with deleting it.

You can use the mdutil utility to erase the database store(s), and ls (for example, ls -ldeh 'some/file/path') will show what the permissions really are, since Get Info comes up a bit short.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Workflow vs. Script

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.