Re: Where is application
Re: Where is application
- Subject: Re: Where is application
- From: Kai Edwards <email@hidden>
- Date: Wed, 27 Mar 2002 04:17:57 +0000
on Sun, 24 Mar 2002 22:29:51 -0800, John Cuccio <email@hidden> wrote:
>
I have a script that I use and every time I run it on my Mac OS 8.1 it ask
>
me where the application is that I am telling to do something. I run the
>
same script on my other Mac & apple script and it does not ask.
>
>
Once I tell it where the application is everything is OK. Shut down the
>
computer and run the script it ask where the application is.
(snip)
>
Instead of just the tell statement. Can I put some line of code in the
>
script to tell it where the application is. So it will not ask me.
A couple of tricks might help here, John:
---------------------- method 1a ----------------------
property theApp : ""
if theApp = "" then set theApp to (choose file of type [NO BREAK]
"APPL" with prompt "Where is it?")
tell application "Finder" to open application theApp
------------------------------------------------------
The first time you run the script, you'll still have to tell it where the
target application is. An alias reference to the application will then be
stored in the property named 'theApp'. From then on, the script should find
the application - even if you move or rename it. Be aware though that, if
you recompile the script, you should be prepared to start the process again.
That should work OK on one machine. If you want the script to be more
portable, here's a variation:
---------------------- method 1b ----------------------
property theApp : ""
tell application "Finder"
try
open application theApp
on error
set theApp to (choose file of type "APPL" with prompt "Where is it?")
end try
end tell
------------------------------------------------------
Again, you'll need to tell the script the location of the app when you run
it for the first time on a different machine.
---------------------- method 2 ----------------------
tell application "Finder"
open application file id "XXXX"
end tell
------------------------------------------------------
To make the above version work, you need to know the file id (or file
creator) of the application in question. If you're not sure, run this
(separately) first:
------------------ copy file creator -----------------
set theApp to choose file of type "APPL"
set the clipboard to (info for theApp)'s file creator
------------------------------------------------------
...then simply go to your 'method 2' script, double-click the XXXX within
the quotation marks and paste.
HTH
Kai
--
**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.