Re: Pass Finder Selection to Shell Argument
Re: Pass Finder Selection to Shell Argument
- Subject: Re: Pass Finder Selection to Shell Argument
- From: Bruce Robertson <email@hidden>
- Date: Thu, 06 Sep 2007 09:49:26 -0700
Additemtodock seems to be an unrecognized command. Trying to use it as you
suggest or trying man additemtodock both result in errors.
Where did it come from?
> That did the trick. Thanks Mark!
>
> Added the script to a "Do Applescript" in an otherwise empty
> Automator Workflow. Saved as a Finder Plug-in named "Send to Dock."
> Now I can select any file in the Finder, right click, choose
> "Automator > Send to Dock." And the file will be added to the Dock.
> The nifty shell script that makes it happen determines if the file is
> already in the Dock (and reports that it won't be added again), is an
> Application (.app files go to the left of the Dock's divider line),
> or another type of file (gets added to the right of the divider). I
> tested with an VISE installer (no .app extension). It got added to
> the right of the divider, but upon a subsequent addition, when the
> Dock restarted, the installer had been moved to the left of the
> divider, so the Dock itself must be able to determine where a file
> should belong once it's added too.
>
> Thanks for your help.
>
> David Wolfe
>
> On Sep 5, 2007, at 10:03 PM, Mark J. Reed wrote:
>
>> 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 (applescript-
>>>> email@hidden)
>>>> Help/Unsubscribe/Update your Subscription:
>>>>
>>> 40mail.com
>>>> 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 (applescript-
>> email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> 40settingpace.com
>> Archives: http://lists.apple.com/archives/applescript-users
>>
>> This email sent to 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
_______________________________________________
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