placeing an item in a folder starts a new email

Hi Stefen,

OK…here is what I did…see my path to the a folder I made on my desktop.

property archiveFolder : “Macintosh HD:Users:training3:Desktop:drop:” – the colon at the end is important!

on adding folder items to this_folder after receiving these_items
repeat with i in these_items
set fileName to name of (info for i)
tell application “Microsoft Entourage”
tell (make new outgoing message with properties ¬
{to recipients:"barbara.press@tiffany.com", subject:fileName, content:fileName & " has been added to folder " & this_folder as text})
send
end tell
end tell
set newFileName to do shell script “/bin/date +%y%m%d-%H%M%S_” & fileName – adds a timestamp to the filename
do shell script "/bin/mv " & quoted form of POSIX path of i & space & quoted form of (POSIX path of archiveFolder & newFileName)
end repeat
end adding folder items to

I added the folder action to a folder called Put Here and they were to move to the drop folder based on my path above.
They didn’t move out of the put here folder, and when I moved them out manually, they rean the script again and sent the following message to my email address:

…DS_Store has been added to folder Macintosh HD:Users:training3:Desktop:put
here:

I also need to put back the link to the file, but I can do that. just trying to figure out this archive folder.

thanks :wink:

Again, can you please use the [ applescript ] tags, it’s easier to read and to open the script.
This version filters all files which start with a dot


property archiveFolder : "MacHD:path:toArchiveFolder:" -- the colon at the end is important!

on adding folder items to this_folder after receiving these_items
	repeat with i in these_items
		set fileName to name of (info for i)
		if fileName does not start with "." then
			tell application "Microsoft Entourage"
				tell (make new outgoing message with properties ¬
					{to recipients:"John@Doe.com", subject:fileName, content:fileName & " has been added to folder " & this_folder as text})
					send
				end tell
			end tell
			set newFileName to do shell script "/bin/date +%y%m%d-%H%M%S_" & fileName -- adds a timestamp to the filename
			do shell script "/bin/mv " & quoted form of POSIX path of i & space & quoted form of (POSIX path of archiveFolder & newFileName)
		end if
	end repeat
end adding folder items to

Hi Stefen,
I am so sorry…didn’t see your blub about the applescripts tag…so they go into that format that allows you to open them right up ;-(
I will look to see how to do that…
we are almost there…It still didn’t move to my drop folder, but least I could move it out without it sending it again.
I am going to find out how to add the code to make it look like a real script in your viewer and I will go find the code to add the link.
will be back soon :wink:
ba

Just highlight the lines in the reply window and press the AppleScript button.

I’ve tested the move part of folder action. It works perfectly on my machine. Is the path to your archive folder valid?

Just highlight the lines in the reply window and press the AppleScript button.

mega duh :wink:

I’ve tested the move part of folder action. It works perfectly on my machine. Is the path to your archive folder valid?

it just worked perfect…maybe it needed to warm up…

As much as I am trying to learn this stuff, I will never understand the POSIX path … thanks so much for all your help!!!
And thanks for showing me how to actually put my script in the window properly…

babs

It’s quite easy.
As AppleScript was released in 1993(!) with System 7whatever, OS X with the UNIX kernel was far far far away.
Since the early days AppleScript works with HFS paths (colon separated).
As OS X was released there was a terminology conflict, because UNIX and also the native programming language Objective-C works with POSIX paths (slash separated).

If you write plain AppleScript code you can use only HFS paths.
If you bridge to the shell or in AppleScript Studio to ObjC you have to pass the paths as POSIX paths

Interesting…
Still over my head as I am not a programmer, but that is why I keep plugging away…little by little :wink:
This is a far cry from what I do, so it is quite challenging.
Of course I would never be able to do anything without the help of the 2 courses I took and people like you :wink: