At 13:48 -0700 05/15/2013, Jeremy Cowgar wrote:
>Via AppleScript, can I ask BBEdit what the current document's programming
>language is? I know that I can look at the name of the current document
>and parse the extension of the file, but I was hoping for a more sure way,
>and easier way, to get the programming language.


Certainly, since that's a property of the document.

Here's a quick example:
====
tell application "BBEdit"
        set docLang to source language of text document 1
        if (docLang is missing value) then set docLang to "Plain text"
end tell
====

[NB: One potential complication is that since a plain text document has no
language name, AppleScript will return `missing value`; thus, I used line 3
to handle this case.]


Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc.             <http://www.barebones.com/>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].


Reply via email to