Creat Sym link for Dropbox

Hi,
I am new to Apple Scripting, so by doing some reading and searching online managed to put this together.

I managed to manually setup my DropBox(DBX) account as a sync tool for some of my desktop app preferences.
DBX supports Symbolic Links to sync files outside the standard DBX folder.
This works great to get an application like Adium to sync account information and extras between multiple computers.

This is what I have come up with so far.
I know that this line is wrong, actually not even close.

  1. I dont know how to drop the trailing slash from the POSIX output
  2. I am not giving it the final sym link name.

Not sure how to do this, found a few examples with if statement but cannot figure out how to integrate it into this script.

The script that works directly in terminal for reference:

This is the full script,

thanks

If I’m understanding your situation, I think you want to select a folder in your user’s application support folder and have a symbolic link for that folder created in your dropbox application support folder. If so then the following should work. The main problem that I see with your “ln” command is that it has no spaces in it (you need spaces between the paths and also the ln command) and the source path should come before the destination path. I would write that script like this… notice that the Finder is only needed for one line of the script so we do not “tell application Finder” to do everything, we only tell it to do that one line.

set dropboxAppSupportFolder to (path to home folder as text) & "Dropbox:Library:Application Support:"

-- verify that the Dropbox folder exists
try
	alias dropboxAppSupportFolder
on error
	error "The dropbox application support folder does not exist. Please create it before running this script."
end try

-- select the folder that you want to create the sybolic link for
set inPath to choose folder default location (path to application support folder from user domain) with prompt "Choose a folder. A symbolic link will be created for it in Dropbox's Application Support folder."

-- get the name of the inPath so we can calculate the outPath
tell application "Finder" to set folderName to name of inPath
set outPath to dropboxAppSupportFolder & folderName

-- verify that the outPath does not exist
try
	alias outPath
	error "The folder already exists in the dropbox application support folder. Please try again."
end try

-- Shell Script to create symbolic link
do shell script "ln -s " & quoted form of POSIX path of inPath & space & quoted form of POSIX path of outPath

Thanks for the reply, Learnt a so much from it!

I now understand more about the “do shell script” command.

I still would like the user to choose their own Dropbox location as this is something they can change on the install.
Below is the final script that actually does what I need, however the second step to select the destination folder can be automated… which I will play around with.

Thanks again for the help!