cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Musicians, convert your MuseScore files to PDF to play music on the go! Learn more here.

View, download, and export

Need support with viewing, downloading, and exporting files and folders from your Dropbox account? Find help from the Dropbox Community.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Key Command/Shortcut to "Copy Dropbox Link" from Mac Finder.

Key Command/Shortcut to "Copy Dropbox Link" from Mac Finder.

Justin P.2
Collaborator | Level 10
Go to solution

I copy download links all day from the Mac Finder. It would be great to assign a key command so that you can highlight a file in your Dropbox via Mac Finder, and press a key command to copy the link instead of right clicking.

67 Replies 67

porg
Helpful | Level 5
Go to solution

@Justin P.2 great that you provided a script as a proof of concept to Dropbox!

  • For now to me personally not worth to go the extra setup mile as I paste ca. 15 links per week.
  • But once that's up to 50+ I would certainly go for that script, and soon have that amortized.

@Dropbox Team

  • This should just integrate into macOS standard keyboard assignment mechanisms at:
    System Preferences → Keyboard → Shortcuts → Services or App Shortcuts (depending on the implementation)

porg
Helpful | Level 5
Go to solution

Correction:

@Justin P.2thanks for raising this.

@Gene_Parmesan thanks for the script to prove it's possible. 

dhermanq
Helpful | Level 6
Go to solution

@Gene_Parmesanthis is exciting! I've finally had the chance to try out the new version, starting from scratch with your instructions on GitHub. I've gotten to Step 12 (Call the script once and follow the instructions to get a refresh token the first time), however when I run the script from Terminal I get the following result:

 

