Sign in to follow this  
Followers 0
lekremyelsew

GUI menu not working

10 posts in this topic

#1 ·  Posted (edited)

Hello, I'm having trouble with the GUI menu in a script

I'm creating a new version of Hot Corners the script currently has no functionality

I cant get the GUI menu to do anything, I looked at the sample in the helpfile but I still cant pick out why its not workng

The code is rather long and all the Dims are for AU3Check, at the bottom of the GUI section is the problem area

The script needs a few extra files to work properly which I have attachedHotCorners.zip

#include <GUIConstants.au3>
#include <Constants.au3>
#NoTrayIcon
Opt("TrayMenuMode",1)

TraySetClick(8)
$conf_tray = TrayCreateItem("Configure")
TrayCreateItem("")
$disable_subtray = TrayCreateMenu("Disable")
$both_disable = TrayCreateItem("Both",$disable_subtray)
TrayCreateItem("",$disable_subtray)
$hot_disable = TrayCreateItem("Hot Corners",$disable_subtray)
$move_disable = TrayCreateItem("Mouse Move",$disable_subtray)
$about_tray = TrayCreateItem("About")
TrayCreateItem("")
$exit_tray = TrayCreateItem("Exit")
TraySetState()
TraySetToolTip("Hot Corners 2")

Dim $help_help
Dim $gui
Dim $gui_active
Dim $ok_button
Dim $cancel_button
Dim $about_button
Dim $tl_combo
Dim $tr_combo
Dim $bl_combo
Dim $br_combo
Dim $up_combo
Dim $lf_combo
Dim $dn_combo
Dim $rt_combo
Dim $quit_file
Dim $close_file
Dim $reload_file
$move_state = 2
$hot_state = 2
$both_state = 2

While 1
    $msg_tray = TrayGetMsg()
    Switch $msg_tray
        Case $both_disable
            Both_Tray()
        Case $exit_tray
            Exit
        Case $hot_disable
            Hot_Tray()
        Case $move_disable
            Move_Tray()
        Case $conf_tray
            Gui()
    EndSwitch
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            $gui_active = 0
        Case $cancel_button
            GUIDelete()
            $gui_active = 0
        Case $about_button
            GUISetState(@SW_DISABLE)
            MsgBox(0,"Title","Text")
            GUISetState(@SW_ENABLE)
        Case $ok_button
            IniSave()
            GUIDelete()
            $gui_active = 0
        Case $tl_combo
            If "Run..." = GUICtrlRead($tl_combo) Then
                MsgBox(0,"Title","Text")
            EndIf
        Case $close_file
            GUIDelete()
            $gui_active = 0
        Case $help_help
            Exit
    EndSwitch
WEnd

