Hi Jon,
Firstly, I have been unable to get the script working without shifting
the code beginning with "tell application "Finder" to if not (exists
folder ifolder) then set if.........." after
using terms from application "Quicksilver"
        on open thefiles
On Sep 16, 1:42 am, "Jon Stovell (a.k.a. Sesquipedalian)"
<[email protected]> wrote:
> I've made a couple modifications so that the user doesn't have to
> manually edit the script, and posted in on the Applescript page.

Firstly, you have written

tell application "Finder" to if not (exists folder ifolder) then set
dropboxID to (choose folder with prompt "Please locate your DropBox
Public folder." & return & return & "The selected folder will be used
automatically from now on." default location (path to home folder)) as
text

Two changes need to be made:
1. instead of "dropboxID", it should be "ifolder"
2. "tell me to activate" should be added so that display dialog is in
front.

It should be

tell me to activate
tell application "Finder" to if not (exists folder ifolder) then set
ifolder to (choose folder with prompt "Please locate your DropBox
Public folder." & return & return & "The selected folder will be used
automatically from now on." default location (path to home folder)) as
text

> also changed it so that the resultant URL is sent to QS's first pane
> instead of to the clipboard. That way the user can do whatever they
> want with the URL.
>
Personally, I don't need this. But I tested it and have been unable to
get this to work. The reason is you have written
if dropboxID is null then set dropboxID to (display dialog "Please
enter your.........)
It should be
if dropboxID is null then set dropboxID to text returned of (display
dialog "Please enter your.........)

Lastly, I have to set the dropboxID and dropbox folder location every
time I run the script. That may have been because of the changes I
made to the script.

Here is the complete script:
property ifolder : (path to home folder as text) & "DropBox:Public"
property dropboxID : null
using terms from application "Quicksilver"

        on open thefiles
                tell me to activate
                tell application "Finder" to if not (exists folder ifolder) 
then set
ifolder to (choose folder with prompt "Please locate your DropBox
Public folder." & return & return & "The selected folder will be used
automatically from now on." default location (path to home folder)) as
text
                tell me to activate
                if dropboxID is null then set dropboxID to text returned of 
(display
dialog "Please enter your DropBox ID. You should only have to do this
the first time you run this script." & return & return & "To find your
Dropbox ID, go to your DropBox public folder and observe the URL of
any file that you have placed there by control-clicking the file and
then clicking Dropbox > Copy Public Link." & return & return & "If the
link is, e.g., http://dl.getdropbox.com/u/872780/filename.txt then
872780 is your DropBox ID." default answer "")

                repeat with afile in thefiles
                        tell application "Finder" to duplicate afile to folder 
ifolder
                        set afile to afile as text
                        set thename to name of (info for file afile)
                        set thename to my changename(thename)
                        set thename to "http://dl.getdropbox.com/u/"; & 
dropboxID & "/" &
thename
                        return thename
                        end repeat
        end open
end using terms from

on changename(thename)
        try
                set AppleScript's text item delimiters to " "
                set thetext to text items of thename
                set AppleScript's text item delimiters to "%20"
                set thetext to thetext as string
                set AppleScript's text item delimiters to ""
                return thetext
        end try
end changename


Reply via email to