Traceback (most recent call last):
File "/Users/dherman/bin/get_dropbox_link.py", line 37, in <module>
import dropbox
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/dropbox/__init__.py", line 3, in <module>
from dropbox.dropbox_client import ( # noqa: F401 # pylint: disable=unused-import
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/dropbox/dropbox_client.py", line 18, in <module>
import requests
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py", line 38, in <module>
raise ImportError(
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3. See: https://github.com/urllib3/urllib3/issues/2168 

 

I tried moving forward with your instructions and created an Automator workflow to run the script, then used Keyboard Maestro to trigger it. This is the result:

 

Shell Script” encountered an error: “Traceback (most recent call last):
File "/Users/dherman/bin/get_dropbox_link.py", line 37, in <module>
import dropbox
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/dropbox/__init__.py", line 3, in <module>
from dropbox.dropbox_client import ( # noqa: F401 # pylint: disable=unused-import
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/dropbox/dropbox_client.py", line 18, in <module>
import requests
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py", line 38, in <module>
raise ImportError(
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3. See: https://github.com/urllib3/urllib3/issues/2168” 
2023-05-19 14:43:26 Action 441 failed: Execute an Automator Workflow failed with script error: The action “Run Shell Script” encountered an error: “Traceback (most recent call last):
File "/Users/dherman/bin/get_dropbox_link.py", line 37, in <module>
import dropbox
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/dropbox/__init__.py", line 3, in <module>
from dropbox.dropbox_client import ( # noqa: F401 # pylint: disable=unused-import
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/dropbox/dropbox_client.py", line 18, in <module>
import requests
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py", line 38, in <module>
raise ImportError(
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3. See: https://github.com/urllib3/urllib3/issues/2168” 
2023-05-19 14:43:26 Execute an Automator Workflow failed with script error: The action “Run Shell Script” encountered an error: “Traceback (most recent call last):
File "/Users/dherman/bin/get_dropbox_link.py", line 37, in <module>
import dropbox
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/dropbox/__init__.py", line 3, in <module>
from dropbox.dropbox_client import ( # noqa: F401 # pylint: disable=unused-import
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/dropbox/dropbox_client.py", line 18, in <module>
import requests
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/Users/dherman/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py", line 38, in <module>
raise ImportError(
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3. See: https://github.com/urllib3/urllib3/issues/2168”  in macro “Copy Dropbox Link” (while executing Execute “Copy Dropbox Link” Automator Workflow).

 

I'm a bit out of my depth as to what this all might mean -- if you have any thoughts they would be welcome and appreciated!

Gene_Parmesan
Collaborator | Level 8
Go to solution

Thanks for giving the updated script a try, @dhermanq, sorry it’s not working for you. 🤔 Porg is having a similar issue, so clearly the instructions could use some refinement.

There are several suggestions in this Stack Overflow issue. Because I’m not able to reproduce the issue, I fear it will be up to you to do the actual troubleshooting, but do report back if you find something that works.

The first thing I’d try would be to install Dropbox this way:

 

python3 -m pip install dropbox

 

 

markcq
Helpful | Level 5
Go to solution

Unfortunately none of the suggestions work for me, because you lose me at:

 

"I had initially installed pip3 install dropbox (the module) as your README.md instructed."

 

What does that mean for a non-programmer? To be honest, the whole story is so convoluted that I get a headache just trying to read the instructions. So I manually right click on each item and copy the dropbox link (which I have to do many times per day)... Why is it so complicated for DB to just make a keyboard shortcut?

 

@dropboxWhy is there not an option for this in System Preferences → Keyboard → Shortcuts → Services? Then we can make our own shortcut...

 

Gene_Parmesan
Collaborator | Level 8
Go to solution

I've spent a bit more time with this and I think I've resolved the Python and Automator issues. Please see the new instructions in the repo README, and let me know if there are any further problems! @dhermanq @porg Note that I have fixed a problem with duplicate links caused by an unneeded "Get Selected Finder Items" action.

 

I've added threading too. Now even relatively large sets of links can be generated efficiently. There are 10 workers by default, hopefully that will strike a good balance between speed and keeping on the right side of any rate limits on Dropbox's API.

dhermanq
Helpful | Level 6
Go to solution

@Gene_Parmesan thanks for the additional help on this! I've made some progress with the new script and instructions. I took your suggestion to pin urllib3 to version 1.26.6, and that allowed me to generate the API access code. However, now when I try running my Automator workflow I get the following error:

The action “Run Shell Script” encountered an error: “usage: get_dropbox_link.py [-h] [--verbose] paths [paths ...]
get_dropbox_link.py: error: the following arguments are required: paths” in macro “Copy Dropbox Link”

 

Would this have something to do with the fact that either a) I use a Dropbox business account (I've changed the AccountType variable in your script accordingly), or b) I keep my Dropbox files on a removable drive, and not the standard ~/Dropbox path?

 

I do appreciate for all the thought and attention you've put into this thus far!

Gene_Parmesan
Collaborator | Level 8
Go to solution

You're almost there! This output means that the script IS running successfully, but it's not receiving the list of selected paths. My guess is that you are passing input "to stdin" instead of "as arguments". Either that, or your script in the Automator action doesn't have "$0" after it. Might either of these be the culprit?

 

Or what about "Workflow receives current files or folders in Finder"?

dhermanq
Helpful | Level 6
Go to solution

@Gene_ParmesanI had used "$@" in the automator script per the instructions and the Automator workflow you posted. I tried switching that to "$0" instead, but now I get a slightly different error:

 

2023-05-24 16:08:45 !ActionCanFail() for Action Execute “Get Dropbox Link.workflow” Automator Workflow in macro Copy Dropbox Link with failure Execute an Automator Workflow failed with script error: The action “Run Shell Script” encountered an error: “ERROR:root:'/Users/dherman/-' is not in the subpath of '/Volumes/STUDIO D DROPBOX/Good Studio Dropbox/David Herman' OR one path is relative and the other is absolute.”
2023-05-24 16:08:45 Action 441 failed: Execute an Automator Workflow failed with script error: The action “Run Shell Script” encountered an error: “ERROR:root:'/Users/dherman/-' is not in the subpath of '/Volumes/STUDIO D DROPBOX/Good Studio Dropbox/David Herman' OR one path is relative and the other is absolute.”
2023-05-24 16:08:45 Execute an Automator Workflow failed with script error: The action “Run Shell Script” encountered an error: “ERROR:root:'/Users/dherman/-' is not in the subpath of '/Volumes/STUDIO D DROPBOX/Good Studio Dropbox/David Herman' OR one path is relative and the other is absolute.” in macro “Copy Dropbox Link” (while executing Execute “Get Dropbox Link.workflow” Automator Workflow).

 

I'm attaching a screenshot of my Automator workflow below. It looks like I do have Pass inputs set to "as arguments."

 

My Dropbox Volume name has spaces in it — could that be part of the issue?

 

Screen Shot 2023-05-24 at 4.10.56 PM.png

 

dhermanq
Helpful | Level 6
Go to solution

I should clarify, that screenshot is of my original workflow, before I changed the script to "$0"

Need more support?