On Dec 26, 2013, at 00:39, Stefano <[email protected]> wrote:
> I'm going really crazy :-( …
> 
> These simple UI scripts work perfectly. And they work perfectly running from 
> Editor and running from BBEdit's Script Menu.
______________________________________________________________________

Hey Stefano,

I'm pretty sure you've exposed a bug and suggest you file a report with 
support.  I also suggest you file a feature request that balance and fold be 
added to BBEdit's Applescript dictionary.

I've done a fair bit of testing and find when I run [the appended script] from 
BBEdit's script menu only the last function is collapsed - and quite strangely 
on my system the Apple-Menu gets opened and  left open.

If I run the script from FastScripts it works perfectly - as it does from 
Script Debugger.

I can provide a movie to support if for some reason this issue is not 
immediately apparent.

BTW what BBEdit are you using and what OSX?

--
Best Regards,
Chris
_________________________
MacBookPro6,1
 | 2.66 GHz Intel Core i7
 | 8GB RAM
OSX 10.9.1
BBEdit 10.5.7 (3346)

______________________________________________________________________


Using this text:

-------------------------------------------------------------------------------------------

#! /usr/bin/env perl 
        use v5.12; use strict; use warnings;
#----------------------------------------
sub some_funtion1 {

}
sub some_funtion2 {

}
sub WTB1 {

}
sub WTB2 {

}

-------------------------------------------------------------------------------------------

Using this script:

-------------------------------------------------------------------------------------------

on bbSEV()
        tell application "System Events"
                tell process "BBEdit"
                        # set frontmost to true
                        tell menu bar 1
                                tell menu bar item "View"
                                        tell menu 1
                                                click menu item "Balance & Fold"
                                        end tell
                                end tell
                        end tell
                end tell
        end tell
end bbSEV

set _found1 to true
set _found2 to true

tell application "BBEdit"
        tell front text window
                select insertion point before character 1
                repeat while (_found1 = true and _found2 = true)
                        set _found1 to found of (find "^sub [^{]+(?=\\{$)" 
options ¬
                                {search mode:grep, case sensitive:false, match 
words:false, extend selection:false} ¬
                                        with selecting match)
                        if _found1 = false then exit repeat
                        set _found2 to found of (find "$" options ¬
                                {search mode:grep, case sensitive:false, match 
words:false, extend selection:false} ¬
                                        with selecting match)
                        if _found2 = true then
                                bbSEV() of me
                        end if
                end repeat
        end tell
end tell

-------------------------------------------------------------------------------------------


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