• 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
Pass Finder Selection to Shell Argument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pass Finder Selection to Shell Argument


  • Subject: Pass Finder Selection to Shell Argument
  • From: David Wolfe <email@hidden>
  • Date: Wed, 5 Sep 2007 17:22:29 -0400

Hi everyone,

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

I've also tried setting the selection to a variable like:

	on run {input, parameters}
		tell application "Finder"
			set theFile to selection
			do shell script "additemtodock " & theFile
			return
		end tell
	end run

But I get nothing.

The shell script "additemtodock" works when run alone in the shell, given any file as an argument (additemtodock filename)

If I run the Applescript:

		tell application "Finder"
			set theFile to selection
			do shell script "additemtodock " & theFile
			return
		end tell

the Dock is restarted, but the item is not added. Script Debugger does correctly show the List of the selection, however. If I run the Automator Workflow, the same thing happens--the Dock is restarted, but the item is not added.

Any help is greatly appreciated.

Thanks,
David Wolfe

_______________________________________________
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: Christopher Nebel <email@hidden>
  • Prev by Date: Re: Another FileMaker Applescript Question....
  • Next by Date: Re: Another FileMaker Applescript Question....
  • Previous by thread: Re: Mac Mail does not work as I want :)
  • Next by thread: Re: Pass Finder Selection to Shell Argument
  • Index(es):
    • Date
    • Thread