• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Pass Finder Selection to Shell Argument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pass Finder Selection to Shell Argument


  • Subject: Re: Pass Finder Selection to Shell Argument
  • From: Christopher Nebel <email@hidden>
  • Date: Thu, 6 Sep 2007 13:49:29 -0700

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
  • Follow-Ups:
    • Re: Pass Finder Selection to Shell Argument
      • From: David Wolfe <email@hidden>
References: 
 >Pass Finder Selection to Shell Argument (From: David Wolfe <email@hidden>)

  • Prev by Date: Re: Pass Finder Selection to Shell Argument
  • Next by Date: Re: Pass Finder Selection to Shell Argument
  • Previous by thread: Re: Pass Finder Selection to Shell Argument
  • Next by thread: Re: Pass Finder Selection to Shell Argument
  • Index(es):
    • Date
    • Thread