Re: Finder window help...
Re: Finder window help...
- Subject: Re: Finder window help...
- From: Andy Wylie <email@hidden>
- Date: Mon, 06 Jan 2003 20:38:19 +1300
on Sun, 05 Jan 2003 20:19:14 -0800 Domains4Days.com wrote:
>
Thanks very much - I am definitely getting there!
>
>
I'm still bit stumped on a few things.
>
>
My goal is to supply some AppleScript with an application that would be
>
stored in a sub folder of the application folder. Since someone might
>
install the main folder anywhere they please... The first time the
>
AppleScripts are run, they won't know where the files are.
>
>
so if I preset the script to say something generic ...
>
>
>
set thefile to alias "thisdrive:goodstuff:test1.fp5"
>
>
... On my computer - for me - it says this script will not compile - and
>
only save as text. I guess this is because it's looking for something
>
active and real right now.
>
>
- So how you " preprogram " Files/folder items paths for scripts in
>
advanced?
>
>
... like this??? But...
>
>
tell application "Finder"
>
activate
>
try
>
>
set thefile to alias "thisdrive:goodstuff:test1.fp5"
>
open file tester
>
>
on error
>
set tester to alias choose file with prompt "Please choose the
>
appropriate file"
>
open file tester
>
end try
>
end tell
>
a common solution is an applet and 'path to me'...
try
--get this applet's path
set appletPath to (path to me) as string
-- strip applet's name from path to get its container's path
set containerString to (x's text 1 thru -(offset of ":" in x's items's
reverse as string))
--tack on your file path
set targetFilePath to containerString & "test1.fp5"
--test it (blah as alias not alias blah which leaks memory if it errors
--in some AS vers)
set targetFileAlias to targetFilePath as alias
on error m number n
if n is in {-43, -120} then
set tester to alias choose file with prompt "Please choose the
appropriate file"
else
error {n, m}
end if
end try
--note no Finder, best used as necessary
>
>
BTW: once the new file is found I wrote:
>
>
set tester to alias choose file with prompt "Please choose the appropriate
>
file"
>
eh? not found I guess
>
>
... Is that the correct syntax : set tester to alias choose file ...?
>
choose file returns an alias so you don't have to state or coerce it.
_____________________________ Andy
_______________________________________________
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.