Dropbox Public Folder workflow broken with Lion 10.7.3

Hi, An other brilliant piece of Applescript from Macscripter which is now broken under Lion 10.7.3!

This one was part of a workflow to manage files sent to DropBox Public Folder:


property dropboxID : XXXXXXX
on adding folder items to thisFolder after receiving theItems
	try
		repeat with aitem in theItems
			set aitem to aitem as text
			
			set theoff to offset of "Public" in aitem
			set thepath to text (theoff + 7) thru -1 of aitem
			
			set thepath to my processpath(thepath)
			set the clipboard to thepath
		end repeat
	on error e
		tell me to activate
		display dialog e
	end try
end adding folder items to

on processpath(thepath)
	set AppleScript's text item delimiters to ":"
	set thepath to text items of thepath
	set AppleScript's text item delimiters to "/"
	set thepath to thepath as text
	set AppleScript's text item delimiters to " "
	set thepath to text items of thepath
	set AppleScript's text item delimiters to "%20"
	set thepath to thepath as string
	set AppleScript's text item delimiters to ""
	set theurl to "http://dl.dropbox.com/u/" & dropboxID & "/" & thepath
	return theurl
end processpath

Would appreciate feedback and a solution for a very handy script I use “ used :frowning: daily.
Thank you

Model: MacBook Pro (2010)
Browser: Safari 535.11
Operating System: Mac OS X (10.7)

What’s going wrong? What error messages do you get?

I tried the script in 10.7.3 and it worked, although it copies always only the URL of the last added file
I’d prefer this one

property dropBoxID : "1234567"

on adding folder items to this_folder after receiving added_items
	set theURLs to {}
	repeat with oneItem in added_items
		set {name:Nm} to info for oneItem
		set escapedName to do shell script "perl -e 'use URI::Escape; print uri_escape(\"" & Nm & "\")';"
		set publicURL to "http://dl.dropbox.com/u/" & dropBoxID & "/" & escapedName
		set end of theURLs to publicURL
	end repeat
	set {tid, text item delimiters} to {text item delimiters, return}
	set theURLs to theURLs as text
	set text item delimiters to tid
	set the clipboard to theURLs
end adding folder items to

This works perfectly, thanks again, same as an Application, not a Services (?!).

And like you, I just needed a specific file. My workflow consists of compressing the file, making name web-friendly, moving it to Dropbox and copying to public URL to clipboard. The most used script, daily.

So thank you so much for taking the time to fix these!!

Hello

As info for is officially deprecated I would not use it in a new script.

I would use :


property dropBoxID : "1234567"

on adding folder items to this_folder after receiving added_items
	set theURLs to {}
	repeat with oneItem in added_items
		--set {name:Nm} to info for oneItem
		tell application "System Events" to set Nm to name of disk item ("" & oneItem)
		set escapedName to do shell script "perl -e 'use URI::Escape; print uri_escape(\"" & Nm & "\")';"
		set publicURL to "http://dl.dropbox.com/u/" & dropBoxID & "/" & escapedName
		set end of theURLs to publicURL
	end repeat
	set {tid, text item delimiters} to {text item delimiters, return}
	set theURLs to theURLs as text
	set text item delimiters to tid
	set the clipboard to theURLs
end adding folder items to

Yvan KOENIG (VALLAURIS, France) jeudi 9 février 2012 17:56:30

Salu Yvan,

info for is deprecated since Leopard but it’s still working.
There are even a few functions in the CoreServices Alias Manager API which are deprecated since 10.3
and they’re still working too.

By the way: System Events recognizes alias specifiers


.
tell application "System Events" to set Nm to name of oneItem
.

Hello Stephan

Thanks for the alias feature.

I know that info for is deprected since Leo but it seem that Apple is making a bit of cleaning.
(1) In the Console report, we may see new messages : “this deprecated tool will be removed soon”.

(2) Since the Lion delivery, iWork apps refuse file names embedding slashes when we try to export the files.
Before Lion they were accepted (odd feature but some users were continuing to insert these chars).

So I think that when somebody build a new script, it’s safer to drop these deprecated features.
Of course it’s just an advice.

Yvan KOENIG (VALLAURIS, France) jeudi 9 février 2012 19:32:54

merci Yan pour completer ce script!