Re: Rép: Name of file
Re: Rép: Name of file
- Subject: Re: Rép: Name of file
- From: demski <email@hidden>
- Date: Fri, 11 Jan 2008 18:42:13 +0100
Oh Boy, am I stupid...
or blind or whatever.
OF COURSE you are right!
Excuse me making noise and thnx for the patience!
mit besten Grüssen
Kind regards
demski
Am 11.01.2008 um 18:16 schrieb KOENIG Yvan:
Le 11 janv. 2008 à 17:15, demski a écrit :
Am 11.01.2008 um 16:49 schrieb KOENIG Yvan:
set thecsvfile to (choose file with prompt "Wählen Sie die CSV-
Datei:" of type {"TEXT"}) as alias
tell application "Finder"
try
set xt to name extension of thecsvfile
set nn to name of thecsvfile
set nn to text 1 thru -((length of xt) + 2) of nn
set name of thecsvfile to nn
end try
end tell
I had just hacked in my (worse) solution, as your answer arrived,
yvan...
But, I have a little question here:
shouldn't there be
set nn to text 1 thru -((length of xt) + 1) of nn --< +1
instead of 2 ??
when I try it, there seems to be always the last letter missing...
Am I blind to something?
I guess that you hardcoded the name extension assuming that it is
".csv"
but the one returned by the Finder doesn't contain the period
character so it is "csv".
So, as the index of the last character of a string is -1, we must
substract 2 to remove the period as well as "csv".
Of course, if you don't want to ask the Finder to get the extension
you may use the alternate formula.
I prefer adhere to the standard established by the Finder.
After all, an Applescript saved as a text document has the
"applescript" extension and your code let the user select such a file.
Yvan KOENIG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40unter-anderem.com
Archives: http://lists.apple.com/archives/applescript-users
This email sent to 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