Jump to content
nacerbaaziz

question about the GUICtrlCreateTab

Recommended Posts

nacerbaaziz

Hi dears

I've got a question in creating tabs in autoit
Usually in other programs you can move between tabs by pressing ctrl + tab or ctrl + shift + tab

I tried to create a window  which have a multy  tab but when i press one of the shortcuts
it does not move between the tabs
Is there an option to enable or disable this
Greetings
this is the example i tryed

#include <GUIConstants.au3>
#include <MsgBoxConstants.au3>
#include <TabConstants.au3>
#include <ComboConstants.au3>
#include <WindowsConstants.au3>
#include <GuiComboBox.au3>
effectsSettings()
func effectsSettings()
local $echoCombo[6], $reverbCombo[5],  $CHORUSCombo[8], $flangerCombo[8], $paramEQCombo[4], $distortionCombo[6], $gargleCombo[3]
$EffWindow = GUICreate("efects settings", 400, 400, -1, -1, $WS_TABSTOP)
local $BtOK = GUICtrlCreateButton("ok", 5, 360, 50, 30, 0x01)
GUIStartGroup("")
local $BTCancel = GUICtrlCreateButton("cancel", 340, 360, 50, 30)
GUIStartGroup("")
local $effectTabs =     GUICtrlCreateTab(10, 10, 380, 70)
GUICtrlSetState(-1, $GUI_focus)
        GUICtrlCreateTabItem("echo")
GUICtrlCreateLabel("fWetDryMix", 50, 100, 100, 60)
$echoCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
GUICtrlCreateLabel("fFeedback", 180, 100, 100, 60)
$echoCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
    GUICtrlCreateLabel("fLeftDelay", 290, 100, 100, 60)
$echoCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40)
    GUICtrlCreateLabel("fRightDelay", 50, 180, 100, 60)
$echoCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40)
    GUICtrlCreateLabel("lPanDelay", 180, 180, 100, 60)
$echoCombo[5] = GUICtrlCreateCombo("", 190, 190, 80, 40)
        GUICtrlCreateTabItem("reverb")
GUICtrlCreateLabel("fInGain", 50, 100, 100, 60)
$ReverbCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
    GUICtrlCreateLabel("fReverbMix", 180, 100, 100, 60)
$ReverbCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
    GUICtrlCreateLabel("fReverbTime", 290, 100, 100, 60)
$ReverbCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40)
    GUICtrlCreateLabel("fHighFreqRTRatio", 50, 180, 100, 60)
$ReverbCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40)
    GUICtrlCreateTabItem("chorus")
GUICtrlCreateLabel("fWetDryMix", 50, 100, 100, 60)
$ChorusCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
    GUICtrlCreateLabel("fDepth", 180, 100, 100, 60)
$ChorusCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
    GUICtrlCreateLabel("fFeedback", 290, 100, 100, 60)
$ChorusCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40)
    GUICtrlCreateLabel("fFrequency", 50, 180, 100, 60)
$ChorusCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40)
    GUICtrlCreateLabel("lWaveform", 180, 180, 100, 60)
$ChorusCombo[5] = GUICtrlCreateCombo("", 190, 190, 80, 40)
    GUICtrlCreateLabel("fDelay", 290, 180, 100, 60)
$ChorusCombo[6] = GUICtrlCreateCombo("", 300, 190, 80, 40)
    GUICtrlCreateLabel("lPhase", 50, 260, 100, 60)
$ChorusCombo[7] = GUICtrlCreateCombo("", 60, 270, 80, 40)
        GUICtrlCreateTabItem("flanger")
GUICtrlCreateLabel("fWetDryMix", 50, 100, 100, 60)
$FlangerCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
    GUICtrlCreateLabel("fDepth", 180, 100, 100, 60)
$FlangerCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
    GUICtrlCreateLabel("fFeedback", 290, 100, 100, 60)
$FlangerCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40)
    GUICtrlCreateLabel("fFrequency", 50, 180, 100, 60)
$FlangerCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40)
    GUICtrlCreateLabel("lWaveform", 180, 180, 100, 60)
$FlangerCombo[5] = GUICtrlCreateCombo("", 190, 190, 80, 40)
    GUICtrlCreateLabel("fDelay", 290, 180, 100, 60)
$FlangerCombo[6] = GUICtrlCreateCombo("", 300, 190, 80, 40)
    GUICtrlCreateLabel("lPhase", 50, 260, 100, 60)
$FlangerCombo[7] = GUICtrlCreateCombo("", 60, 270, 80, 40)
        GUICtrlCreateTabItem("paramatric eq")
GUICtrlCreateLabel("fCenter", 50, 100, 100, 60)
$parameqCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
    GUICtrlCreateLabel("fBandwidth", 180, 100, 100, 60)
$ParamEqCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
    GUICtrlCreateLabel("fGain", 290, 100, 100, 60)
$parameqCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40)
        GUICtrlCreateTabItem("distortion")
GUICtrlCreateLabel("fGain", 50, 100, 100, 60)
$distortionCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
    GUICtrlCreateLabel("fEdge", 180, 100, 100, 60)
$distortionCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
    GUICtrlCreateLabel("fPostEQCenterFrequency", 290, 100, 100, 60)
$distortionCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40)
    GUICtrlCreateLabel("fFrequency", 50, 180, 100, 60)
$distortionCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40)
    GUICtrlCreateLabel("fPostEQBandwidth", 180, 180, 100, 60)
$distortionCombo[5] = GUICtrlCreateCombo("", 190, 190, 80, 40)
        GUICtrlCreateTabItem("gargle")
GUICtrlCreateLabel("dwRateHz", 50, 100, 100, 60)
$gargleCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
    GUICtrlCreateLabel("dwWaveShape", 180, 100, 100, 60)
$gargleCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
GUISetState(@sw_show, $EffWindow)
While 1
Switch GUIGetMSG()
case $GUI_Event_close, $BTCancel
exit
EndSwitch
Wend
return ""
endFunc

Share this post


Link to post
Share on other sites
water

Maybe this line of the help file for GUICtrlCreateTabItem explains waht you missed:

Quote

It is important to close the tab structure by creating a final tabitem control with a null text - GUICtrlCreateTabItem("").

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
nacerbaaziz

The same problem dear

Share this post


Link to post
Share on other sites
TheXman
Posted (edited)

@nacerbaaziz

When the tab itself is highlighted, the left and right arrow keys allow you to move between tabs.

Edited by TheXman

Whoever said that there's no such thing as a dumb question, probably asked a lot of DUMB questions.  Dumb questions are ones that you can easily find the answer to on your own.

Share this post


Link to post
Share on other sites
nacerbaaziz

@TheXman
I know this my dear

But the Feature wich i talking about it
it Works anywhere in the window

So for that I liked to ask about this Feature if it is exist  in autoit or no
I hope with all my heart that it exists because ,it is a very sweet feature

Greetings to all

Share this post


Link to post
Share on other sites
Deye
Posted (edited)

nacerbaaziz ,

#include <GUIConstants.au3>
#include <WinAPISys.au3>
#include <GuiTab.au3>

Global $hGui, $idUser

HotKeySet("^{1}", "_SwitchMode1")

HotKeySet("^{2}", "_SwitchMode2")
HotKeySet("^+{2}", "_SwitchMode2")

Example()

Func Example()
    $hGui = GUICreate("My GUI Tab", 350, 150) ; will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    Local $idTab = GUICtrlCreateTab(10, 10, 300, 100)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 50, 20)
    GUICtrlCreateButton("OK0", 20, 50, 50, 20)
    GUICtrlCreateInput("default", 80, 50, 70, 20)

    GUICtrlCreateTabItem("tab----1")
    GUICtrlCreateLabel("label1", 30, 80, 50, 20)
    GUICtrlCreateCombo("", 20, 50, 60, 120)
    GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo|guinness", "Jon") ; default Jon
    GUICtrlCreateButton("OK1", 80, 50, 50, 20)

    GUICtrlCreateTabItem("tab2")
    GUICtrlCreateLabel("label2", 30, 80, 50, 20)
    GUICtrlCreateButton("OK2", 140, 50, 50)

    GUICtrlCreateTabItem("tab3")
    GUICtrlCreateLabel("label3", 30, 80, 50, 20)
    GUICtrlCreateButton("OK3", 140, 50, 50)

    GUICtrlCreateTabItem("tab4")
    GUICtrlCreateLabel("label4", 30, 80, 50, 20)
    GUICtrlCreateButton("OK4", 140, 50, 50)

    GUICtrlCreateTabItem("") ; end tabitem definition

    GUICtrlCreateLabel("Click on tab and see the title", 20, 130, 250, 20)

    Local $iCount = _GUICtrlTab_GetItemCount($idTab) - 1, $bShift, $bCtrl, $imode = 0
    $idUser = GUICtrlCreateDummy()
    GUICtrlSetData($idUser, 0)

    Local $aAccelKeys[2][2] = [["^{TAB}", $idUser], ["^+{TAB}", $idUser]]
    GUISetAccelerators($aAccelKeys)

    GUISetState(@SW_SHOW)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()
        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
        If $idMsg = $idTab Then
            ; display the clicked tab
            WinSetTitle("My GUI Tab", "", "My GUI Tab" & GUICtrlRead($idTab))
        EndIf
        If $idMsg = $idUser Then
            $bShift = (_WinAPI_GetAsyncKeyState(0x10) < 0 ? 1 : 0)
            $bCtrl = (_WinAPI_GetAsyncKeyState(0x11) < 0 ? 1 : 0)
            $iTab = GUICtrlRead($idTab)
            Switch (GUICtrlRead($idUser) <> 0 ? GUICtrlRead($idUser) : 0)
                Case 0                                  ; switch to next tab  +-
                     ControlFocus($hGui, "", "SysTabControl321")
                    If $iTab = $iCount Or $iTab = 0 Then
                        If Not $bShift And $iTab = 0 Then
                            _GUICtrlTab_ActivateTab($idTab, 1)
                        ElseIf Not $bShift Then
                            _GUICtrlTab_ActivateTab($idTab, ($iTab = 0 ? $idTab : 0))
                        Else
                            _GUICtrlTab_ActivateTab($idTab, ($iTab = $iCount ? $iCount - 1 : $iCount))
                        EndIf
                    Else
                        ControlSend($hGui, "", $idTab, _GUICtrlTab_ActivateTab($idTab, $iTab))
                    EndIf

                Case 1                                  ;send out a raw key combo to trigger screen reader
                    GUISetAccelerators("")
                    GUICtrlSetData($idUser, 0)
                    MsgBox(0, '', "Start screen Reader - hot key")
                    $bCtrl = ($bCtrl = 0 ? "" : "^")
                    $bShift = ($bShift = 0 ? "" : "+")

