Re: Re : Renaming file bug
Re: Re : Renaming file bug
- Subject: Re: Re : Renaming file bug
- From: Mr Tea <email@hidden>
- Date: Mon, 13 Dec 2004 22:45:28 +0000
This from JM - dated 13/12/04 9ยท15 am:
> I just tried :
> tell application "Finder"
> set ThisFile to make new file in ThisFolder
> set FileRef to ThisFile as alias
> -- later
> set the name of FileRef to ThisName
> End tell
> ... With no success either ! It works fine when the window is open and it
> doesn't when the window is closed !
> Do you have an idea ?
I don't, unfortunately, JM.
I have tried very hard to make the name-setting line fail, but it always
finds and renames the file pointed at by the 'FileRef' alias.
Is there another file with the same name in the target folder? Has 'FileRef'
been 'moved' to a different disk at any stage? What occurs between creating
the file and attempting to set its name?
When I can't figure out why something is failing, I wrap it in a try block
and look at the message generated when the failure occurs - something like
this...
tell application "Finder"
try
set the name of FileRef to ThisName
on error errmsg
display dialog errmsg
end try
end tell
In the meantime, it might be wise to follow Roger Howard's advice to set the
file's name when you create it. This is good practice generally, as you
probably don't want to clutter up your disks with blank text files called
'untitled', 'untitled1', 'untitled2', etc. (Are you running a French
localised system? If so, what are new 'untitled' files called in your neck
of the woods?)
Regards
Nick
Nick
pp Mr Tea
--
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden