Jump to content

Recommended Posts

Posted (edited)

hello again... Ive been messing around with this for a while to get it to work but its not working.

#include <GUIConstants.au3>
HotKeySet("{esc}", "quit")
HotKeySet("{F1}", "How")
GUICreate("Update Addons - Menu", 300, 300)  
GUISetState (@SW_SHOW)
$how = GUICtrlCreateButton( "How To Use", 0, 10)

$Start = GUICtrlCreateButton("Start Selected", 281, 370 , 120, 30)

$Menu = GUICtrlCreateMenu ("Menu")
$A = GUICtrlCreateMenuitem ("A",$Menu)
$B = GUICtrlCreateMenuitem ("B",$Menu)
$C = GUICtrlCreateMenuitem ("C",$Menu)
$D = GUICtrlCreateMenuitem ("D",$Menu)
$E = GUICtrlCreateMenuitem ("E",$Menu)
$F = GUICtrlCreateMenuitem ("F",$Menu)
$G = GUICtrlCreateMenuitem ("G",$Menu)
$H = GUICtrlCreateMenuitem ("H",$Menu)
$I = GUICtrlCreateMenuitem ("I",$Menu)
$J = GUICtrlCreateMenuitem ("J",$Menu)
$K = GUICtrlCreateMenuitem ("K",$Menu)
$L = GUICtrlCreateMenuitem ("L",$Menu)
$M = GUICtrlCreateMenuitem ("M",$Menu)
$N = GUICtrlCreateMenuitem ("N",$Menu)
$O = GUICtrlCreateMenuitem ("O",$Menu)
$P = GUICtrlCreateMenuitem ("P",$Menu)
$Q = GUICtrlCreateMenuitem ("Q",$Menu)
$R = GUICtrlCreateMenuitem ("R",$Menu)
$S = GUICtrlCreateMenuitem ("S",$Menu)
$T = GUICtrlCreateMenuitem ("T",$Menu)
$U = GUICtrlCreateMenuitem ("U",$Menu)
$V = GUICtrlCreateMenuitem ("V",$Menu)
$W = GUICtrlCreateMenuitem ("W",$Menu)
$X = GUICtrlCreateMenuitem ("X",$Menu)
$Y = GUICtrlCreateMenuitem ("Y",$Menu)
$Z = GUICtrlCreateMenuitem ("Z",$Menu)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $Msg = $Start
$Read = GUICtrlRead($Checkbox1);start
If $Read = $GUI_CHECKED Then
RunWait("notepad")
Sleep(2000)
EndIf
$Read = GUICtrlRead($Checkbox2);start
If $Read = $GUI_CHECKED Then
RunWait('"' & @ProgramFilesDir & '\Internet Explorer\IEXPLORE.EXE"')
Sleep(2000)
EndIf;end
$Read = GUICtrlRead($Checkbox3)
If $Read = $GUI_CHECKED Then
Run('"' & @ProgramFilesDir & '\uTorrent\uTorrent.exe"')
Sleep(2000)
EndIf
;A
Case $msg = $A
$title = WinGetTitle( "Update Mods -")
Guidelete($title)
GUICreate("Update Addons - A", 700, 500)
GUISetState (@SW_SHOW)
$Checkbox1 = GUICtrlCreateCheckbox("A", 20, 5)
$Checkbox2 = GUICtrlCreateCheckbox("B", 20, 25)
$Checkbox3 = GUICtrlCreateCheckbox("C", 20, 45)
$Start = GUICtrlCreateButton("Start Selected", 281, 370 , 120, 30)
EndSelect
Wend
Func quit()
exit    
EndFunc

Func How()
msgbox(0, "title", "text")
EndFunc

when I try to delete $how = GUICtrlCreateButton( "How To Use", 0, 10)

and then save>run script and check the box for C it instantly unchecks it after.

when the its there it doesent happen.

nothing is using $how whats the problem? :S

Edited by will88
Posted (edited)

I noticed you didn't create checkboxes??

Try the following:

#include <GUIConstantsEx.au3>

HotKeySet("{F1}", "How")

GUICreate("Update Addons - Menu", 300, 300)  

$how = GUICtrlCreateButton( "How To Use", 10, 10)

$Start = GUICtrlCreateButton("Start Selected", 100, 10 , 120, 30)