;~                      Send($bShift & "{b}")            ;in example can be anything else other than "{TAB}, omit $bCtrl or $bShift depending on what the outer program needs to recall"

                    Send($bCtrl & $bShift & "{TAB}")
                    Send("{CTRLUP}")
                    Send("{SHIFTUP}")
                    GUISetAccelerators($aAccelKeys)
                Case 2                                  ;HotKeySet to attach functions
                    GUICtrlSetData($idUser, 0)
                    If $bShift And $bCtrl Then ;"^+{*}"
                        _Test12()
                    ElseIf $bCtrl Then ;"^{*}"
                        _Test1()
                    EndIf
            EndSwitch
        EndIf
        Sleep(10)
    WEnd
EndFunc   ;==>Example

Func _SwitchMode1()                         ;send out a raw key combo to start screen reader (see : Case 1 )
    WinActivate($hGui, "")
    GUICtrlSendToDummy($idUser, 1)
EndFunc   ;==>_SwitchMode1

Func _SwitchMode2()                         ;HotKeySet to attach functions
    WinActivate($hGui, "")
    GUICtrlSendToDummy($idUser, 2)
EndFunc   ;==>_SwitchMode2

Func _Test1()
    MsgBox(262144, "Test 2", "Started function activated with " & @CRLF & "Hotkey : Ctrl + ")
EndFunc   ;==>_Test1

Func _Test12()
    MsgBox(262144, 'Test 2', "Started function activated with " & @CRLF & "Hotkey :  Ctrl + Shift")
EndFunc   ;==>_Test12

 

Edited by Deye
FInal edit

Share this post


Link to post
Share on other sites
nacerbaaziz

Unfortunately GUISetAccelerators do not work here because ctrl + tab and ctrl + shift + tab
Is a regular shortcut for the screen reader and its task is to move between the tabs
Thus, these two shortcut keys  can not be assigned to specific work
Greetings

Share this post


Link to post
Share on other sites
Deye
Posted (edited)

see above

 

Edited by Deye

Share this post


Link to post
Share on other sites
Deye
Posted (edited)

try my last edit in my posts above

Deye

Edited by Deye

Share this post


Link to post
Share on other sites
nacerbaaziz

@Deye
Thanks dear for your interaction with my subject.
Brother, in order to fully understand my point, i hope that you try to  open any window created using any other language but Provided  that it contain tabs.
For example
System Configuration Tool
I mean (msconfig.exe)
Then select any of the items by using the TAB key .
after that, please try pressing the keybord shortcut CTRL + TAB and the shortcut CTRL + SHIFT + TAB
and see the result
with all my regards and respect to you dear

Share this post


Link to post
Share on other sites
Subz

Don't know if this helps but why not something like:

#include <GuiTab.au3>

Global $effectTabs ;~ Remove the Local declaration in effectsSettings function

HotKeySet("^{Tab}", "_TabRight")
HotKeySet("^+{Tab}", "_TabRight")

;~ Rest of your code here..

Func _TabRight()
    Local $iTabItems = _GUICtrlTab_GetItemCount ($effectTabs) - 1
    Local $iTabItem = _GUICtrlTab_GetCurSel($effectTabs)
    If $iTabItem = $iTabItems Then _GUICtrlTab_SetCurSel($effectTabs, 0) ;~ If its the last tab, go to the first tab
    _GUICtrlTab_SetCurSel($effectTabs, $iTabItem + 1)
EndFunc

 

Share this post


Link to post
Share on other sites
Deye

nacerbaaziz,

I believe you can work it out to play nicely with your screen reader if you will understand the options of what can be done with the example i have edited above
Particularly follow up  HotKeySet "^{1}"  ..

Deye

Share this post


Link to post
Share on other sites
Deye
Posted (edited)

acerbaaziz,

I just tried out screen reader i noticed that it will be hard to follow some of the lines i have posted in my example
Hence, I incorporated the tab switching functionality into your example so you can first check what works ..

#include <GUIConstants.au3>
#include <MsgBoxConstants.au3>
#include <TabConstants.au3>
#include <ComboConstants.au3>
#include <WindowsConstants.au3>
#include <GuiComboBox.au3>
#include <WinAPISys.au3>
#include <GuiTab.au3>

effectsSettings()
func effectsSettings()
local $echoCombo[6], $reverbCombo[5],  $CHORUSCombo[8], $flangerCombo[8], $paramEQCombo[4], $distortionCombo[6], $gargleCombo[3]
$EffWindow = GUICreate("efects settings", 400, 400, -1, -1, $WS_TABSTOP)
local $BtOK = GUICtrlCreateButton("ok", 5, 360, 50, 30, 0x01)
GUIStartGroup("")
local $BTCancel = GUICtrlCreateButton("cancel", 340, 360, 50, 30)
GUIStartGroup("")
local $effectTabs =     GUICtrlCreateTab(10, 10, 380, 70)
GUICtrlSetState(-1, $GUI_focus)
     GUICtrlCreateTabItem("echo")
GUICtrlCreateLabel("fWetDryMix", 50, 100, 100, 60)
$echoCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
GUICtrlCreateLabel("fFeedback", 180, 100, 100, 60)
$echoCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
    GUICtrlCreateLabel("fLeftDelay", 290, 100, 100, 60)
$echoCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40)
    GUICtrlCreateLabel("fRightDelay", 50, 180, 100, 60)
$echoCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40)
    GUICtrlCreateLabel("lPanDelay", 180, 180, 100, 60)
$echoCombo[5] = GUICtrlCreateCombo("", 190, 190, 80, 40)
    GUICtrlCreateTabItem("reverb")
GUICtrlCreateLabel("fInGain", 50, 100, 100, 60)
$ReverbCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
    GUICtrlCreateLabel("fReverbMix", 180, 100, 100, 60)
$ReverbCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
    GUICtrlCreateLabel("fReverbTime", 290, 100, 100, 60)
$ReverbCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40)
    GUICtrlCreateLabel("fHighFreqRTRatio", 50, 180, 100, 60)
$ReverbCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40)
    GUICtrlCreateTabItem("chorus")
GUICtrlCreateLabel("fWetDryMix", 50, 100, 100, 60)
$ChorusCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
    GUICtrlCreateLabel("fDepth", 180, 100, 100, 60)
$ChorusCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
    GUICtrlCreateLabel("fFeedback", 290, 100, 100, 60)
$ChorusCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40)
    GUICtrlCreateLabel("fFrequency", 50, 180, 100, 60)
$ChorusCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40)
    GUICtrlCreateLabel("lWaveform", 180, 180, 100, 60)
$ChorusCombo[5] = GUICtrlCreateCombo("", 190, 190, 80, 40)
    GUICtrlCreateLabel("fDelay", 290, 180, 100, 60)
$ChorusCombo[6] = GUICtrlCreateCombo("", 300, 190, 80, 40)
    GUICtrlCreateLabel("lPhase", 50, 260, 100, 60)
$ChorusCombo[7] = GUICtrlCreateCombo("", 60, 270, 80, 40)
    GUICtrlCreateTabItem("flanger")
GUICtrlCreateLabel("fWetDryMix", 50, 100, 100, 60)
$FlangerCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
    GUICtrlCreateLabel("fDepth", 180, 100, 100, 60)
$FlangerCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
    GUICtrlCreateLabel("fFeedback", 290, 100, 100, 60)
$FlangerCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40)
    GUICtrlCreateLabel("fFrequency", 50, 180, 100, 60)
$FlangerCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40)
    GUICtrlCreateLabel("lWaveform", 180, 180, 100, 60)
$FlangerCombo[5] = GUICtrlCreateCombo("", 190, 190, 80, 40)
    GUICtrlCreateLabel("fDelay", 290, 180, 100, 60)
$FlangerCombo[6] = GUICtrlCreateCombo("", 300, 190, 80, 40)
    GUICtrlCreateLabel("lPhase", 50, 260, 100, 60)
$FlangerCombo[7] = GUICtrlCreateCombo("", 60, 270, 80, 40)
    GUICtrlCreateTabItem("paramatric eq")
GUICtrlCreateLabel("fCenter", 50, 100, 100, 60)
$parameqCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
    GUICtrlCreateLabel("fBandwidth", 180, 100, 100, 60)
$ParamEqCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
    GUICtrlCreateLabel("fGain", 290, 100, 100, 60)
$parameqCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40)
    GUICtrlCreateTabItem("distortion")
GUICtrlCreateLabel("fGain", 50, 100, 100, 60)
$distortionCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
    GUICtrlCreateLabel("fEdge", 180, 100, 100, 60)
$distortionCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
    GUICtrlCreateLabel("fPostEQCenterFrequency", 290, 100, 100, 60)
$distortionCombo[3] = GUICtrlCreateCombo("", 300, 110, 80, 40)
    GUICtrlCreateLabel("fFrequency", 50, 180, 100, 60)
$distortionCombo[4] = GUICtrlCreateCombo("", 60, 190, 80, 40)
    GUICtrlCreateLabel("fPostEQBandwidth", 180, 180, 100, 60)
$distortionCombo[5] = GUICtrlCreateCombo("", 190, 190, 80, 40)
    GUICtrlCreateTabItem("gargle")
    GUICtrlCreateTabItem("") ; end tabitem definition
GUICtrlCreateLabel("dwRateHz", 50, 100, 100, 60)
$gargleCombo[1] = GUICtrlCreateCombo("", 60, 110, 80, 40)
    GUICtrlCreateLabel("dwWaveShape", 180, 100, 100, 60)
$gargleCombo[2] = GUICtrlCreateCombo("", 190, 110, 80, 40)
Local $iCount = _GUICtrlTab_GetItemCount($effectTabs) - 1, $bShift, $bCtrl
$idUser = GUICtrlCreateDummy()
GUICtrlSetData(-1, 0)
Local $aAccelKeys[2][2] = [["^{TAB}", $idUser], ["^+{TAB}", $idUser]]
GUISetAccelerators($aAccelKeys)
GUISetState(@sw_show, $EffWindow)
While 1
Switch GUIGetMSG()
case $GUI_Event_close, $BTCancel
exit
; the function that switches between tabs
case $idUser
$bShift = (_WinAPI_GetAsyncKeyState(0x10) < 0 ? 1 : 0)
$iTab = GUICtrlRead($effectTabs)
ControlFocus($EffWindow, "", "SysTabControl321")
If $iTab = $iCount Or $iTab = 0 Then
If Not $bShift And $iTab = 0 Then
_GUICtrlTab_ActivateTab($effectTabs, 1)
ElseIf Not $bShift Then
_GUICtrlTab_ActivateTab($effectTabs, ($iTab = 0 ? $iTab : 0))
Else
_GUICtrlTab_ActivateTab($effectTabs, ($iTab = $iCount ? $iCount - 1 : $iCount))
EndIf
Else
ControlSend($EffWindow, "", $effectTabs,  $iTab)
EndIf
EndSwitch
Wend
return ""
endFunc

 

