Reading name of application

Hey guys what im trying to do is read the name of the current application.

like say someone renamed my application “Secure App.app” to “iPhoto.app” it will set a variable to iPhoto

I was thinking of using grep and some other shell commands but thought id ask first

What are you using the name for?

How about:

set P to path to me as alias
tell application "Finder" to set myApp to name of P

Well im trying to make a basic tool to password protect applications without having any performance hits and simple to use.

What happens is when the new app name is passed as a variable it uses it to loads the app that needs to be (I know its complicated but if i can even make a simple prototype youll understand)

Also with that other example will the .app be on the end of the returned name even if the Mac is configured not to show the extenstions?

ok well with your help and dominiks i have been able to come up with the solution, this little project is a tool for my use personally but as always will be available on semaja2.net once i finish it all off.

I would like to thank the whole applescript.net community for your great support in helping me make my applications, and as a show of this i have included the sites name in the about window and on my site, also if you contributed some code to MultiAlarm please tell me so i can add your name


		set P to path to me as alias
		tell application "Finder" to set myApp to name of P
		if myApp contains "." then
			set olddelims to text item delimiters
			set text item delimiters to "."
			set myApp to (text items 1 thru -2 of myApp) as string
			set text item delimiters to olddelims
		end if