Func Gui()
    If $gui_active = 1 Then
        WinActivate($gui)
    Else
        $gui = GUICreate("Hot Corners", 441, 383, 275, 185)
        GUISetIcon(@ScriptDir & "\Resources\Cursor.ico")
        $ok_button = GUICtrlCreateButton("&OK", 174, 328, 75, 25, 0)
        $cancel_button = GUICtrlCreateButton("&Cancel", 254, 328, 75, 25, 0)
        $about_button = GUICtrlCreateButton("&About", 336, 328, 75, 25, 0)
        $tab_gui = GUICtrlCreateTab(16, 0, 409, 318)
        $hot_tab = GUICtrlCreateTabItem("Hot Corners")
        $tl_group = GUICtrlCreateGroup("Top Left", 48, 48, 145, 105)
        $tl_icon = GUICtrlCreateIcon(@ScriptDir & "\Resources\TL.ico", 0, 104, 72, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
        $tl_combo = GUICtrlCreateCombo("", 64, 120, 113, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_SORT))
        GUICtrlSetData(-1, "Control Panel|My Documents|Nothing|Run...|Open Folder...|Screen Saver|Search Google|Show Desktop|Stand By",IniRead("config.ini","Corners","TL","Crap"))
        $tr_group = GUICtrlCreateGroup("Top Right", 248, 48, 145, 105)
        $tr_icon = GUICtrlCreateIcon(@ScriptDir & "\Resources\TR.ico", 0, 304, 72, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
        $tr_combo = GUICtrlCreateCombo("", 264, 120, 113, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_SORT))
        GUICtrlSetData(-1, "Control Panel|My Documents|Nothing|Run...|Open Folder...|Screen Saver|Search Google|Show Desktop|Stand By",IniRead("config.ini","Corners","TR","Crap"))
        $bl_group = GUICtrlCreateGroup("Bottom Left", 48, 176, 145, 105)
        $bl_icon = GUICtrlCreateIcon(@ScriptDir & "\Resources\BL.ico", 0, 104, 200, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
        $bl_combo = GUICtrlCreateCombo("", 64, 248, 113, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_SORT))
        GUICtrlSetData(-1, "Control Panel|My Documents|Nothing|Run...|Open Folder...|Screen Saver|Search Google|Show Desktop|Stand By",IniRead("config.ini","Corners","BL","Crap"))
        $br_group = GUICtrlCreateGroup("Bottom Right", 248, 176, 145, 105)
        $br_icon = GUICtrlCreateIcon(@ScriptDir & "\Resources\BR.ico", 0, 304, 200, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
        $br_combo = GUICtrlCreateCombo("", 264, 246, 113, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_SORT))
        GUICtrlSetData(-1, "Control Panel|My Documents|Nothing|Run...|Open Folder...|Screen Saver|Search Google|Show Desktop|Stand By",IniRead("config.ini","Corners","BR","Crap"))
        $move_tab = GUICtrlCreateTabItem("Mouse Move")
        $up_group = GUICtrlCreateGroup("Up", 160, 40, 121, 105)
        $up_icon = GUICtrlCreateIcon(@ScriptDir & "\Resources\UP.ico", 0, 200, 64, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
        $up_combo = GUICtrlCreateCombo("", 172, 111, 97, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_SORT))
        GUICtrlSetData(-1, "Control Panel|My Documents|Nothing|Run...|Open Folder...|Screen Saver|Search Google|Show Desktop|Stand By",IniRead("config.ini","Directions","UP","Crap"))
        $lf_group = GUICtrlCreateGroup("Left", 32, 104, 121, 105)
        $lf_icon = GUICtrlCreateIcon(@ScriptDir & "\Resources\LF.ico", 0, 72, 128, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
        $lf_combo = GUICtrlCreateCombo("", 44, 175, 97, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_SORT))
        GUICtrlSetData(-1, "Control Panel|My Documents|Nothing|Run...|Open Folder...|Screen Saver|Search Google|Show Desktop|Stand By",IniRead("config.ini","Directions","LF","Crap"))
        $dn_group = GUICtrlCreateGroup("Down", 160, 184, 121, 105)
        $dn_icon = GUICtrlCreateIcon(@ScriptDir & "\Resources\DN.ico", 0, 200, 208, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
        $dn_combo = GUICtrlCreateCombo("", 172, 255, 97, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_SORT))
        GUICtrlSetData(-1, "Control Panel|My Documents|Nothing|Run...|Open Folder...|Screen Saver|Search Google|Show Desktop|Stand By",IniRead("config.ini","Directions","DN","Crap"))
        $rt_group = GUICtrlCreateGroup("Right", 288, 104, 121, 105)
        $rt_icon = GUICtrlCreateIcon(@ScriptDir & "\Resources\RT.ico", 0, 328, 128, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
        $rt_combo = GUICtrlCreateCombo("", 300, 175, 97, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL,$CBS_SORT))
        GUICtrlSetData(-1, "Control Panel|My Documents|Nothing|Run...|Open Folder...|Screen Saver|Search Google|Show Desktop|Stand By",IniRead("config.ini","Directions","RT","Crap"))
        $file_menu = GUICtrlCreateMenu("&File")
        $reload_file = GUICtrlCreateMenuItem("Reload", $file_menu)
        $close_file = GUICtrlCreateMenuItem("Close", $file_menu)
        $quit_file = GUICtrlCreateMenuItem("Quit", $file_menu)
        $options_menu = GUICtrlCreateMenu("&Options")
        $settings_options = GUICtrlCreateMenuItem("Settings...", $options_menu)
        $bug_options = GUICtrlCreateMenuItem("Bug Report...", $options_menu)
        $help_menu = GUICtrlCreateMenu("&Help")
        $about_help = GUICtrlCreateMenuItem("About...", $help_menu)
        $help_help = GUICtrlCreateMenuItem("Help...", $help_menu)
        GUISetState(@SW_SHOW)
        $gui_active = 1
    EndIf
EndFunc

Func Hot_Tray()
    Toggle($hot_state)
    If $hot_state = 1 Then
    ElseIf $hot_state = 0 Then
    ElseIf $hot_state = 2 Then
        TrayItemSetState($hot_disable,$TRAY_ENABLE + $TRAY_CHECKED)
        $hot_state = 1
    EndIf
EndFunc

Func Move_Tray()
    Toggle($move_state)
    If $move_state = 1 Then
    ElseIf $move_state = 0 Then
    ElseIf $move_state = 2 Then
        TrayItemSetState($move_disable,$TRAY_ENABLE + $TRAY_CHECKED)
        $move_state = 1
    EndIf
EndFunc

Func Both_Tray()
    Toggle($both_state)
    If $both_state = 1 Then
        TrayItemSetState($move_disable,$TRAY_DISABLE + $TRAY_CHECKED)
        TrayItemSetState($hot_disable,$TRAY_DISABLE + $TRAY_CHECKED)
        If $move_state <> 2 Then $move_state = 2
        If $hot_state <> 2 Then $hot_state = 2
    ElseIf $both_state = 0 Then
        TrayItemSetState($move_disable,$TRAY_ENABLE + $TRAY_UNCHECKED)
        TrayItemSetState($hot_disable,$TRAY_ENABLE + $TRAY_UNCHECKED)
        If $move_state <> 2 Then $move_state = 2
        If $hot_state <> 2 Then $hot_state = 2
    ElseIf $both_state = 2 Then
        TrayItemSetState($both_disable,$TRAY_ENABLE + $TRAY_CHECKED)
        $both_state = 1
        TrayItemSetState($move_disable,$TRAY_DISABLE + $TRAY_CHECKED)
        TrayItemSetState($hot_disable,$TRAY_DISABLE + $TRAY_CHECKED)
        If $move_state <> 2 Then $move_state = 1
        If $hot_state <> 2 Then $hot_state = 1
    EndIf
EndFunc

Func Toggle(ByRef $toggle)
    If $toggle = 1 Then
        $toggle = 0
    ElseIf $toggle = 0 Then
        $toggle = 1
    EndIf
EndFunc

Func IniSave()
    IniWrite("config.ini","Corners","TL",GUICtrlRead($tl_combo))
    IniWrite("config.ini","Corners","TR",GUICtrlRead($tr_combo))
    IniWrite("config.ini","Corners","BL",GUICtrlRead($bl_combo))
    IniWrite("config.ini","Corners","BR",GUICtrlRead($br_combo))
    IniWrite("config.ini","Directions","UP",GUICtrlRead($up_combo))
    IniWrite("config.ini","Directions","LF",GUICtrlRead($lf_combo))
    IniWrite("config.ini","Directions","DN",GUICtrlRead($dn_combo))
    IniWrite("config.ini","Directions","RT",GUICtrlRead($rt_combo))
EndFunc
Edited by lekremyelsew

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hello, I'm having trouble with the GUI menu in a script

I'm creating a new version of Hot Corners the script currently has no functionality

I cant get the GUI menu to do anything, I looked at the sample in the helpfile but I still cant pick out why its not workng

The code is rather long and all the Dims are for AU3Check, at the bottom of the GUI section is the problem area

The script needs a few extra files to work properly which I have attachedHotCorners.zip

This idea is pretty cool, I've never seen anything like it before... If I understand you code right, you're also missing something that actually checks the mouse position/movement, for example:

;This would go in the while...wend loop
$pos = MouseGetPos() 
If $pos[0] = 0 and $pos[1] = 0 then ShellExecute($whatever you want...)

EDIT: Missed something in the code...

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Yeah, I know, I'm not really concerned about that at the moment

The real problem is the GUI menu which isnt doing anything right now

If you can figure that out that would be great. :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hey, I worked a little on this just to give you a start... Add this in your loop

$pos = MouseGetPos() 
        If $pos[0] < 3 and $pos[1] < 3 then 
            $temp = IniRead("config.ini","Corners","TL", "Nothing") 
            Select
                Case $temp = "My Documents" 
                    ShellExecute(@MyDocumentsDir) 
                Case $temp = "Run..." 
                    Send("#r")
            EndSelect
        ElseIf $pos[0] = 0 and $pos[1] > (@DesktopHeight - 3) then 
            $temp = IniRead("config.ini","Corners","BL", "Nothing") 
            Select
                Case $temp = "My Documents" 
                    ShellExecute(@MyDocumentsDir) 
                Case $temp = "Run..." 
                    Send("#r")
            EndSelect   
        EndIf
;You can do the rest

Hope this helps you get started...

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Yeah, I know, I'm not really concerned about that at the moment

The real problem is the GUI menu which isnt doing anything right now

If you can figure that out that would be great. :)

This one is easier... I think... Ok, first of all make you menu right after the gui. The way you have it the menu only works for the second tab (don't ask my why)... Then obviously you need to make code for each one, don't forget to dim them. And btw you can dim all you variables together like:

Dim $help_help, $about_help, $gui, $gui_active, $ok_button, $cancel_button ;et cetera

Hope that helps...


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Ohhhh! i get it :)

the menu was under the second tab

so if i move it to before the whole thing it will work fine!

Thx a Million!

:D Your welcome... And please post you code when your done, I would like to see it when it's completed!


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Ohhhh! i get it :)

the menu was under the second tab

so if i move it to before the whole thing it will work fine!

Thx a Million!

Oh, thats a bad glitch in Koda, they might wanna fix that

Share this post


Link to post
Share on other sites

Ohhhh! i get it :)

the menu was under the second tab

so if i move it to before the whole thing it will work fine!

Thx a Million!

Oh, thats a bad glitch in Koda, they might wanna fix that

:D I replied to a future post


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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
Sign in to follow this  
Followers 0