• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Editable?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editable?


  • Subject: Re: Editable?
  • From: jj <email@hidden>
  • Date: Tue, 08 Nov 2005 01:34:10 +0100
  • Thread-topic: Editable?

> 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)))
#########################

You must enclose the raw-source of the script in the var "scpt" (if
data-fork, "read" will do the trick; if resource-fork, ask again if needed).


jj

--
http://www.macscripter.net/
http://www.osaxen.com/


 _______________________________________________
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

  • Follow-Ups:
    • Re: Editable?
      • From: Yvan KOENIG <email@hidden>
References: 
 >Editable? (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Alias listfrom find shell
  • Next by Date: Re: how to get the name of the current handler
  • Previous by thread: Re: Editable?
  • Next by thread: Re: Editable?
  • Index(es):
    • Date
    • Thread