Topic: Finder Path

Is it possible to have an action in Dropzone 3 to copy the path of a file?

thx

Re: Finder Path

Yep - The 'Finder Path' action does just this. You select a file in the Finder and then click the Finder Path action in your grid and it copies the selected file path to the clipboard.

You can install the Finder Path action here:

https://aptonic.com/dropzone3/actions/i … der%20Path

Re: Finder Path

Got it, thanks. I downloaded the unsandboxed version and installed the action. I'd swear I checked the download actions page before I posted.

Re: Finder Path

Is there an example that gets the current Finder selection and puts the path in a variable using Python? I don't know Ruby, and it isn't clear from the example.

Thanks!

Re: Finder Path

Yep, the below will do this using Python:

# Dropzone Action Info
# Name: Print Finder Path
# Description: Prints the selected Finder Path to the Dropzone debug console using Python.
# Handles: Files
# Creator: Aptonic
# URL: http://aptonic.com
# Events: Clicked
# SkipConfig: No
# RunsSandboxed: Yes
# Version: 1.0
# MinDropzoneVersion: 3.5

import subprocess

def clicked():

    script = '''
    tell application "Finder"
        try
            set theSelection to (target of window 1 as alias)
            set theSelection to theSelection as string
            set finder_path to POSIX path of (the selection as alias)
        on error
            set finder_path to null
        end try
    end tell
    if finder_path is not null then return finder_path
    '''

    proc = subprocess.Popen(['osascript', '-'],
                            stdin=subprocess.PIPE,
                            stdout=subprocess.PIPE)
    stdout_output = proc.communicate(script)[0]
    selected_finder_path = stdout_output

    print (selected_finder_path)
    
    dz.finish(selected_finder_path)
    dz.url(False)