Re: Name only of app
Re: Name only of app
- Subject: Re: Name only of app
- From: KOENIG Yvan <email@hidden>
- Date: Sat, 24 Jan 2009 19:03:43 +0100
On 24/01/2009, at 18:54:40, Michelle Steiner wrote:
On Jan 24, 2009, at 10:31 AM, Robert Poland wrote:
Is there a command that will get only the name and not the name
and extension of an application?
tell application "Finder" to set x to name of (path to frontmost
application)
tell application "Finder" to set x to the displayed name of (path
to frontmost application)
Normally, ".app" is not displayed in the Finder in the name of an
application; in fact, in the get info window for an application,
"Hide extension" is checked and disabled, so it can't be unchecked.
Although I don't know of any situation where the extension is
displayed, here is code to handle that possibility:
tell application "Finder" to set x to the displayed name of (path
to frontmost application)
if text -4 through end of x is ".app" then
set x to text 1 through -5 of x
end if
x
-- Michelle
Curious,
on my machine the .app extension is always displayed.
tell application "Finder"
set n to get name of (path to frontmost application)
set x to name extension of (path to frontmost application)
end tell
if x is not "" then set n to text 1 thru -(2 + (count of x)) of n
Yvan KOENIG (from FRANCE samedi 24 janvier 2009 19:03:39)
_______________________________________________
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