Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What I'm looking for is a program similar to Automator or A Better Finder Rename but more extensive / advanced.

In my situation we have two files with the same name, one is a MOV the other an XML. We want to use some of the metadata within the XML to rename both files. Then we want to re-arrange the contents of the XML file so that it is compatible with another piece of software we use (I think this process is called mapping?)

Essentially some software that takes a bunch of variable from existing file and performs file actions to them.

I imagine this would be an easy task using apple-script, but I'm wondering if there is a OSX application similar to Automator that can do the above?

Questions are:

  1. Is there software that can do the above?
  2. Could Automator achieve this?
  3. What is the technical name of this kind of process?
  4. If no such software exists, what would be the best kind of script to use? eg. Make an Apple Script, python script etc.
share|improve this question
add comment

1 Answer

  1. There is certainly software that can do various pieces of the above, but I don't off-hand know of any GUI-based software that will let you do arbitrary manipulation of files based on contents of arbitrarily-structured XML documents. That means you'll be expected to piece bits of functionality together, which is essentially "scripting."
  2. Automator is a graphical scripting environment. All Automator is, by itself, is the "glue" for hooking various actions together via their inputs and outputs. Automator depends on the pluggable "actions" for its real functionality. Automator actions can do just about anything (even run command-line shell scripts), so yes, you can almost certainly use Automator to string together the various components you'll need. Whether that ends up being easier for you than writing scripts in a less visual way, I can't predict. I'm a professional programmer, and I find that the Automator interface can be a lot to grok. That said, I've used it successfully to do some things that would otherwise have been hard because I found good Automator actions for certain pieces
  3. I think what you're describing is too custom to be called anything more specific than "scripting."
  4. There are ways to achieve this with and without Automator. I'll discuss both below.

For something that involves Automator, you might consider these Automator actions. Unfortunately, there don't seem to be any pre-built binaries, which means you might have to build source code from scratch, which could have high enough barriers to entry to discourage you from the Automator approach.

Even if you got these tools, they're basically just components to let you use XML-based scripting and query languages like XQuery, XPath, and XSLT. Those languages are great for extracting bits of information from XML documents or transforming them into other XML documents, but they are all fairly comprehensive and have their own learning curves. For XML documents that are highly structured (rather than document-oriented like HTML), XQuery would work well for extraction and transformation; XSLT is probably better for rearranging document-like content. You might be able to get a feel for basic XQuery by reading some example code, and if your XML documents are simple enough, you probably won't need any advanced features.

If you want to skip the Automator actions (which might end up being easier--one less tool to learn), you could check out the XQilla command-line program, which will let you run XQuery from your Terminal.

If you forgo Automator, you'll need a scripting language to tie all the pieces (XML query, XML transformation, and file renaming) together. You mention Python, which would be a good choice because it's a clean and readable language you can learn by example with relatively low barriers to entry. It probably has good XML libraries that would let you do XML queries and transformations without making calls to external command-line programs, though I've never used Python for that and have no familiarity with the tools.

Unless you know of a Mac program that does XML processing, I would avoid AppleScript. Its strength is its ability to talk to Mac apps and have them do the heavy lifting; its built-in functionality is limited, and while it reads like English, that doesn't actually make it any easier to write. It's actually quite unintuitive, at least for me.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.