$Checkbox1 = GUICtrlCreateCheckbox("notepad", 50, 50)
$Checkbox2 = GUICtrlCreateCheckbox("IE", 50, 90)
$Checkbox3 = GUICtrlCreateCheckbox("uTorrent", 50, 130)

$Menu = GUICtrlCreateMenu ("Menu")
$A = GUICtrlCreateMenuitem ("A",$Menu)

GUISetState (@SW_SHOW)

While 1
$msg = GUIGetMsg()
Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $Msg = $Start
        $Read = GUICtrlRead($Checkbox1);start
        If $Read = $GUI_CHECKED Then
            RunWait("notepad")
            Sleep(2000)
        EndIf
        $Read = GUICtrlRead($Checkbox2);start
        If $Read = $GUI_CHECKED Then
            RunWait('"' & @ProgramFilesDir & '\Internet Explorer\IEXPLORE.EXE"')
            Sleep(2000)
        EndIf;end
        $Read = GUICtrlRead($Checkbox3)
        If $Read = $GUI_CHECKED Then
            Run('"' & @ProgramFilesDir & '\uTorrent\uTorrent.exe"')
            Sleep(2000)
        EndIf
    ;A
    Case $msg = $A
        $title = WinGetTitle( "Update Mods -")
        Guidelete($title)
        GUICreate("Update Addons - A", 700, 500)
        GUISetState (@SW_SHOW)
        $Checkbox1 = GUICtrlCreateCheckbox("A", 20, 5)
        $Checkbox2 = GUICtrlCreateCheckbox("B", 20, 25)
        $Checkbox3 = GUICtrlCreateCheckbox("C", 20, 45)
        $Start = GUICtrlCreateButton("Start Selected", 281, 370 , 120, 30)
    EndSelect
Wend

Func quit()
    exit    
EndFunc

Func How()
    msgbox(0, "title", "text")
EndFunc
Edited by Triblade

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Posted (edited)

My quick first reaction is:

You don't have to set the hotkey to quit on escape.

You have a nice built-in function for that

AutoItSetOption(GUICloseOnESC, 1 OR 0)

thanks

edit: thanks triblade figured out my problem by looking at the code you posted, all I needed to do was put

$Start = GUICtrlCreateButton("Start Selected", 281, 370 , 120, 30)

before the checkboxes..

Edited by will88
Posted

Great.

The problem is somehow it comes into the Case $msg = $A again...

I think, if you don't mind, im gonna post this in the bug section.

A few pointers though.

If you put your GUICreate into a var

$gui = GUICreate("Update Addons - Menu", 300, 300)oÝ÷ Ù8^*.ví«Þj«vئy×¥zا+ZºÚ"µÍÝZY[]J   ÌÍÙÝZJoÝ÷ Øìµæ¡ûj·!x¢¶­Ù^jwméÝzW­x-çèºw^ÚòwH¥êì¢v¥+¶lPµ+ZµäHsméhÂlP(ÚèÄzlnÞ¦-{¦¦Wܨºf²)ºÈ§Ö±ú+i·­µêïì(*.­Êx¸¤y«­¢+Ù%ÄôÈQ¡¸)íÑôá¥Ð)¹%(ì=È)]¡¥±Ä)íÑô5Í   ½à ¤)]¹

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Posted (edited)

If you put your GUICreate into a var
$gui = GUICreate("Update Addons - Menu", 300, 300)
Then you dont have a hard time deleting it
Guidelete($gui)

I did that because the title isnt always going to be Update Addons - Menu it will depend on which letter was picked. If B was picked on the menu it would be Update Addons - B..

yea Im having the same problem with b now as I did with checkbox C.

problem with tabs is there will be 24 of em which is alot lol.

Edited by will88
Posted

If you put your GUICreate into a var
$gui = GUICreate("Update Addons - Menu", 300, 300)
Then you dont have a hard time deleting it
Guidelete($gui)

I did that because the title isnt always going to be Update Addons - Menu it will depend on which letter was picked. If B was picked on the menu it would be Update Addons - B..

yea Im having the same problem with b now as I did with checkbox C.

problem with tabs is there will be 24 of em which is alot lol.

If the title is going to be changed then it's even better to put the GUI in a var :s

If your GUI is AutoIt made, then delete the GUI via the var, never via the title.

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Posted

I did that because the title isnt always going to be Update Addons - Menu it will depend on which letter was picked. If B was picked on the menu it would be Update Addons - B..

Opt ("WinTitleMatchMode", 2) will solve that problem.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted (edited)

I edited

Case $msg = $A

Guidelete($gui)

$gui2 = GUICreate("Update Addons - A", 300, 300)

GUISetState (@SW_SHOW)

and added $gui = GUICreate("Update Addons - Menu", 300, 300) at the top of the script..

now instead of unchecking b everytime you click b it does GUICreate("Update Addons - A", 300, 300)

Edited by will88
Posted (edited)

How would I make this work right? its suppost to wait until checkboxes are checked and the button is pressed. But It just creates gui windows everytime checkbox B is pressed

#include <GUIConstants.au3>
HotKeySet("{F1}", "How")
AutoItSetOption("GUICloseOnESC", 1)

$gui = GUICreate("Update Addons - Menu", 300, 300)  
GUISetState (@SW_SHOW)
$Start = GUICtrlCreateButton("Start Selected", 281, 370 , 120, 30)
$Menu = GUICtrlCreateMenu ("Menu")
$A = GUICtrlCreateMenuitem ("A",$Menu)
$B = GUICtrlCreateMenuitem ("B",$Menu)
$C = GUICtrlCreateMenuitem ("C",$Menu)
$D = GUICtrlCreateMenuitem ("D",$Menu)
$E = GUICtrlCreateMenuitem ("E",$Menu)
$F = GUICtrlCreateMenuitem ("F",$Menu)
$G = GUICtrlCreateMenuitem ("G",$Menu)
$H = GUICtrlCreateMenuitem ("H",$Menu)
$I = GUICtrlCreateMenuitem ("I",$Menu)
$J = GUICtrlCreateMenuitem ("J",$Menu)
$K = GUICtrlCreateMenuitem ("K",$Menu)
$L = GUICtrlCreateMenuitem ("L",$Menu)
$M = GUICtrlCreateMenuitem ("M",$Menu)
$N = GUICtrlCreateMenuitem ("N",$Menu)
$O = GUICtrlCreateMenuitem ("O",$Menu)
$P = GUICtrlCreateMenuitem ("P",$Menu)
$Q = GUICtrlCreateMenuitem ("Q",$Menu)
$R = GUICtrlCreateMenuitem ("R",$Menu)
$S = GUICtrlCreateMenuitem ("S",$Menu)
$T = GUICtrlCreateMenuitem ("T",$Menu)
$U = GUICtrlCreateMenuitem ("U",$Menu)
$V = GUICtrlCreateMenuitem ("V",$Menu)
$W = GUICtrlCreateMenuitem ("W",$Menu)
$X = GUICtrlCreateMenuitem ("X",$Menu)
$Y = GUICtrlCreateMenuitem ("Y",$Menu)
$Z = GUICtrlCreateMenuitem ("Z",$Menu)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop


Case $Msg = $Start
$Read = GUICtrlRead($Checkbox1);start
If $Read = $GUI_CHECKED Then
RunWait("notepad")
Sleep(2000)
EndIf
$Read = GUICtrlRead($Checkbox2);start
If $Read = $GUI_CHECKED Then
RunWait('"' & @ProgramFilesDir & '\Internet Explorer\IEXPLORE.EXE"')
Sleep(2000)
EndIf;end
$Read = GUICtrlRead($Checkbox3)
If $Read = $GUI_CHECKED Then
Run('"' & @ProgramFilesDir & '\uTorrent\uTorrent.exe"')
Sleep(2000)
EndIf
Case $msg = $A
Guidelete($gui)
$gui2 = GUICreate("Update Addons - A", 300, 300)
GUISetState (@SW_SHOW)

$Start = GUICtrlCreateButton("Start Selected", 281, 370 , 120, 30)
$Checkbox1 = GUICtrlCreateCheckbox("A", 20, 5)
$Checkbox2 = GUICtrlCreateCheckbox("B", 20, 25)
$Checkbox3 = GUICtrlCreateCheckbox("C", 20, 45)


EndSelect
Wend
Func How()
MsgBox(0, "How To Use", "How To Use")
EndFunc
Edited by will88

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...