Re: 1 to 001 & the duplicate command
Re: 1 to 001 & the duplicate command
- Subject: Re: 1 to 001 & the duplicate command
- From: Nigel Garvey <email@hidden>
- Date: Fri, 31 May 2002 08:36:06 +0100
Stephen Swift wrote on Thu, 30 May 2002 17:06:17 -0400:
>
I've been scripting away, and have encountered a few oddities this week.
>
>
I had to create a script where all numbers were 3 digits so
>
1 --> 001
>
10 --> 010 etc, etc
>
>
This was simple enough with a little code, but I was just curious if there
>
is a coercion which allows a number to have leading zeros (by default
>
AppleScript changes 001 to 1).
There's no built-in coercion, but as you say, the code is very simple:
text 2 thru 4 of ((n + 1000) as string)
>
And seconding, I was trying to use the duplicate command in the Finder (Mac
>
OS 8.6).
>
Duplicate a file & change it's name.
>
>
set blah to choose file
>
tell application "Finder"
>
set blah_folder to container of blah
>
set blah_duplicate to duplicate blah to blah_folder without replacing
>
end tell
>
blah_duplicate
>
--> file "sign-on list" of application "Finder"
>
>
Now file "sign-on list" is the original file not the duplicated file. From
>
the Finder's dictionary:
>
"Result: reference -- to the duplicated object(s)"
>
>
I was expecting to see
>
file "sign-on list copy" of application "Finder" as the result.
>
>
Is this a Mac OS 8.6 bug only, or is this just how AppleScript works?
There is indeed a bug in 8.6 (fixed in later versions) where 'duplicate'
returns the original item instead of the duplicate. You have to set up
your own reference to the duplicate, using the expected name and the
folder to which you've duplicated the item. I'm away from my 8.6 machine
at the moment, so I can't check what the implications are for the
duplicate's name if another duplication has already occurred.
NG
_______________________________________________
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.