Hi Christopher,

Thank you very much. Yes, my language is installed and comes up in the 
pop-up list. One of these days I really do need to learn Applescript.

Richard

On Tuesday, March 4, 2014 1:01:06 PM UTC-8, Christopher Stone wrote:
>
> On Mar 04, 2014, at 10:33, [email protected] <javascript:> wrote:
>
> I develop software using a proprietary language (Tandem TAL) and have set 
> up the Custom Language description in BBEdit.
>
> The source file name have no extension as that is not part of the Tandem 
> file system.
>
> I often upload 100's of files that are written in TAL and would like to 
> set them all to the Custom Language.
>
> ______________________________________________________________________
>
> Hey Richard,
>
> Provided your custom language is available from the language pop-up menu 
> the appended Applescript will probably work.
>
> Save it as a compile script using the Applescript Editor, and put it into 
> BBEdit's script menu.
>
> Give it a keyboard shortcut.
>
> When run it will ask you to select a folder full of files.  It will 
> iterate through the files in the chosen folder and change the specified 
> parameters.
>
> You will need to change docEncoding, docLineBreaks, and docSrcLang to 
> suite your needs.
>
> The script can be run from the Applescript Editor, but it will run faster 
> from BBEdit's own script menu.
>
> Be sure to try it on a test folder first.
>
> --
> Best Regards,
> Chris
>
>
> -------------------------------------------------------------------------------------------
> # Change document encoding, linebreaks, and source-language to those 
> specified.
> # Target folder chosen by user.
>
> -------------------------------------------------------------------------------------------
> try
>
>   
>   set _folder to (*choose folder*) as *text*
>   set fileList to *list folder* _folder without invisibles
>
>   
>   if fileList ≠ {} then
>     tell *application* "BBEdit"
>
>       
>       set docEncoding to "Unicode (UTF-8)"
>       set docLineBreaks to Unix
>       set docSrcLang to "Unix Shell Script"
>
>       
>       repeat with ndx in fileList
>         set _document to *open* *file* (_folder & ndx)
>         set bounds of front *window* to {0, 44, 1314, 1196}
>         tell *document* (contents of ndx)
>           if encoding ≠ docEncoding then
>             set encoding to docEncoding
>           end if
>           if line breaks ≠ docLineBreaks then
>             set line breaks to docLineBreaks
>           end if
>           if source language ≠ docSrcLang then
>             set source language to docSrcLang
>           end if
>           if state modified = true then
>             *save*
>           end if
>           *close*
>         end tell
>       end repeat
>     end tell
>   end if
>
>   
> on error e number n
>   _err(e, n, true, true) of me
> end try
>
> -------------------------------------------------------------------------------------------
> on _err(e, n, beepFlag, ddFlag)
>   set e to e & return & return & "Num: " & n
>   if beepFlag = true then
>     *beep*
>   end if
>   if ddFlag = true then
>     tell me
>       set dDlg to *display dialog* e with title "ERROR!" buttons {"Cancel", 
> "Copy", "OK"} default button "OK"
>     end tell
>     if button returned of dDlg = "Copy" then *set the clipboard to* e
>   else
>     return e
>   end if
> end _err
>
> -------------------------------------------------------------------------------------------
>
>

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