finder script to move folder with property...

tell application “Finder”
activate
select window of desktop
select window of desktop
tell application “Finder”
activate
set theFoldername to the clipboard
select window of desktop
make new folder at folder “Desktop” of folder “UEIArtEmail” of folder “Users” of startup disk with properties {name:theFoldername}
select window of desktop
make new folder at folder “Desktop” of folder “UEIArtEmail” of folder “Users” of startup disk with properties {name:“1”}
select window of desktop
make new folder at folder “Desktop” of folder “UEIArtEmail” of folder “Users” of startup disk with properties {name:"orig "}
move the selection to folder "orig " of folder “Desktop” of folder “UEIArtEmail” of folder “Users” of startup disk
move folder "orig " to folder “1” of folder “Desktop” of folder “UEIArtEmail” of folder “Users” of startup disk
end tell
end tell

i am trying to get the clipboad anmed folder contain folders orig and 1 and then move to server…

sorry iam a learning cahllenged newbie…any help would be appreciated…tia, KC

Hi Kevin, and welcome.

Tell us exactly what you want to accomplish if you would. I gather you want to move a folder and give it a new name at its destination, but it’s not clear how you want to specify the folder. I gather that the new name will be in the clipboard, but how did it get there?

Err umm, what are you trying to do? With a bit more details please.

Hi Kevin,

there are a few useless and double statements in your script :wink:

I try to decipher it:
Assuming taking a name from the clipboard,
creating a folder with this name on the desktop,
with a folder “1” in it and a folder “orig” in folder “1”
and moving all files from desktop to folder “orig”
try this:

set theFoldername to the clipboard
set theFolder to make_new_folder(desktop, theFoldername)
set FolderOne to make_new_folder(theFolder, "1")
set FolderOrig to make_new_folder(FolderOne, "orig  ")
tell application "Finder" to move every file to FolderOrig

on make_new_folder(theFolder, fName)
	try
		return ((theFolder as Unicode text) & fName) as alias -- does the folder already exist?
	on error -- if not, create one
		tell application "Finder" to return (make new folder at theFolder with properties {name:fName}) as alias
	end try
end make_new_folder

stefan,

upon running i recieved “applescript error - finder got an error: can’t make class folder.”

simply i opened and ran code you posted - do i need to add code of my own? I really like how compact the code you posted is…i really have a lot to learn

Thank you so much for your help and any explanation would be great.

I very much am not an applescripter-probably should go without saying-i’ve been mac’ing if for almost 20yrs now(wow). Though never delved into applescripting … till now.

So please, be patient and very critical of my coding-here’s what worked for me though i am VERY interested in your code.


tell application "Finder"
	activate
	set theFoldername to the clipboard
	make new folder
	make new folder at folder "Desktop" of folder "UEIArtEmail" of folder "Users" of startup disk with properties {name:"1"}
	make new folder at folder "Desktop" of folder "UEIArtEmail" of folder "Users" of startup disk with properties {name:"orig  "}
	move the selection to folder "orig  " of folder "Desktop" of folder "UEIArtEmail" of folder "Users" of startup disk
	move folder "orig  " to folder "1" of folder "Desktop" of folder "UEIArtEmail" of folder "Users" of startup disk
	move folder "1" to folder "untitled folder"
	set name of folder "untitled folder" to the clipboard
end tell

Currently use eudora as email application…i dont care which email program i use and would get any which i could applescript better to do the following.

Basically, email whose address book matches a nickname prints, move the attachments and email text into a client folder (folder name=from field of email) which contains a folder (name = email1 or email2 or email3, etc-depends on how many emails i receive). Then move the client folder contain the above to a server folder called “today.” Then rename the folder on server called today - with that days date at midnight…LOL i can’t believe i got all that in one paragraph and seemingly coherent…

and i am thinking maybe i’d like the email to be pdf’d with attachments with pdf as attachments (acrobat Professional allows for this)- i contacted adobe they pretty much told me to go fish and then never responded again) I’ve looked at their LiveCyle program/workfflow, but hesitate because it appears to be only available on Windows…yikes!

I’ve also thoght it’d be better yet to some how take the email matching the nicknames and make html with attachments as links…then make that html/linked attachments available to intranet…

and Finaly, is there some way to script the body of an email to embed as metadata or xml into the attachments associted to the email it was rec’d with?

The reason i am posting all this is i am sure i am not the only one who processes email orders (150 a day) whose attachments and email text needs to be saved, and attachments include most every type of graphics programs (we are a medium sized company makingcopper and brass dies),

Someone asked for detail…hehe…thanks again for any help here…i cannot tell anyone how much this site has already helped! Thanks to all here!

KC

Hi Kevin,

you’re right, my code above doesn’t work, because I removed the Finder tell block,
and only the Finder knows what desktop is, AppleScript itself needs path to desktop
this works:

set theFoldername to the clipboard
set theFolder to make_new_folder(path to desktop, theFoldername)
set FolderOne to make_new_folder(theFolder, "1")
set FolderOrig to make_new_folder(FolderOne, "orig  ")
tell application "Finder" to move every file to FolderOrig

-- a subroutine to create a new folder at location theFolder with name fName
on make_new_folder(theFolder, fName)
	try
		return ((theFolder as Unicode text) & fName) as alias -- does the folder already exist?
	on error -- if not, create one
		tell application "Finder" to return (make new folder at theFolder with properties {name:fName}) as alias
	end try
end make_new_folder

some notes about your script:

tell application "Finder"
   activate -- only necessary if the script should run in the foreground
   set theFoldername to the clipboard
   make new folder -- without any parameters a new folder will be created on desktop
   make new folder at folder "Desktop" of folder "UEIArtEmail" of folder "Users" of startup disk with properties {name:"1"}
-- within a Finder tell block the "root" folder is the Desktop of the current user,
-- so you can omit 'at folder "Desktop" of folder "UEIArtEmail" of folder "Users" of startup disk' completely
   make new folder at folder "Desktop" of folder "UEIArtEmail" of folder "Users" of startup disk with properties {name:"orig "}
   move the selection to folder "orig " of folder "Desktop" of folder "UEIArtEmail" of folder "Users" of startup disk
   move folder "orig " to folder "1" of folder "Desktop" of folder "UEIArtEmail" of folder "Users" of startup disk
   move folder "1" to folder "untitled folder"
   set name of folder "untitled folder" to the clipboard
end tell

PS: Unfortunately I have no idea about Eudora

A Eudora message goes like this:

set ToWhom to "someone@yourisp.com"
set theSubject to "Just a Test"
set R2 to return & return
set theMessage to "Now is the time for all good men to come to the aid of the party." & R2 & "The quick brown fox jumps over the lazy dog."
set FromWhom to 1 -- if you have more than one personality, select here.
SendIt(ToWhom, theSubject, theMessage, FromWhom)

on SendIt(ToWhom, SubjectLine, MessageText, FromWhom)
	tell application "Eudora"
		activate
		set x to make message at (end of mailbox "Out" of mail folder "")
		set field "To" of x to ToWhom
		set field "Subject" of x to SubjectLine
		set field "" of x to MessageText
		set personality of x to personality (get name of personality FromWhom)
		set signature of x to alternate
		--queue x -- uncomment if you want to queue the message immediately. Change to send if that's what you use.
	end tell
end SendIt

err sorry beens o busy trying to learn this scripting and get work done…well you all know…

the clipboad name gets copied by me from the from fieled in eudora (apple+c)

any one know a label color randomizing script…heehee, just for fun…i’d like to spruce up my server folders as i make them

Hi Kevin

tell application "Finder" to set label index of myFolder to random number from 1 to 7

the variable myFolder can be either an alias or and file specifier

that is soooooo awesome!

ROFL…our server will never look the same…its pretty…now!

thankyou, thankyou, tahnkyou…you guys are great teachers!

stefan/adam,

stefan-your script runs sooooo much faster than the one’s i make…and your script is so simple and so unlike what i have been reading and expected it to look like-thank you for the education.

i have modified your script to move selection, ex:

“tell application “Finder” to move selection to FolderOrig”

i’ve mistakenly thought i could figure this next part out without help and post it- i am sooo confused…i have even been waking up thinking “if, then, else” statements swirling…i am going to take that as a good sign…LOL

So here’s the next part which has my head swimming…

i want to move the clipboard named folder to server, but if a folder exists with that name - i’d like the folderone to be to move to another numbered (numbers 1-10) folder within it…make sense?

To put another way- i have clients who send multiple emails/attach each day. By hand, from the next unread email, i copy the from field and save the email and all attach to the desktop…then run the script…then move that folder to the server. However, if the client folder (clipboard named folder) already exist then i want to place in a sequentially numbered folder within the Client folder (clipboard named (copied by hand) - from field of the email)

maybe i just want to make all these scripts happen on the server to begin with?

And i’ve look at how easy apple mail works with scripting. So i’m thinking i am going to switch to that tomorrow…

really big thanks! at the very least for listening…i’ve put in about 14 hours today…so i better close…

is there an address i could UPS you guys some genuine Kansas City Barbeque or the like…that’s how much i appreciate it!

Hi Kevin,

what’s about a folder name with the current date included?

With Apple Mail and rules you can automate the whole stuff with AppleScript.
(I guess, you can do it with Eudora, too, but I don’t know Eudora)

I don’t know Mail’s capabilities, but Eudora does not have the capability to trigger a script from a filter, only to direct the file to a mailbox, change its status, transfer it elswhere, play a sound, etc. Filters can be fairly complex, but they are all programmed from a special page using menu choices.

To run a script, you have to direct the emails to a particular folder and operate on the mail in that folder periodically. When Steve Dorner sold Eudora to Qualcomm many years ago, AppleScript didn’t exist, and when Qualcomm ported Eudora to Windows, the Mac version’s development slowed. Like all products that serve both markets, Eudora has not kept up with OS X. Having said that, I’ve never lost an email - Eudora is extremely stable and robust.

I continue to use it because it was my first email client (version 1), it has an extremely efficient and effective search engine, the filters work quite well, there is a third-party spam filter that is 99.5% efficient , I know how to script things I want to do, and its mailboxes are unix text documents that never lose anything and are Spotlight searchable. When Mail gets that bombproof, I’ll switch.