Re: Pass Finder Selection to Shell Argument
Re: Pass Finder Selection to Shell Argument
- Subject: Re: Pass Finder Selection to Shell Argument
- From: David Wolfe <email@hidden>
- Date: Thu, 6 Sep 2007 17:17:57 -0400
Thank you Chris,
This is what I thought I should be able to do. But I couldn't figure
out how to get the Finder selection from the workflow to pass to the
shell script except to wrap it in an Applescript with a variable. I'm
assuming where you wrote, "pass input as parameters," you meant to
say "argument?" The options are Standard Input or Argument. Can you
explain the script you posted so I can learn how to do things like in
the future? For example, what does the first line do? What does the
"$f" mean in the third line? Does "done" make the shell session quit?
Thanks again,
David Wolfe
On Sep 6, 2007, at 4:49 PM, Christopher Nebel wrote:
On Sep 5, 2007, at 2:22 PM, David Wolfe wrote:
I know this may inflame the Applescript/Shell script debate again,
but I'm trying to automate something that apparently can only be
done at a command prompt. Please prove this wrong and show me an
Applescript way.
I'm trying to use Automator to create a Finder plug-in that will
allow a right-click on selected file(s) to add those files to the
Dock. So far, I've been able to get the Finder plug-in to work,
calling an Applescript in which I'm using "do shell script" to add
the item(s) to the Dock. But I can't get the selected file to pass
to the Shell Script as an argument. Here is the Workflow:
Get Specified Finder Items > Run Applescript
on run {input, parameters}
do shell script "additemtodock "
return
end run
If you're using Automator to create a Finder plug-in, then there
are two things to be aware of. First, the clicked items will be
passed to the workflow -- there's no need, and it's actually
incorrect, to get the Finder selection in the workflow itself.
Second, if all your Run AppleScript action does is call "do shell
script", why not use a Run Shell Script action instead? Your
entire workflow would look like this:
Run Shell Script (/bin/sh, pass input as parameters)
for f in "$@"
do
additemtodock "$f"
done
--Chris Nebel
AppleScript Engineering
_______________________________________________
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