Re: weird path to me error
Re: weird path to me error
- Subject: Re: weird path to me error
- From: Andrew Oliver <email@hidden>
- Date: Wed, 19 Jan 2005 14:35:36 -0800
On 1/19/05 2:18 PM, "Robert Poland" <email@hidden> wrote:
> When I run this snippet as part of an old script it works fine.
> But when run as a new script (saved in the correct folder) I get the
> indicated error.
>
> I find it odd that the file name and the script name are run
> together. Is that a clue? I have tried adding in a colon but that
> didn't help.
>
> The old script was created in January of 2004. Has something changed?
>
> set myPath to path to me
> set myPrefs to "AwakeTimes"
> read file ((myPath as string) & myPrefs)
> set myData to result
> myData
> --> "File iMac HD:Library:Scripts:Universal
> Scripts:TimeTestAwakeTimes wasn't found."
>
> Tia,
This isn't surprising at all. path to me returns the path to your script (in
this case 'iMac HD:Library:Scripts:Universal Scripts:Time Test')
You're simply appending the required file name to the end of the script's
path.
I'm guessing what you really want to do is get the path to the *folder* your
script is in, but that's not what 'path to me' does.
There are numerous ways of getting the folder's path. One of the easiest,
assuming the Finder is running, is:
tell application "Finder" to set myPath to container of (path to me)
This will return the folder object which you can coerce to a text object and
append your file name to.
Andrew
:)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden