AS bug ? name extension of f is empty
AS bug ? name extension of f is empty
- Subject: AS bug ? name extension of f is empty
- From: "emile.a.schwarz" <email@hidden>
- Date: Wed, 25 Feb 2009 01:04:37 +0100 (CET)
Hi all,
I just fall into a (simple) trap:
Here’s the code (that do not have any effect) [taken from a loop]:
-- Get the extension for the item #
set ItemExtension to name extension of ItemReference
if ItemExtension is "pmf" then
set position of ItemReference to {450, 272}
end if
That code never fires. To understand what happens, I asked the properties for the file and I get:
{class:document file, name:"France 4 2008-09-19_145257.pmf", index:2, displayed name:"France 4 2008-09-19_145257.pmf", name extension:"", extension hidden:false, etc.
My question is: why AppleScript does not gives me the name extension for that file ("France 4 2008-09-19_145257.pmf")?
[is it a bug ?
I already knew that the Finder (on 10.5) behaves differently depending on the fact the extension is know (an application “registered” it) or not.]
NOTA: the code works fine on a PowerBook G4 1.5GHz under PPC 10.4.11.
BTW: I found two work-arounds, but I do not know which one to keep / throw away. So, my second question is:
Which one of the two codes below do you prefer / do you think it is “best”:
-- This was the first I wrote, but I do not liked it too much
if name of ItemReference contains ".pmf" then
set position of ItemReference to {450, 272}
end if
-- This is the code I prefer
if name of ItemReference ends with ".pmf" then
set position of ItemReference to {450, 272}
end if
Environment:
MacBook 2.4GHz UniBody (late 2008)
MacOS X 10.5.6
TIA,
Emile
PS: the target file holds unknown data generated when one make a TNT (TV) record. Even the file name is generated by the software; but this is another story.
_______________________________________________
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