Re: Get script's folder from within the script
Re: Get script's folder from within the script
- Subject: Re: Get script's folder from within the script
- From: "email@hidden" <email@hidden>
- Date: Sun, 27 Dec 2009 14:56:46 -0800
On Dec 27, 2009, at 7:34am, Nicola Vitacolonna wrote: 2) Are there any drawbacks in using the method above (e.g., situations in which it would not work)? Or is it a “safe” way for a script to know its location in the file system?
There are drawbacks to using a property definition to id a script's location. By itself, it won't work.
The value of a property declaration is only used the first time a script is executed. Once that value is set, it remembers it through subsequent runs, and does not execute again.
Try this:
property now : time string of (current date)
display dialog now
Run that script several times and the time doesn't change (unless you compile).
So you're better off with something like this:
property scriptPath: ""
on run set scriptPath to posix path of path to me ---- you're stuff here end run
ES |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden