Re: renaming files with applescript
Re: renaming files with applescript
- Subject: Re: renaming files with applescript
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 22 Oct 2008 20:09:13 -0400
You can't move and rename at the same time with the Finder or system
events. The new name is just the filename, not the full path.
If you need to do both at once you can use do shell script "mv " +
quoted form of POSIX path of someFile + " " + quoted form of
newPosixPath
On 10/22/08, Brian Christmas <email@hidden> wrote:
>
> On 23/10/2008, at 9:41 AM, email@hidden wrote:
>
>> Hi I am trying to rename some files with applescript
>>
>> I have two variables, oldName and newName
>>
>> this is part of a bigger script, but have simplified it down to just
>> what
>> is not working... the variables are normally created by the script,
>> I have
>> substituted the info directly here to make it more clear...
>>
>> this does not work:
>> set oldName to "Users:richsimpson:Desktop:apc.jpg"
>> set newName to "Users:richsimpson:Desktop:test.jpg"
>> tell application "Finder"
>> activate
>> set name of file oldName to newName
>> end tell
>>
>> this does not work either:
>> tell application "Finder"
>> activate
>> set name of file "Users:richsimpson:Desktop:apc.jpg" to
>> "Users:richsimpson:Desktop:test.jpg"
>> end tell
>>
>> any ideas as to what I am doing wrong?
>> thanks,
>> -Rich
>
>
> G'day Rich
>
> try
>
> set oldName to "Users:richsimpson:Desktop:apc.jpg"
> set newName to "test.jpg"
> tell application "Finder"
> activate
> set name of file oldName to newName
> end tell
>
>
> Regards
>
> Santa
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
--
Sent from Gmail for mobile | mobile.google.com
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden