Re: changing file name within folder on desktop
Re: changing file name within folder on desktop
- Subject: Re: changing file name within folder on desktop
- From: Andrew Oliver <email@hidden>
- Date: Wed, 26 Mar 2003 02:19:36 -0800
You're causing yourself a lot more work here than you need to, as well as
introducing chances for error.
For a start, there's no need to select a file to change its name. In fact,
there's an argument that you shouldn't - there's always a chance that
between the point where you select a file and you try to rename it, the user
selects another file, switches application, or does any number of other
actions that will cause your script to fail.
Instead, assuming you know the path of the folder, try something like:
set sourceFolder to "path:to:folder:"
tell application "Finder"
set theFile to first file in folder sourceFolder
set newFileName to the clipboard & ".pdf" as string
-- note, a better way would be to set the filename
-- from cell in the current record rather than relying
-- on the clipboard for this.
set name of theFile to newFilename
end tell
This will safely rename a file (as long as the folder exists), without
worrying about user interaction. You can also use 'theFile' as an argument
to Outlook as to the file to attach to the email.
Andrew
:)
On 3/25/03 11:20 PM, "MR" <email@hidden> wrote:
>
What I want to do is to take that file within that folder and rename
>
it, e-mail it, and then transfer it to another folder. I thought I
>
should start with the script above (open folder) select the one file
>
within it, rename it with a paste (the name is on the clipboard from a
>
previous step in the Filemaker script) & .pdf and then e-mail it by
>
selecting the e-mail address out of the Filemaker data base. It appears
>
I have to use Outlook since that is what the boss wants to use, but I
>
am completely unfamiliar with it.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.