Created
January 31, 2017 18:11
-
-
Save grahams/27288cdf5bd17aa59d570e69d6349fb8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function run(argv) { | |
var app = Application.currentApplication() | |
app.includeStandardAdditions = true | |
var Finder = Application('Finder') | |
var selection = Finder.selection() | |
if(selection.length === 1) { | |
var url = selection[0].url() | |
var file = url.substring(7, url.length); | |
if( (file.toLowerCase().indexOf("resilio") > -1) && | |
(file.toLowerCase().indexOf("public") > -1) ) { | |
var pubUrl = file.replace(/^.*Resilio%20Sync\/Public/, "http://grahams.wtf/public") | |
app.setTheClipboardTo(pubUrl) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I created a Resilio Sync share that is on my desktop as well as a machine running a public web server. When I add files to the share from my local machine, it's mirrored into that public web space. I did this to replicate the Dropbox "Public" folder functionality.
This script, which I call from an Alfred workflow, will get the currently selected file in the Finder and rejigger the path so that it is a link to the file on the public web server.
If you'd like a more Automator friendly version of this script, look here: https://gist.github.com/grahams/9aa80b06db160bc027e2aee70a685974