AS error renaming a file

Hi all:

I am trying to open a file in PS 7, resizing it and then doing a save as to a different location (on the same server) and then renaming the file. Everything works fine except for when I go to rename it, I get an AppleScript error, “Finder got an error. The operation could not be completed.” When I go to the newly created file I can manually rename it, I can move it into other folders, I can replace an older version of the new file but I cannot delete it, I get the file is in use error message. I am using OS X 10.2.8. My code is below. Any help would be appreciated.

Thanks

Steve

==========
Code follows

on moveAsset(thisFilePath, thisMagPath, theHoldingPath, theArchivePath, theThumbnailPath, theWidth, theHeight)…

…tell applcation “Adobe Photoshop 7.0”…

…resize image current document width theWidthPixels height theHeightPixels
set myOptions to {class:JPEG save options, embed color profile:false, format options:standard, matte:background color matte}
save current document in (theThumbnailPath) as JPEG with options myOptions
close current document saving no
end tell
set theOldFilePath to (theThumbnailPath as string) & newFileName as alias
tell application “Finder”
set name of file theOldFilePath to thumbName
end tell
return thisFile
end moveAsset

Does it work if you replace the relevant code with this?

set theOldFilePath to ((theThumbnailPath as string) & newFileName) as text
tell application "Finder"
	set name of file theOldFilePath to thumbName
end tell

– Rob

…same error, I think this might be an OS or Photoshop issue, it seems to me it’s like writing a file using AS, you have to open it for access and then close it, it just seems the file is not being closed after it is created. (I do close out all open files in PS after I do the save as). :?

Why don’t you just save the file with the name you want and save yourself the step of renaming it?

OK, I’ve been trying to do what you suggested for the last day and I keep getting error messages - can you send me a snippet of how to do it?

Thanks