Applescript/Automator task to change default downloads folder I need to create an automation to make a new folder named by my selected text and then make that folder the new default Safari downloads folder. This would be the default folder when I click on a download file link from a webpage until I run the script again for a new selection. 

edit: this may seem trivial but I have to click a URL to download 5-8 .pdf files (I have to click on each file separately) per order for about 30 orders a day and I have to make a folder named by the the order number to put the files in. I have done a lot of research and I'm not sure if this is something that can be done with AppleScript or if it also requires Shell script and is something I will have to pay for to be developed. I did post a freelancer post hoping someone could code it but I'm looking for an easier solution from someone smart in these boards. thank you so much for any help or guidance.
Open Automator and create a new service:


Choose: Service receives selected text in Safari like in the screenshot below.


Then add an item Run AppleScript with the content:

on run {input} -- create folder from text

    display dialog " —Create folder from chosen text—
This AppleScript will create  a folder from text you specify."
    set destination to (choose folder with prompt "Where would you like to make the folder?")

    tell application "Safari"
        activate
        if (input exists) then
            set folderName to input
            -- of text of document 
        else
            beep
        end if
    end tell
    tell application "Finder"
        activate
        make folder in destination with properties {name:folderName}
        --select folder "untitled folder" in the destination 
        --set the name of the selection to folderName 
    end tell

    tell application "Safari"
        activate
    end tell

end run

Save the service as Create Folder from Text.


Then in Safari choose some text and right-click it -> Services -> Create Folder from Text.

If the destination folder already contains a folder with the same name the service fails without any further notice.



If you don't like the dialog "—Create folder from ..." add a # in front of it or remove the two lines.



If you replace:

        tell application "Safari"
            activate
        end tell


by

        tell application "Safari"
            activate
            set destination to (choose folder with prompt "Where would you like to save the new file(s)?")
        end tell


the Automator service will open the new folder and ask you to choose the new folder as new download folder. Simply hit Choose. If you then right-click the download link -> Download linked file as…, the file will be downloaded to the new folder.

The script may be improved further, because I didn't get it to work to set the new folder as new download destination automatically.