Re: Editable?
Re: Editable?
- Subject: Re: Editable?
- From: Yvan KOENIG <email@hidden>
- Date: Tue, 8 Nov 2005 10:40:59 +0100
Le 8 nov. 2005, à 1:34, jj a écrit :
I have an open handler that tests a dropped file to see if ...
1. It's an application. (easy)
2. It's an AppleScript (easy)
3. I am the owner (easy)
But I also need to test whether or not it's editable.
The only test I have found that works is to try to open it with an
editor and get an error if it's not editable, but this method is
not acceptable. And how does the editor know this?
Anybody have any ideas?
You can install Jon's Commands and try to load the script, then coerce
it to
string. Eg:
#########################
set q to alias "path:to:file.scpt"
try
load script q as text
on error
--> not editable
end try
#########################
Satimage's Smile also provides this "script to text" coercion.
Otherwise, if you need it vanilla, this may work (or not):
#########################
set scpt to read alias "path:to:file.scpt"
set isNotEditable to (scpt's item 25 is ((ASCII character 255)) and
(scpt's
item 26 is (ASCII character 254)))
#########################
OK but this will be useless if the script is saved as an application.
As far as I know, there is no difference between the datafork of an
editable and the one of a non-editable script when saved as
application.
The differences are localised in the resourcefork.
_______________________________________________
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