renaming a file
renaming a file
- Subject: renaming a file
- From: "Eric Phillips" <email@hidden>
- Date: Thu, 28 Mar 2002 12:32:33 -0500
Obligatory newby statement...
I was the one who posted a couple days ago about importing records into FMP. I thank the people who suggested to move the file to a folder and renaming it then use an FMP script to import the data. My only problem with this is renaming the file. I have tried the following scripts:
set theFolder to "Macintosh HD:Users:ericphil:Documents:Kim:ready:" as alias
set importfolder to "Macintosh HD:Users:ericphil:Documents:Kim:ready:FMP import:"
tell application "Finder"
set theFileList to every file of theFolder
end tell
repeat with i in theFileList
set filename to name of i as text
--set the variable importfile to the name and path of the file to be imported once it is moved and renamed. There might be a better way of doing this.
set importfile to importfolder & filename as text
set theFile to i as text
tell application "Finder"
- duplicate file into the import folder
duplicate theFile to "Macintosh HD:Users:ericphil:Documents:Kim:ready:FMP import:"
- move the file to another folder
move theFile to "Macintosh HD:Users:ericphil:Documents:Kim:ready:FMP import:finished:"
end tell
- I tried this set command and get an error that name of importfile(written as path to the file) cannot change name to :import doc" or something close to that.
set name of importfile to "import doc"
--I also tried this using text delimiters but would get a similar error message saying that it couldn't change the last item to "import doc". When I looked at what the last item or item -1 is it would return the last letter of the file name not the whole file name.
set {OldTID, text item delimiters} to {text item delimiters, ":"}
set last item of importfile to "import doc"
--or
set item -1 of importfile to "import doc"
end repeat
It did take me awhile to figure out that the changing of the TIDs needs to be outside of the tell finder block. I know I can do the Do Script in FMP if I could just get the filename changed. Any help will be greatly appreciated.
_______________________________________________
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.