Get Path to an application without launching it

Hello to everyone !.
A new comer here to MacScripter ! :smiley:

I am looking for an easy way to get path to an application without it being launched.

I tried

set PathToiCal to path to application "ical"

But it lauches iCal everytime i run it ! :confused:

I am doing a little app that moves all the Appleā€™s Apps from the subs-folder I created in the Applications folder (iPhoto for exemples is in /Applications/Images/) back into the Applications folder so when i do one of Appleā€™s Update I donā€™t get errors about missings Apps.
I wanted to distribute this app for the good of everyone, so i cannot hard code the path to the Apps i want to move.

Thanks for you help.

Francky

set theApplication to choose file

Howā€™s that for easy?
SC

Hi,

You can also use Apple System Profiler to get references to all apps in the Applications folder. The hard part is that some apps have their own folders. In that case, you would want to move the folder, but how can you tell if the app had a folder?

gl,

Hi,

If you want just a few references to apps, then you could use the application file id. You would need to know the creator type if there is one. You can get the creator type like this:

set r to path to application ā€œiCalā€
file creator of (info for r)

This returns ā€œwrbtā€ which is the file creator or creator type. Then use the Finder to get a reference knowing the creator type:

tell application ā€œFinderā€
set ical_reference to (application file id ā€œwrbtā€) as alias
end tell

gl,

Hello :smiley:

Sorry for the delay to reply !! :confused:

Thanks Kel, the app file ID was the solution. I am going to do some more testing with the app, and then submit the app/code here, to the AS masters of Macscripter.net.

@ Sitcom, I didnā€™t use your solution, as i knew exactly which apps i wanted to move, and as there is about 10 or more, asking the user for where they were, would have been a major flaw IMHO.

Anyway, thank you to both of you. And again sorry for the delay (and bad english :))

Franck