Re: Pass Finder Selection to Shell Argument
Re: Pass Finder Selection to Shell Argument
- Subject: Re: Pass Finder Selection to Shell Argument
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 5 Sep 2007 22:03:25 -0400
Sorry, additemtodock, not addfiletodock.
Also, it appears that you sent your message with an explicit reply-to
so replies will go to you instead of the list.
On 9/5/07, Mark J. Reed <email@hidden> wrote:
> You need to get the file's posix path. See if this (untried) works:
>
> tell application "Finder"
> set chosenFile to the selection as alias
> end tell
> do shell script "addfiletodock " & quoted form of POSIX path of chosenFile
>
>
> On 9/5/07, David Wolfe <email@hidden> wrote:
> > 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
> >
>
>
> --
> Mark J. Reed <email@hidden>
>
--
Mark J. Reed <email@hidden>
_______________________________________________
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