Sending filename (not the path) with Watch folder

Hello everyone, I want to do the following with a watch folder:

  1. after the file is transferred, it triggers a droplet to create a .mp4.

  2. send a message to a user through Messages, saying that the file has been transferred. I only want to send the filename and not the path of the filename.

Here is the code:

–Open this Scriplet in your Editor:–

on adding folder items to thisFolder after receiving theItems

repeat with f in theItems
	# f is an alias
	set Was to 0
	
	set isNow to 1
	
	repeat while isNow ≠ Was
		
		delay 5
					
	end repeat
end repeat


tell application "Finder"
	
	
	open theItems using application file "Conversion.app" of folder "Desktop" of folder "Macintosh HD" of folder "Users" of startup disk
	
	
end tell

delay 2

tell application "Messages"
	activate
	delay 2
	set myid to get id of first service
	set theBuddy to buddy "jperson@web.ca" of service id myid
	send "" & theItems & " has been sent into master and Proxy folder" to theBuddy
	delay 2
	quit
end tell

end adding folder items to

This code works, but it will send back the full name path of theItems. (Macintosh HD:Users:me:Movies:this Story.mov)
I want to only send back the name of the file (this Story.mov).

When I try to set the name of theItems to another name (set fileName to the name of theItems), it will not send a message. Please help.

Cheers!

You may use something like :

on adding folder items to thisFolder after receiving theItems
	tell application "Finder"
		set theNAme to name of item 1 of theItems
	end tell
end adding folder items to

Yvan KOENIG (VALLAURIS, France) jeudi 15 janvier 2015 21:48:57

That worked!

Thank you once again Yvan.

I really appreciate your help.

Chad