Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'One way to share links to networked files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
One way to share links to networked files
Authored by: chleuasme on Mar 23, '09 02:02:16PM
To create .afploc files, i propose this Applescript :
set afploc_begin to "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
	<key>URL</key>
	<string>"

set afploc_end to "</string>
</dict>
</plist>"

set cmd_txt to (quoted form of afploc_begin) & "$afpurl" & (quoted form of afploc_end)


tell application "Finder"
	set elts to get selection
	repeat with elt in elts
		set f to POSIX path of (elt as string)
		set fn to name of elt
		set p to POSIX path of ((container of elt) as string)
		set afploc to quoted form of (p & fn & ".afploc")
		set s to text returned of (display dialog "Enter the server for " & f default answer "afp://")
		set afpurl to s & (do shell script "/bin/echo -n " & f & " | ruby -ruri -p -e '$_=URI.encode$_' | sed 's:^/Volumes::'")
		
		do shell script "afpurl=" & afpurl & "; echo " & cmd_txt & " > " & afploc
	end repeat
end tell
(again, use at your own risk, with same problems on files or folder with a name containing the character '/')

I don't know a way to obtain the afp server given a mount point, to avoid the dialog.

[ Reply to This | # ]