set dbPubStr to ((path to home folder as text) & "Dropbox:Public:") Set dbBaseURL to "" & strDropBoxAcctNum & "/" #JM# set strDropBoxAcctNum to "1234567" - Your DropBox Acct#JM# #Dropbox link forum code#You should publish your code at MacScripters so other AppleScript coders can easily find it. I made a couple of small changes, mostly for my benefit, the most important of which is changing the error msg (last line in the below code). So the error msg threw me for a loop at first. My DropBox folder is setup in /Users/Shared/, not in Home. Your last script worked perfect! Well, almost perfect. Chris, you are the champion of champions! If you don't care who sees your static user number the job is simple to do with basic AppleScript. If button returned of dDlg = "Copy" then set the clipboard to e Set _sel to joinList(_sel, linefeed) of me & linefeed Set contents of i to (dbBaseURL & (text item 2 of (get i's URL))) If (hfsPath does not contain dbPubStr) or (hfsPath = dbPubStr) thenĮrror "Selection not in Public Dropbox folder." Set AppleScript's text item delimiters to "/Dropbox/Public/" Set dbPubStr to ((path to home folder as text) & "Dropbox:Public:") # Task: Copy Public Dropbox URLs from selected files to the Clipboard. You replace dbBaseURL with your address by getting copying a public link once with the Dropbox UI, and you’re ready to go to town. If you don’t care who sees your static user number the job is simple to do with basic AppleScript. So, if you’re giving the link to someone else the scripted method is going to be better, because it anonymizes the link just like the latter example. Here’s what a link from the Dropbox site looks like: Here’s what a public link copied from the Finder using Copy-Public-Link looks like (I’ve changed the user-number): However it’s pretty pointless to use Dropbox’s UI for this, because the result can be easily duplicated. Tell menu button 1 of group 6 of toolbar 1 Set frontWin to (first window whose role is "AXWindow") (This is tested on 10.10.4 - different versions of OSX can have subtle or not so subtle variations.) tell application "System Events" This won’t be quite right, because the parameters depend upon where you put the Dropbox button in the toolbar. #Dropbox link forum install#Nevertheless if you want to install the Dropbox toolbar-button it’s pretty easy. Scripting the contextual-menu with System Events is broken in list-view but seems to work in icon-view. What about using AppleScript to have the Finder execute the “Copy Public Link” context menu item?
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |