Sign in to follow this  
Followers 0
devilyn

Action depended on two actions

9 posts in this topic

Hi

I want to hide a GUI only after I checked a checkbox field and clicked on an ok button

Im new in autoit please help

Regards

Lior

Share this post


Link to post
Share on other sites



http://www.autoitscript.com/forum/index.ph...opic=21048&st=0

Try Valuaters tutorial... might teach you what you need to know.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Also look at GUICtrlRead() in the help file.

Share this post


Link to post
Share on other sites

i'm sorry again but i can't figure this out i paste my gui code here please help me if you can

thanks in advance

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

$1 = GuiCreate("MutilTool Page 1" , 392, 323,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$READ = GUICTRLREAD(10)
$Group1 = GUICtrlCreateGroup ("Choose Your Action", 60, 30, 280, 110 )
$Radio_1 = GuiCtrlCreateRadio("1", 90, 50, 130, 20)
[/quote]$Radio_2 = GuiCtrlCreateRadio("2", 90, 80, 130, 20)
$Radio_4 = GuiCtrlCreateRadio("3", 90, 110, 130, 20)
$Group1 = GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

GUICtrlSetState($Radio_4,$GUI_DISABLE)
GUICtrlSetState($Radio_2,$GUI_DISABLE)
GUICtrlSetState($Radio_1,$GUI_DISABLE)

$Checkbox_5 = GuiCtrlCreateCheckbox("4", 60, 10, 180, 10)
$Checkbox_6 = GuiCtrlCreateCheckbox("5", 60, 150, 220, 10)
$Checkbox_7 = GuiCtrlCreateCheckbox("6", 60, 180, 210, 20)
$Button_2 = GuiCtrlCreateButton("&OK", 150, 280, 90, 30)
GUICtrlSetState($Button_2,$GUI_FOCUS)  


GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select

    Case $msg = $Button_2
        
    
    Case Else
        if GUICtrlRead($Checkbox_5) = 1 Then 
            GUICtrlSetState($Radio_4,$GUI_ENABLE)
            GUICtrlSetState($Radio_2,$GUI_ENABLE)
            gUICtrlSetState($Radio_1,$GUI_ENABLE)
            
        ElseIf GUICtrlRead($Checkbox_5) = 4 Then
            GUICtrlSetState($Radio_4,$GUI_DISABLE)
            GUICtrlSetState($Radio_2,$GUI_DISABLE)
            GUICtrlSetState($Radio_1,$GUI_DISABLE)
        EndIf
    EndSelect
WEnd
Exit

i need to make it close the gui after i checked the box in "$Checkbox_7" and click "$Button_2"

only after these two conditions the gui should close

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

i'm sorry again but i can't figure this out i paste my gui code here please help me if you can

thanks in advance

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

$1 = GuiCreate("MutilTool Page 1" , 392, 323,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$READ = GUICTRLREAD(10)
$Group1 = GUICtrlCreateGroup ("Choose Your Action", 60, 30, 280, 110 )
$Radio_1 = GuiCtrlCreateRadio("1", 90, 50, 130, 20)
[/quote]$Radio_2 = GuiCtrlCreateRadio("2", 90, 80, 130, 20)
$Radio_4 = GuiCtrlCreateRadio("3", 90, 110, 130, 20)
$Group1 = GUICtrlCreateGroup ("",-99,-99,1,1);close group

GUICtrlSetState($Radio_4,$GUI_DISABLE)
GUICtrlSetState($Radio_2,$GUI_DISABLE)
GUICtrlSetState($Radio_1,$GUI_DISABLE)

$Checkbox_5 = GuiCtrlCreateCheckbox("4", 60, 10, 180, 10)
$Checkbox_6 = GuiCtrlCreateCheckbox("5", 60, 150, 220, 10)
$Checkbox_7 = GuiCtrlCreateCheckbox("6", 60, 180, 210, 20)
$Button_2 = GuiCtrlCreateButton("&OK", 150, 280, 90, 30)
GUICtrlSetState($Button_2,$GUI_FOCUS)  
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select

    Case $msg = $Button_2
        
    
    Case Else
        if GUICtrlRead($Checkbox_5) = 1 Then 
            GUICtrlSetState($Radio_4,$GUI_ENABLE)
            GUICtrlSetState($Radio_2,$GUI_ENABLE)
            gUICtrlSetState($Radio_1,$GUI_ENABLE)
            
        ElseIf GUICtrlRead($Checkbox_5) = 4 Then
            GUICtrlSetState($Radio_4,$GUI_DISABLE)
            GUICtrlSetState($Radio_2,$GUI_DISABLE)
            GUICtrlSetState($Radio_1,$GUI_DISABLE)
        EndIf
    EndSelect
WEnd
Exit

i need to make it close the gui after i checked the box in "$Checkbox_7" and click "$Button_2"

only after these two conditions the gui should close

I can't make heads or tails of what your trying to do with the group and radio on top of the check boxes... can you walk through what your trying to accomplish with this? Take a look at this and tell me if this is the track your trying to be on:
#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

$1 = GuiCreate("MutilTool Page 1" , 392, 400,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Group1 = GUICtrlCreateGroup ("Choose Your Action", 60, 210, 280, 110 )
$Radio_1 = GuiCtrlCreateRadio("1", 90, 230, 130, 20)
$Radio_2 = GuiCtrlCreateRadio("2", 90, 260, 130, 20)
$Radio_4 = GuiCtrlCreateRadio("3", 90, 290, 130, 20)
$Group1 = GUICtrlCreateGroup ("",-99,-99,1,1);close group

GUICtrlSetState($Radio_4,$GUI_DISABLE)
GUICtrlSetState($Radio_2,$GUI_DISABLE)
GUICtrlSetState($Radio_1,$GUI_DISABLE)

$Checkbox_5 = GuiCtrlCreateCheckbox("4", 60, 120, 25, 20)
$Checkbox_6 = GuiCtrlCreateCheckbox("5", 60, 150, 25, 20)
$Checkbox_7 = GuiCtrlCreateCheckbox("6", 60, 180, 25, 20)
$Button_2 = GuiCtrlCreateButton("&OK", 150, 350, 90, 30, $BS_DEFPUSHBUTTON); $BS_DEFPUSHBUTTON GIVES THE BUTTON FOCUS ON START UP


GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $Button_2 And GUICtrlRead($Checkbox_7) = 1
            Exit
    EndSelect
    If $msg = $Checkbox_5 And GUICtrlRead($Checkbox_5) = 1 Then
        GUICtrlSetState($Radio_4,$GUI_ENABLE)
        GUICtrlSetState($Radio_2,$GUI_ENABLE)
        GUICtrlSetState($Radio_1,$GUI_ENABLE)
    ElseIf $msg = $Checkbox_5 And GUICtrlRead($Checkbox_5) = 4 Then
        GUICtrlSetState($Radio_4,$GUI_DISABLE)
        GUICtrlSetState($Radio_2,$GUI_DISABLE)
        GUICtrlSetState($Radio_1,$GUI_DISABLE)
    EndIf
WEnd
Edit:

Noticed that you have tried to set focus on the button, so I showed how you could do that with a style in the GUICtrlCreateButton() function.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thank you very very much

one more thing if you can insted of exit in "Case $msg = $Button_2 And GUICtrlRead($Checkbox_7) = 1" i want to point to another script page can i do it ?

Edited by Lior Berezinski

Share this post


Link to post
Share on other sites

Thank you very very much

one more thing if you can insted of exit in "Case $msg = $Button_2 And GUICtrlRead($Checkbox_7) = 1" i want to point to another script page can i do it ?

Script Page? Like another script or .exe all together? If so, yes it can be done.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

another script page (Au3).

p.s. if it's a script page (au3) when i will compile it will it be in the same exe?

thanks

Share this post


Link to post
Share on other sites

If you want to run another script, then you are better compiling them both seperatly and using the FileInstall function to add the second file to the first.

If you want to access function in a second au3 file to do some extra stuff, then you should use the #include command. Then compiling the first au3 will compile the second au3 file as well.


“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

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