Solves an issue of using a direct URL of the file in the upload file dialog on macOS, similar(-ish) as it is implemented on Windows.
- Shell script
- launchd
-
Clone this repository.
-
Install LaunchControl app in order to have
fdautil
utility installed-
Install LaunchControl either from its web-site or via HomeBrew:
brew install launchcontrol
. -
LaunchControl ships a utility called fdautil which allows you to grant Full Disk Access to a script without compromising Apple's new security feature. The utility can be installed via the LaunchControl preferences Utilities panel.
-
When installing fdautil LaunchControl will ask you to add it to the list of programs with Full Disk Access.
-
-
From the cloned repository folder run the install.sh:
./install.sh
It will modify the template of a .plist file and copy it to "~/Library/LaunchAgents/" folder. It will also copy the actual script to "~/.config/scripts/" folder.
- There will be a "url-file-watcher" folder created on desktop with an empty "url" file in it
- First copy an URL of a file you want to upload elsewhere without "http://" or "https://" part (eg. if an original URL is "http://site.com/file.jpg", copy the "site.com/file.jpg" part of it)
- Select an upload option on the site you want to upload a file to and open a "~/Desktop/url-file-watcher" folder
- Right in the opened dialog rename the "url" file to the part of the URL you've copied previously (eg. rename "url" to "site.com/file.jpg") and press Enter
- Wait few seconds until a new (downloaded) file will appear in the same folder and select it for the upload
- The downloaded file will be removed automatically and an empty "url" file re-created after few seconds
- You can adjust the number of seconds the downloaded file is kept by editing the line
sleep 15
in the "url-file-watcher.sh" file (by default placed to "~/.config/scripts/" folder)
- Based on the solution of https://apple.stackexchange.com/a/409659/396803
- https://ss64.com/osx/
- https://forum.zettelkasten.de/discussion/comment/8184/#Comment_8184
- https://mayeu.me/post/how-to-trigger-any-action-when-a-file-or-folder-changes-on-macos-on-the-cheap/
Distributed under the MIT License.