Edited by Deye

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

    • nooneclose
      By nooneclose
      How do I properly convert this to Autoit? This is a VBA macro that I recorded in Excel.
       ActiveSheet.Outline.ShowLevels RowLevels:=2 I need this to close my subtotal once it is finished. 
      any help will be greatly appreciated. 
    • iMacg3
      By iMacg3
      Hi,
      I was looking into a way to delete a registry key (not a specific value, an entire key) if it is present. I was considering using RegRead and RegDelete. However, RegRead appears to only read values, not just keys. Is there a way to delete an entire registry key if it is present? I have heard that the below function may help.
       
      #include-once ; #UDF# ======================================================================================================================= ; Title .........: Reads\Search the name of a Key\Subkey\Value ; AutoIt Version : 3.3.8.1 ; Language ......: English ; Description ...: Lists all Keys\Subkeys\Values in a specified registry key ; Author(s) .....: DXRW4E ; Notes .........: ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;~ _RegEnumKeyEx ;~ _RegEnumValEx ; =============================================================================================================================== #Region ;**** Global constants and vars **** Global Const $sValueTypes[12] = ["REG_NONE","REG_SZ","REG_EXPAND_SZ","REG_BINARY","REG_DWORD","REG_DWORD_BIG_ENDIAN","REG_LINK","REG_MULTI_SZ","REG_RESOURCE_LIST","REG_FULL_RESOURCE_DESCRIPTOR","REG_RESOURCE_REQUIREMENTS_LIST","REG_QWORD"] #EndRegion ;**** Global constants and vars **** ; #FUNCTION# ======================================================================================================================== ; Name...........: _RegEnumKeyEx ; Description ...: Lists all subkeys in a specified registry key ; Syntax.........: _RegEnumKeyEx($KeyName[, $iFlag = 0[, $sFilter = "*"]]) ; Parameters ....: $KeyName - The registry key to read. ; $iFlag - Optional specifies Recursion (add the flags together for multiple operations): ; |$iFlag = 0 (Default) All Key-SubKeys Recursive Mod ; |$iFlag = 1 All SubKeys Not Recursive Mod ; |$iFlag = 2 Include in ArrayList in the first element $KeyName ; |$iFlag = 16 $sFilter do Case-Sensitive matching (By Default $sFilter do Case-Insensitive matching) ; |$iFlag = 32 Disable the return the count in the first element - effectively makes the array 0-based (must use UBound() to get the size in this case). ; By Default the first element ($array[0]) contains the number of strings returned, the remaining elements ($array[1], $array[2], etc.) ; |$iFlag = 64 $sFilter is REGEXP Mod, See Pattern Parameters in StringRegExp ; |$iFlag = 128 Enum value's name (_RegEnumKeyEx Return a 2D array, maximum Array Size limit is 3999744 Key\Value) ; |$iFlag = 256 Reads a value data, this flag will be ignored if the $iFlag = 128 is not set ; $sFilter - Optional the filter to use, default is *. (Multiple filter groups such as "All "*.XXx|*.YYY|*.ZZZ") ; Search the Autoit3 helpfile for the word "WildCards" For details. ; $vFilter - Optional the filter to use for ValueName, $vFilter will be ignored if the $iFlag = 128 is not set ; default is *. (Multiple filter groups such as "All "*.XXx|*.YYY|*.ZZZ") Search the Autoit3 helpfile for the word "WildCards" For details. ; $iValueTypes - Optional, set Value Types to search (Default $iValueTypes = 0 Read All), $iValueTypes will be ignored if the $iFlag = 128 is not set ; (add the flags together for multiple operations): ; 1 = REG_SZ ; 2 = REG_EXPAND_SZ ; 3 = REG_BINARY ; 4 = REG_DWORD ; 5 = REG_DWORD_BIG_ENDIAN ; 6 = REG_LINK ; 7 = REG_MULTI_SZ ; 8 = REG_RESOURCE_LIST ; 9 = REG_FULL_RESOURCE_DESCRIPTOR ; 10 = REG_RESOURCE_REQUIREMENTS_LIST ; 11 = REG_QWORD ; Return values .: Success - Return Array List (See Remarks) ; Failure - @Error ; |1 = Invalid $sFilter ; |2 = No Key-SubKey(s) Found ; |3 = Invalid $vFilter ; |4 = No Value-Name(s) Found ; Author ........: DXRW4E ; Modified.......: ; Remarks .......: The array returned is one-dimensional and is made up as follows: ; $array[0] = Number of Key-SubKeys returned ; $array[1] = 1st Key\SubKeys ; $array[2] = 2nd Key\SubKeys ; $array[3] = 3rd Key\SubKeys ; $array[n] = nth Key\SubKeys ; ; If is set the $iFlag = 128 The array returned is 2D array and is made up as follows: ; $array[0][0] = Number of Key-SubKeys returned ; $array[1][0] = 1st Key\SubKeys ; $array[1][1] = 1st Value name ; $array[1][2] = 1st Value Type (REG_NONE or REG_SZ or REG_EXPAND_SZ ect ect) ; $array[1][3] = 1st Value Data (If is set $iFlag = 256 Else Value Data = "") ; $array[2][0] = 2nd Key\SubKeys ; $array[2][1] = 2nd Value name ; $array[2][2] = 2nd Value Type (REG_NONE or REG_SZ or REG_EXPAND_SZ ect ect) ; $array[2][3] = 2nd Value Data (If is set $iFlag = 256 Else Value Data = "") ; $array[n][0] = nth Key\SubKeys ; Related .......: _RegEnumValEx() ; Link ..........: ; Example .......: _RegEnumKeyEx("HKEY_CURRENT_USER\Software\AutoIt v3") ; Note ..........: ; =================================================================================================================================== Func _RegEnumKeyEx($KeyName, $iFlag = 0, $sFilter = "*", $vFilter = "*", $iValueTypes = 0) If StringRegExp($sFilter, StringReplace("^\s*$|\v|\\|^\||\|\||\|$", Chr(BitAND($iFlag, 64) + 28) & "\|^\||\|\||\|$", "\\\\")) Then Return SetError(1, 0, "") Local $IndexSubKey[101] = [100], $SubKeyName, $BS = "\", $sKeyList, $I = 1, $sKeyFlag = BitAND($iFlag, 1), $sKeyFilter = StringReplace($sFilter, "*", "") If BitAND($iFlag, 2) Then $sKeyList = @LF & $KeyName If Not BitAND($iFlag, 64) Then $sFilter = StringRegExpReplace(BitAND($iFlag, 16) & "(?i)(", "16\(\?\i\)|\d+", "") & StringRegExpReplace(StringRegExpReplace(StringRegExpReplace(StringRegExpReplace($sFilter, "[^*?|]+", "\\Q$0\\E"), "\\E(?=\||$)", "$0\$"), "(?<=^|\|)\\Q", "^$0"), "\*+", ".*") & ")" While $I $IndexSubKey[$I] += 1 $SubKeyName = RegEnumKey($KeyName, $IndexSubKey[$I]) If @error Then $IndexSubKey[$I] = 0 $I -= 1 $KeyName = StringLeft($KeyName, StringInStr($KeyName, "\", 1, -1) - 1) ContinueLoop EndIf If $sKeyFilter Then If StringRegExp($SubKeyName, $sFilter) Then $sKeyList &= @LF & $KeyName & $BS & $SubKeyName Else $sKeyList &= @LF & $KeyName & $BS & $SubKeyName EndIf If $sKeyFlag Then ContinueLoop $I += 1 If $I > $IndexSubKey[0] Then $IndexSubKey[0] += 100 ReDim $IndexSubKey[$IndexSubKey[0] + 1] EndIf $KeyName &= $BS & $SubKeyName WEnd If Not $sKeyList Then Return SetError(2, 0, "") If BitAND($iFlag, 128) <> 128 Then Return StringSplit(StringTrimLeft($sKeyList, 1), @LF, StringReplace(BitAND($iFlag, 32), "32", 2)) $sKeyList = _RegEnumValEx(StringSplit(StringTrimLeft($sKeyList, 1), @LF), $iFlag, $vFilter, $iValueTypes) Return SetError(@Error, 0, $sKeyList) EndFunc ; #FUNCTION# ======================================================================================================================== ; Name...........: _RegEnumValEx ; Description ...: Lists all values in a specified registry key ; Syntax.........: _RegEnumValEx($KeyName[, $iFlag = 0[, $sFilter = "*"]]) ; Parameters ....: $KeyName - The registry key to read Or one-dimensional array RegKeyList ; use _RegEnumKeyEx() to get $RegKeyList (example $RegKeyList = [3, 1st Key\SubKeys, 2st Key\SubKeys, nth Key\SubKeys]) ; |$iFlag = 16 $sFilter do Case-Sensitive matching (By Default $sFilter do Case-Insensitive matching) ; |$iFlag = 32 Disable the return the count in the first element - effectively makes the array 0-based (must use UBound() to get the size in this case). ; By Default the first element ($array[0]) contains the number of strings returned, the remaining elements ($array[1], $array[2], etc.) ; |$iFlag = 64 $sFilter is REGEXP Mod, See Pattern Parameters in StringRegExp ; |$iFlag = 256 Reads a value data ; $sFilter - Optional the filter to use, default is *. (Multiple filter groups such as "All "*.XXx|*.YYY|*.ZZZ") ; Search the Autoit3 helpfile for the word "WildCards" For details. ; $iValueTypes - Optional, set Value Types to search (Default $iValueTypes = 0 Read All) ; (add the flags together for multiple operations): ; 1 = REG_SZ ; 2 = REG_EXPAND_SZ ; 3 = REG_BINARY ; 4 = REG_DWORD ; 5 = REG_DWORD_BIG_ENDIAN ; 6 = REG_LINK ; 7 = REG_MULTI_SZ ; 8 = REG_RESOURCE_LIST ; 9 = REG_FULL_RESOURCE_DESCRIPTOR ; 10 = REG_RESOURCE_REQUIREMENTS_LIST ; 11 = REG_QWORD ; Return values .: Success - Return Array List (See Remarks) ; Failure - @Error ; |3 = Invalid $sFilter ; |4 = No Value-Name(s) Found ; Author ........: DXRW4E ; Modified.......: ; Remarks .......: The array returned is 2D array and is made up as follows: ; $array[0][0] = Number of Key-SubKeys returned ; $array[1][0] = 1st Key\SubKeys ; $array[1][1] = 1st Value name ; $array[1][2] = 1st Value Type (REG_NONE or REG_SZ or REG_EXPAND_SZ ect ect) ; $array[1][3] = 1st Value Data (If is set $iFlag = 256 Else Value Data = "") ; $array[2][0] = 2nd Key\SubKeys ; $array[2][1] = 2nd Value name ; $array[2][2] = 2nd Value Type (REG_NONE or REG_SZ or REG_EXPAND_SZ ect ect) ; $array[2][3] = 2nd Value Data (If is set $iFlag = 256 Else Value Data = "") ; $array[n][0] = nth Key\SubKeys ; Related .......: _RegEnumKeyEx() ; Link ..........: ; Example .......: _RegEnumValEx("HKEY_CURRENT_USER\Software\AutoIt v3") ; Note ..........: ; =================================================================================================================================== Func _RegEnumValEx($aKeyList, $iFlag = 0, $sFilter = "*", $iValueTypes = 0) If StringRegExp($sFilter, "\v") Then Return SetError(3, 0, "") If Not IsArray($aKeyList) Then $aKeyList = StringSplit($aKeyList, @LF) Local $aKeyValList[1954][4], $iKeyVal = Int(BitAND($iFlag, 32) = 0), $sKeyVal = 1953, $sRegEnumVal, $iRegEnumVal, $RegRead = BitAND($iFlag, 256), $vFilter = StringReplace($sFilter, "*", "") If Not BitAND($iFlag, 64) Then $sFilter = StringRegExpReplace(BitAND($iFlag, 16) & "(?i)(", "16\(\?\i\)|\d+", "") & StringRegExpReplace(StringRegExpReplace(StringRegExpReplace(StringRegExpReplace($sFilter, "[^*?|]+", "\\Q$0\\E"), "\\E(?=\||$)", "$0\$"), "(?<=^|\|)\\Q", "^$0"), "\*+", ".*") & ")" For $i = 1 To $aKeyList[0] $iRegEnumVal = 0 While 1 If $iKeyVal = $sKeyVal Then If $sKeyVal = 3999744 Then ExitLoop $sKeyVal *= 2 ReDim $aKeyValList[$sKeyVal + 1][4] EndIf $aKeyValList[$iKeyVal][0] = $aKeyList[$i] $iRegEnumVal += 1 $sRegEnumVal = RegEnumVal($aKeyList[$i], $iRegEnumVal) If @Error <> 0 Then If $iRegEnumVal = 1 And $vFilter = "" Then $iKeyVal += 1 ExitLoop EndIf $aKeyValList[$iKeyVal][2] = $sValueTypes[@Extended] If BitAND(@Extended, $iValueTypes) <> $iValueTypes Then ContinueLoop If $vFilter And Not StringRegExp($sRegEnumVal, $sFilter) Then ContinueLoop $aKeyValList[$iKeyVal][1] = $sRegEnumVal If $RegRead Then $aKeyValList[$iKeyVal][3] = RegRead($aKeyList[$i], $sRegEnumVal) $iKeyVal += 1 WEnd Next $sRegEnumVal = $iKeyVal - Int(BitAND($iFlag, 32) = 0) If Not $sRegEnumVal Or ($sRegEnumVal = 1 And $vFilter = "" And $aKeyValList[$iKeyVal - $sRegEnumVal][2] = "") Then Return SetError(4, 0, "") ReDim $aKeyValList[$iKeyVal][4] If Not BitAND($iFlag, 32) Then $aKeyValList[0][0] = $iKeyVal - 1 Return $aKeyValList EndFunc Thanks.
       
    • great77
      By great77
      ; put the root in a variable $sRoot = "C:\Project\PHexample\" Global $sCurrentTime = _NowCalc() ; We can use that variable here Global $aList = _FileListToArray($sRoot, Default, 2) If @error Then Exit ;;;;;;MsgBox(0, "Error", "_FileListToArray returned @error = " & @error) ;;;;;;;;;;;This is a loop that runs from 1 to the number of items listed in the first element of the returned  array For $i = 1 To UBound($aList) - 1     MsgBox(0, "Folder date", $sRoot & "" & $aList[$i] & @CRLF & @CRLF & FileGetTime($sRoot & "" & $aList[$i], 1, 1))     MsgBox(0, "Folder date", FileGetTime($sRoot & "" & $aList[$i], 1, 1))      $a_filenew = StringReplace(StringReplace(StringReplace(_NowCalc(), "/", ""), ":", ""), " ", "")       MsgBox(0, "Folder date", $a_filenew) $adex =  _DateDiff('D', FileGetTime($sRoot & "" & $aList[$i], 1, 1), $a_filenew)  MsgBox(0,"ade", $adex) Next I have a code as seen above, but the difference in time is returning zero. I understand that the date yyyymmddhhmmss but how can I find the difference.
      The purpose is to try find the difference in days. Any suggestion?  
    • TrashBoat
      By TrashBoat
      So i have been working on this 2d physics game and added some physics to it but got stuck on this problem that the character ( the cube ) is sliding all the time but it should not do that because of this friction function:
      If $horizontalVelocity > 0 Then If $inAir Then $currFriction = $airFriction $horizontalVelocity -= $currFriction $birbX += $horizontalVelocity EndIf this line "$horizontalVelocity -= $currFriction" should nullify the velocity to 0 but it stays somewhere in 0.09. How do i fix this?
      Here's the game's source code and what i have done so far:
      Now i don't expect you reading my nasty code and understanding what it does but any help would be appreciated.
       
      Edit: I guess the problem is solved, i have updated the source code if anyone needs it.
    • Dzenan03
      By Dzenan03
      I want to make a while loop, that creates variables based on a array. For thist I created the array $iDsO with the number and the name of folders in an other folder. Every folder has a different name an I want to create variables(arrays) for each folder that show me all the files in that folder. For example: I have the Folder \Folder1. In it there are the Folders \1, \2, \3. In 1, 2 and 3 there are some files(.png). The array for Folder1 is $iDsO and now I want to crate the arrays $iDsO1, $iDsO2 and $iDsO3 with the files in them can I make something like this:
      While $iDs > 0 ;$iDs is the number of files in Folder1>> $iDsO[0] $iDs#here should come the Foldername for example '1'# = _FileListtoArray(@ProgramFilesDir&"\Folder1\"&$iDsO[$iDs]) $iDs = $iDs - 1 Wend So that in the End I have three variabels ($iDs1, $iDs2 and $iDs3)
       
      Is this posible or if not what could I do instead ( I don´t know the number of folders in Folder1 in the begining).
×