copy url + filename to clipboard

Hello, I’m new to applescript… Well in understanding it. :slight_smile:
I have an upload script, if I save a picture to a certain folder, it will upload the file to the photodirectory on my website. Now I want to get me the complete URL of the uploaded photo.

I know how to set the cliboard with


	set the clipboard to "http://website.com/mysite/photos/"

But I cannot get the filename with it. Can someone please telle me the trick? Thanks!

Assuming the name of the file is in a variable called ‘filename’ you can simply:

set the clipboard to "http://website.com/mysite/photos/" & filename

in other words, just use the & concatenation symbol to combine strings into a single object.

Thank you, I tried it before but I guess my filename is not a variable yet because I only get my URL.

How can I set the filename when a file is copied into a folder?

OK, now I’m confused.

Where are you getting the file name you want to append to the URL? You say you ‘only get [your] URL’, but you’re asking about files in folders?

It isn’t clear to me what you’re trying to achieve so any advice is likely to send you in the wrong direction. Can you explain more?

ok, sorry here’s the complete script;


-- Fetch upload script
-- written by Rob Stewart
--
-- This script uploads whatever files are dropped into a folder
-- 
-- Create a folder structure on your desktop that corresponds to the folder struture
-- from the root web directory
--
-- Attach this script to any folder that you want to automatically upload from
-- (ctrl-click a folder to attach a script to it)
--
-- The folder must be open when you drop in the files for the script to work
--
-- The corresponding directories must exist already online
--
-- The script will give up after two minutes of trying
--
-- The script is set up to work up to four folders "deep" (i.e. three sub-folders)
-- Let me know if you wish to use a folder structure that is deeper
--
-- The script will notify you after a successful upload
--
-- Robert Stewart  rstewart@rdgrp.com







on adding folder items to myFolder after receiving myFiles
	set this_item to myFolder as string
	--set name to myFile
	set AppleScript's text item delimiters to {":"}
	try
		set folder3 to the third text item of this_item
	on error myErr
	end try
	try
		set folder4 to the fourth text item of this_item
	on error myErr
	end try
	try
		set folder5 to the fifth text item of this_item
	on error myErr
	end try
	try
		set folder6 to the sixth text item of this_item
	on error myErr
	end try
	try
		set len3 to the length of folder3
	on error myErr
	end try
	try
		set len4 to the length of folder4
	on error myErr
	end try
	try
		set len5 to the length of folder5
	on error myErr
	end try
	try
		set len6 to the length of folder6
	on error myErr
	end try
	set AppleScript's text item delimiters to {""}
	set exists3 to 0
	set exists4 to 0
	set exists5 to 0
	set exists6 to 0
	try
		if len3 > 0 then set exists3 to 1
		endif
	on error myErr
	end try
	try
		if len4 > 0 then set exists4 to 1
		endif
	on error myErr
	end try
	try
		if len5 > 0 then set exists5 to 1
		endif
	on error myErr
	end try
	try
		if len6 > 0 then set exists6 to 1
		endif
	on error myErr
	end try
	set myFolderName to folder3
	if exists4 > 0 then set myFolderName to myFolderName & "/" & folder4
	if exists5 > 0 then set myFolderName to myFolderName & "/" & folder5
	if exists6 > 0 then set myFolderName to myFolderName & "/" & folder6
	set myURL to "ftp://blabal.nl/fotos/"
	with timeout of 120 seconds
		tell application "Fetch 4.0.2"
			repeat with x in myFiles
				put into url myURL item x
			end repeat
			quit
		end tell
	end timeout
	--	display dialog "Files upload successfully."
	
	set the clipboard to "http://blabla.nl/fotos/"	
end adding folder items to


How can I retrieve the URL + filename that has been copied to the window… Thanks!