Anas

Scite fold within Regions

16 posts in this topic

Hi,

Is it possible to make Scite fold functions within regions?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Try this following 2 steps:

CTRL+LEFTMOUSEBUTTON on the "-" sign (folding sign on the left - near to #Region statement) 
and now 
ALT+LEFTMOUSEBUTTON on the same "+" folding sign.

 

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

@Jos

It folds the regions but not the functions within them.

#Region Already gets folded
Func DoesNotFold()
EndFunc
#EndRegion

 

@mLipok

I'm looking for a way to have it fold all functions within all regions by default, like "fold.on.open=1"

also, this will fold everything within the region, including the IF/While/For ...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Folds fine for me:

Knipsel.PNG

Don't think there is an option to fold one level lower on opening though. maybe a lua function could do that for you.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Now that I've re-read my OP, I realised I didn't specify that I want to do it using "View>Toggle all folds" and " fold.on.open=1"

Share this post


Link to post
Share on other sites

In case  you or somenbody is interested in a LUA function for this:

  1. Add this code to file  %localappdata%\AutoIt v3\SciTE\PersonalTools.lua:
  2. function PersonalTools:ToggleFoldLevel(x)
        if editor.Lexer == SCLEX_AU3 then
            -- clear output pane when debugging
    --~         output:ClearAll()
            fldonlev=tonumber(x)
    --~         print("### Fold toggle fold level ", fldonlev)
            local savlinlev1=-1
            local fldinlev1=0
            for a = 0, editor.LineCount-1, 1
            do
    --~             print("--",a+1, editor.FoldLevel[a],editor.FoldParent[a],savlinlev1,fldinlev1)
                -- outside of a fold again
                if editor.FoldParent[a+1] < savlinlev1 then
    --~                 print("End of fold block")
                    savlinlev1=editor.FoldParent[a+1]
                    fldinlev1=fldinlev1-1
                elseif editor.FoldParent[a+1] > savlinlev1 then
    --~                 print("Start of fold block")
                    savlinlev1=editor.FoldParent[a+1]
                    if fldonlev == fldinlev1 then
    --~                     print("! Toggle fold for line ", a+1)
                        editor:ToggleFold(a)
                    end
                    fldinlev1=fldinlev1+1
                end
            end
        end
    end
  3. Add these lines to your Sciteuser.properties: the number behind the func is the level to toggle the fold for.
  4. #x lua test func
    command.name.41.$(au3)=ToggleFoldLevel
    command.mode.41.$(au3)=subsystem:lua,savebefore:no
    command.shortcut.41.$(au3)=Ctrl+Shift+F
    command.41.$(au3)=InvokeTool PersonalTools.ToggleFoldLevel 2
    The shortcut Ctrl+Shift+f should now do a toggle fold for only the level 2 folds.

Jos 

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Very good solutions @Jos,
Thanks.

 

But as I remember long time ago I was thiniking about something like that but I would prefer little diferent behavior.
So I dig in your code and in Scintilla Documentation  and after 20 minute of learning I change a little:

editor:FoldChildren(a, 2)
-- editor:ToggleFold(a)

here is complete changed lua script:

function PersonalTools:ToggleFoldLevel(x)
    if editor.Lexer == SCLEX_AU3 then
        -- clear output pane when debugging
--~         output:ClearAll()
        fldonlev=tonumber(x)
--~         print("### Fold toggle fold level ", fldonlev)
        local savlinlev1=-1
        local fldinlev1=0
        for a = 0, editor.LineCount-1, 1
        do
--~             print("--",a+1, editor.FoldLevel[a],editor.FoldParent[a],savlinlev1,fldinlev1)
            -- outside of a fold again
            if editor.FoldParent[a+1] < savlinlev1 then
--~                 print("End of fold block")
                savlinlev1=editor.FoldParent[a+1]
                fldinlev1=fldinlev1-1
            elseif editor.FoldParent[a+1] > savlinlev1 then
--~                 print("Start of fold block")
                savlinlev1=editor.FoldParent[a+1]
                if fldonlev == fldinlev1 then
--~                     print("! Toggle fold for line ", a+1)
                    editor:FoldChildren(a, 2)
                    -- editor:ToggleFold(a)
                end
                fldinlev1=fldinlev1+1
            end
        end
    end
end

Try with this testing script and you will see the difference

_Example1()

#Region - 1
Func _Example1()
    If True Then ; Check here
        For $i = 1 To 2
            _Example2()
            For $x = 1 To 2
                _Example2()
            Next
        Next
    EndIf

    If False Then
        ; test2
        ; test2
    EndIf

EndFunc   ;==>_Example1
#EndRegion - 1

#Region - 2
Func _Example2()
    If True Then
        ; test1
        ; test1
    EndIf

    If False Then
        ; test2
        ; test2
    EndIf

EndFunc   ;==>_Example2
#EndRegion - 2

Just after using CTRL+SHIFT+F then try to unfold this line:

If True Then ; Check here

 

Cheers.

mLipok

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Thanks Jos, this is very handy.

I use this LUA script to make Scite fold all first-levels throughout the script, and second-levels only in regions:

 

function PersonalTools:ToggleFoldLevel()
    if editor.Lexer == SCLEX_AU3 then
        local InRgn = false

        for i = 0, editor.LineCount - 1 do
            local FoldLVL = editor.FoldLevel[i]
            local STR = editor:GetLine(i)

            if not InRgn and FoldLVL == 67183616 and string.starts(STR, "#Region") then
                InRgn = true
            elseif InRgn and FoldLVL == 67109889 and string.starts(STR, "#EndRegion") then
                InRgn = false
            end

            if FoldLVL == 1024 and (i+1) < editor.LineCount then
                print(i+1)
                print(FoldLVL)
                print(STR)
                print(InRgn)
                print("============")
            end

            if FoldLVL == 67183616 or (InRgn and FoldLVL == 67249153) then editor:FoldLine(i,0) end
        end
    end
end

function string.starts(String, Start)
    local success, value = pcall(string.sub,String,1,string.len(Start))
    if success and value == Start then return true end
    return false
end


But I've a problem with it, after some lines (69 in this example), editor.FoldLevel it's stops returning the correct Fold-level value and just returns 1024:

 

Global $T

Func Func1()
    If $T Then

    Else

    EndIf
EndFunc

#Region 1
Func FuncInRegion1()
    If $T Then

    Else

    EndIf
EndFunc
#EndRegion

Func Func2()
    If $T Then

    Else

    EndIf
EndFunc

Func Func3()
    If $T Then

    Else

    EndIf
EndFunc

Func Func4()
    If $T Then

    Else

    EndIf
EndFunc

Func Func5()
    If $T Then

    Else

    EndIf
EndFunc

Func Func6()
    If $T Then

    Else

    EndIf
EndFunc

Func Func7()
    If $T Then

    Else

    EndIf
EndFunc

Func Func8()
    If $T Then

    Else

    EndIf
EndFunc

 

If I use "View>Toggle all folds", it starts to work as expected.

 

Edit:

As a workaround, I reset fold.on.open=1 and renamed the func to OnOpen to call it at launch.

Why is the output cleared when the function is called? even if I don't print anything.

Edited by Anas

Share this post


Link to post
Share on other sites

@Anas,

This version of my LUA script extracts just the Level number from the FoldLevel returned value and has your Region logic in it as well (a little modified to coupe with mixed case). 
Explanation can be found in the script and let me know when you have questions:

function string.starts(String, Start)
    if String == nil then return false end
    String=string.lower(String)
    Start=string.lower(Start)
    local success, value = pcall(string.sub,String,1,string.len(Start))
    if success and value == Start then return true end
    return false
end

function PersonalTools:ToggleFoldLevel(x)
    -- set to true when debugging
--~     debug=true
    debug=false
    -- clear output pane when debugging
    if debug then output:ClearAll()end
    --
    fldonlev=tonumber(x)
    if debug then print("### Fold toggle fold level ", fldonlev) end
    if debug then print("--","Line", "FoldLevel","FParent","fld+InR", "InRgn", "flp", "fl", "fln") end
    -- local vars
    local InRgn=0
    -- loop through lines, starts at 0 for first line
    for a = 0, editor.LineCount-1, 1
    do
        local STR = editor:GetLine(a)
        -- Explanation how editor.FoldLevel value is build up. we need the last 2 characters
        --~ enu FoldLevel=SC_FOLDLEVEL
        --~ val SC_FOLDLEVELBASE=0x400
        --~ val SC_FOLDLEVELWHITEFLAG=0x1000
        --~ val SC_FOLDLEVELHEADERFLAG=0x2000
        --~ val SC_FOLDLEVELBOXHEADERFLAG=0x4000
        --~ val SC_FOLDLEVELBOXFOOTERFLAG=0x8000
        --~ val SC_FOLDLEVELCONTRACTED=0x10000
        --~ val SC_FOLDLEVELUNINDENT=0x20000
        --~ val SC_FOLDLEVELNUMBERMASK=0x0FFF   (I only use the last 2 characters for level calculation
        -- get foldlevel previous line    ( the "or 0" is to avoid a nil error)
        local foldlevp=tonumber(string.sub(string.format("%x",editor.FoldLevel[a-1]),6),16) or 0
        -- get foldlevel current line
        local foldlev=tonumber(string.sub(string.format("%x",editor.FoldLevel[a]),6),16) or 0
        -- get foldlevel next line
        local foldlevn=tonumber(string.sub(string.format("%x",editor.FoldLevel[a+1]),6),16) or 0
        --
        -- check for first level #Region and #EndRegion statements
        if  foldlev==0 and string.starts(STR, "#Region") then
            InRgn = 1
            if debug then print("+ Inside region")end
        elseif foldlev==1 and string.starts(STR, "#EndRegion") then
            InRgn = 0
            if debug then print("- Outside region") end
        end
        if debug then print("--",a+1, editor.FoldLevel[a],editor.FoldParent[a],fldonlev + InRgn, InRgn, foldlevp, foldlev, foldlevn,STR) end
        --
        -- check for lower fold level (Not used anymore in the logic)
        if foldlev < foldlevp then
            if debug then print("End of fold block") end
        end
        --
        -- check for higher fold level
        if foldlevn > foldlev then
            if debug then print("Start of fold block") end
            -- check if toggle fold is needed for this level
            if fldonlev + InRgn == foldlevn then
                if debug then print("! Toggle fold for line ", a+1) end
                editor:ToggleFold(a)
            end
        end
    end
end

  Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Hello Jos,

Thank you for taking the time, but it seems that your example have the same "editor.FoldLevel" problem as well, at least for me:

Start of fold block
--  65  67240962    63  1   0   1   2   2   

--  66  67175426    63  1   0   2   2   1       EndIf

--  67  67109889    60  1   0   2   1   0   EndFunc

End of fold block
--  68  67109888    -1  1   0   1   0   0   

End of fold block
--  69  1024    -1  1   0   0   0   0   Func Func8()

--  70  1024    -1  1   0   0   0   0       If $T Then

--  71  1024    -1  1   0   0   0   0   

--  72  1024    -1  1   0   0   0   0       Else

--  73  1024    -1  1   0   0   0   0   

--  74  1024    -1  1   0   0   0   0       EndIf

--  75  1024    -1  1   0   0   0   0   EndFunc

--  76  1024    -1  1   0   0   0   0   nil

I found this old bug report that might explain it better.
BTW, since "fold.on.open=1" fixes it, this bug doesn't matter to me anymore.

 

But I'd like to stop Scite/Lua from clearing the output when the function is called. Is this possible?

Edited by Anas

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

I used you script  to test and don't see the same values for FoldLevel.

Start of fold block
--  65  67240962    63  1   0   1   2   2   

--  66  67175426    63  1   0   2   2   1       EndIf

--  67  67109889    60  1   0   2   1   0   EndFunc

End of fold block
--  68  67109888    -1  1   0   1   0   0   

End of fold block
--  69  67183616    -1  1   0   0   0   1   Func Func8()

Start of fold block
! Toggle fold for line  69
--  70  67249153    68  1   0   0   1   2       If $T Then

Start of fold block
--  71  67240962    69  1   0   1   2   1   

--  72  67249153    68  1   0   2   1   2       Else

End of fold block
Start of fold block
--  73  67240962    71  1   0   1   2   2   

--  74  67175426    71  1   0   2   2   1       EndIf

--  75  67109889    68  1   0   2   1   0   EndFunc

End of fold block
--  76  1024    -1  1   0   1   0   0   nil
End of fold block


Which version of SciTE are you using and do the actual folding indicators look correct for those lines in SciTE?

Not sure whether there is an option to avoid clearing the OutputPane when using a LUA function... need a little research for that.

Jos

 

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

I had SciTE v.3.6.2.0, and updated to v.3.6.6.0 and still get the same results.

No, the function is not folded in SciTE nor does the indicator look like it does.

funcs.jpg

Did you have "fold.on.open" enabled when you tested?

Edited by Anas

Share this post


Link to post
Share on other sites

Strange... 

Just now, Anas said:

No, the function is not folded in SciTE.

 

I meant whether you see the Folding marks for the lines that return 1024:

Knipsel.PNG

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
1 minute ago, Jos said:

I meant whether you see the Folding marks for the lines that return 1024:

I Edit my previous post.

I thought reinstalling SciTE would've solved it.

 

Did you have "fold.on.open" enabled when you tested?

Share this post


Link to post
Share on other sites
11 minutes ago, Anas said:

Did you have "fold.on.open" enabled when you tested?

No, but tried that as well as well and don't see the behavior see and it still works as expected.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • Hoth2001
      By Hoth2001
      I installed AutoIt to my computer 3 days ago...and have invested the last 3 days learning how to use it.
      As learned in the tutorials, whenever opening I new file in Scite editor I'd immediatley save the file
      I left the Scite Editor open for the past 3 consecutive days on my laptop
       
      No problem
       
      Today I closed Autoit for the first time, restarted my computer, and opened up the Scite Editor
      Now whenever I try to save a file I am prevented from doing so because I apparently don't have permission!?  
      And whenever I try to run any of the programs I've created over the past 3 days now I keep getting annoying popup notifications before I run them
       
      Problem
       
      To go around the issue, I copied a program originally saved in the AUtoIt folder to another folder (since I was barred from saving it in it's original AutoIt location)
      NOw when I run the code the mouse coordiantes are all off
      and I still get that pesky notification whenever I try to run a program
       
      Big Problem!!!
      Anyone have any clue why I'm going through this BS?
       
      1. I checked my User settings and YES I am the administrator on this cpu
      2. I tried to de-select the "read only" attribute for the AutoIt folder (everytime after doing this successfully the folder immediately and automatically reverts back to "read only")
       
      Any help would be MOST appreciated. I've attached screen shots of the annoying bus I keep getting
       
       


    • algiuxas
      By algiuxas
      Hello everybody!
      I get these weird errors in SciTE console:
      [0801/210405:ERROR:tcp_socket_win.cc(335)] bind() returned an error: Only one usage of each socket address (protocol/network address/port) is normally permitted. (0x2740) [0801/210405:ERROR:devtools_http_handler.cc(229)] Cannot start http server for devtools. Stop devtools. [0801/210405:ERROR:browser_gpu_channel_host_factory.cc(119)] Failed to launch GPU process. [0801/210405:ERROR:browser_gpu_channel_host_factory.cc(119)] Failed to launch GPU process. My script:
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Misc.au3> #NoTrayIcon $title = "Hello" $txt = "..." ; TODO: Make 4 of them ;~ #Region ### START Koda GUI section ### Form= ;~ $1_GUI = GUICreate($title, 370, 120, -1, -1) ;~ GUISetBkColor(0xFFFFFF) ;~ $1_B1 = GUICtrlCreateButton("B1", 136, 80, 107, 25) ;~ GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") ;~ $1_B2 = GUICtrlCreateButton("B2", 248, 80, 107, 25) ;~ GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") ;~ GUICtrlCreateLabel($txt, 16, 24, 338, 52) ;~ GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") ;~ GUICtrlSetColor(-1, 0x000000) ;~ GUISetState(@SW_SHOW) ;~ #EndRegion ### END Koda GUI section ### #Region ### START Koda GUI section ### Form= $2_GUI = GUICreate($title, 370, 0?"Hi :)":120, -1, -1) GUISetBkColor(0xFFFFFF) $2_B1 = GUICtrlCreateButton("B1", 136, 80, 107, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $2_B2 = GUICtrlCreateButton(0?":D":"B2", 248, 80, 107, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateLabel($txt, 16, 24, 338, 52) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $u32dll = DllOpen("user32.dll") ;~ Opt("GUIOnEventMode", 1) ;~ GUICtrlSetOnEvent(-3, "_Exit") ; TODO: Fix, doesn't work with 2 GUI at the same time ;~ GUICtrlSetOnEvent($B11, "_Exit") ;~ GUICtrlSetOnEvent($B21, "_Exit") ;~ GUICtrlSetOnEvent($B12, "_Exit") ;~ GUICtrlSetOnEvent($B22, "_Exit") ;~ $pos1 = WinGetPos($GUI1) ;~ $pos2 = WinGetPos($GUI1) While 1 ;~ $pos1 = WinGetPos($GUI1) ;~ $pos2 = WinGetPos($GUI1) ;~ $x = $pos1[0] - 370 ;~ $y = $pos1[1] ;~ WinMove($GUI2, "", $x, $y, $pos1[2], $pos1[3], 1) ; Press middle mouse button to close (it's gonna be a non malicious prank for my friend) If _IsPressed(4, $u32dll) Then Exit $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _Exit() ;~ Case $1_B1 ;~ _Exit() ;~ Case $1_B2 ;~ _Exit() Case $2_B1 _Exit() Case $2_B2 _Exit() EndSwitch WEnd Func _Exit() ; TODO: ... ;~ GUIDelete($1_GUI) GUIDelete($2_GUI) Exit EndFunc ;==>_Exit How to get rid of these errors?
    • Nareshm
      By Nareshm
      I create message box but i dont know how to add button action when i click it.

      Help for : Add script for Button : Left, Right, Right Finger
      example when i press Left finger button do Case $idNotepad
                      $iPID = WinActivate ( " :PS :: Version - 2.8.0.0  - [eFS Bill]")
                              ControlSend(" :DS  - eF :: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:btnReset]", "{esc}")
                              ControlClick ( " :DS  - eF :: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:txtrdNo]")
                              ControlSend(" :DS  - eF:: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:txtrdNo]", "^v")
                              ControlSend(" :DS  - eF :: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:txtrdNo]", "{enter}")
      How to add like above ?
                    
                                                                sorry for my bad english
       
    • Altor
      By Altor
      Hi all:
      In Scite it is possible to expand and collapse  all  the #Region at time  with a shortcut ..?
      Now I use the + key to expand and collapse but I can only use this suggestion for a one # Region
      If I collapse all the regions one by one  in order to have the code more understandable when I re-open the script all the regions are expanded and I need to collapse all again one by one.
      Thank.s to all
      Altor
    • corgano
      By corgano
      Edit: A solution was found! Thanks Jos and others who helped me find this:
      You can have AutoIt run a different "Main" autoit script when you hit F5 instead of the current one, per folder, by doing the following:
      Run SciTE (might need administrator, depending on how autoit was installed) Options -> global properties (alt o g) Uncomment properties.directory.enable=1 (line 270 in my case) create a file SciTEDirectory.properties in the project's main folder Alternatively, if you don't have admin or don't want to edit the global.properties for whatever reason, you can just skip step 1,2,3 and name it SciTE.properties Put in the file you created command.go.$(au3)="$(SciteDefaultHome)\..\AutoIt3.exe" "$(SciteDefaultHome)\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "NAME OF SCRIPT HERE.au3" /UserParams $(1) $(2) $(3) $(4) Save the file. Now anything you run in that folder or subfolder will run the main script when you hit F5 Using SciTEDirectory.properties effects that folder and subfolders, where as SciTE.properties only effects that folder. Apart from that they work the same

      Original question:
      I have a main script, and a bunch of includes / udf's. Almost every single time I edit my includes I hit F5 to run the script, but it runs the include instead. I'm tired of switching back to the main script's tab in SciTE to run it, just to switch back to the include. Is there some kind of #flag or option to set a "main au3 file" so when I hit F5, it will see that and run the main file instead?