How do I use variables in Leopard's Automator?

For the life of me, I cannot figure out how to use the new variables in Leopard’s Automator. The documentation does little more than to say they exist, and for once The Google is failing me.

Here are two use cases:

  1. I want to select a folder and pass that value into a Run AppleScript action. I’ll start with an Ask For Finder items action, and then, I assume, I’ll plug it into a “New AppleScript” variable with the Set Variable action. Looking at the results so far, it does, indeed contain the selected value. So far, so good. But now what? How do I write my AppleScript so that it actually uses this value?

  2. I want to select a folder and pass that value into a Shell Script. Similar to #1 above, but different syntax, I suspect.

Specifically, I’m looking for the syntax to use in the AppleScript and Shell Script that will contain the values I’m looking for.

Any help would be most appreciated.

Many thanks,
Steve

Model: Mac Pro & Mac Book
Browser: Safari 523.10
Operating System: Mac OS X (10.5)

Hi Steve,

for passing selected items to an AppleScript action, there is no Automator variable needed.
For example, If the first action is “Ask for Finder Items” with settings “Type: Folders”
and you paste this in an subsequent Run AppleScript action, it will display the name of the selected folder(s)


on run {input, parameters}
	repeat with i in input
		display dialog name of (info for i as alias)
	end repeat
	return input
end run

Note: input contains a list of the selected items (class (Finder’s) file specifier)

Variables aren’t needed for this either. You can just pass the result of the Ask for Finder Items action to the Run Shell Script action.

Thanks to you both.

Bruce, what syntax would I use to represent the variable passed by the preceding action?

To anyone: is this documented anywhere? Can you recommend a book if I want to bone up on my Automator skillz?

-Steve