Jump to content

Check Box With button


Recommended Posts

CODE

#include <GUIConstants.au3>

#include <File.au3>

Opt("GUIOnEventMode",1) ; New

GUISetState (1) ; will display an dialog box with 1 checkbox

GUICreate("My GUI radio") ; will create a dialog box that when displayed is centered

Local $button_1, $button_2, $button_3

$button_1 = GUICtrlCreateButton ("B&utton 1", 30, 250, 120, 40)

GUICtrlSetOnEvent(-1,"Buttonclicked")

$group_1 = GUICtrlCreateGroup ("Group 1", 10, 10, 50, 205)

GUIStartGroup()

$Checkbox1 = GUICtrlCreateCheckbox ("C", 20, 50)

GUICtrlSetOnEvent(-1,"Check1Clicked_C")

GUISetOnEvent($GUI_EVENT_CLOSE,"close") ; New)

GUISetState(@SW_SHOW)

While 1

Sleep(100)

WEnd

Func Buttonclicked()

EndFunc

Func Check1Clicked_C()

If BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED)=$GUI_CHECKED Then

MsgBox(0,"Info","You check c:")

EndIf

EndFunc

Func close () ; New

MsgBox(0,"Info","Exiting")

Exit

EndFunc

can you help me about this?

autoit don't have example for checkbox with button

example: i click c and d checkbox with button. the code will be delete test.txt to c: and d:

Edited by solid2005
Link to comment
Share on other sites

I dont exacly know what u mean... Can you tell some more?

I made this example. Mayby not what you want but...

#include <GUIConstants.au3>
#include <File.au3>

$GUI = GUICreate("My GUI radio") ; will create a dialog box that when displayed is centered
$button_1 = GUICtrlCreateButton ("B&utton 1", 30, 250, 120, 40)
$group_1 = GUICtrlCreateGroup ("Group 1", 10, 10, 50, 205)
$Checkbox1 = GUICtrlCreateCheckbox ("C", 20, 50)

GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = $GUI_EVENT_CLOSE
        Exit
    Case $nMsg = $button_1
        $Read = GUICtrlRead($Checkbox1)
        If ($Read = 1) Then
            MsgBox(0, "C", "You selected C")
        EndIf
    EndSelect
WEnd
Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

Eg.

1. I Check C and D checkbox = they will delete File in c and d (filename test.txt)

2. I click the button OK C and D will be function. that code i assign to them

Maybe this sort of thing

#include <GUIConstants.au3>
#include <File.au3>
Opt("GUIOnEventMode", 1); New

GUICreate("My GUI radio")
Local $button_1, $button_2, $button_3
$button_1 = GUICtrlCreateButton("B&utton 1", 30, 250, 120, 40)
GUICtrlSetOnEvent(-1, "Buttonclicked")
$group_1 = GUICtrlCreateGroup("Group 1", 10, 10, 50, 205)
GUIStartGroup()
$Checkbox1 = GUICtrlCreateCheckbox("C", 20, 50)
GUICtrlSetOnEvent(-1, "Check1Clicked_C")
$Checkbox2 = GUICtrlCreateCheckbox("D", 20, 80)

GUISetOnEvent($GUI_EVENT_CLOSE, "close"); New)
GUISetState(@SW_SHOW)
While 1
    Sleep(100)
WEnd

Func Buttonclicked()
    
EndFunc  ;==>Buttonclicked
  If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED  Then DoA()
  
  If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED  Then DoD()
  
Func Check1Clicked_C()
    If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
        MsgBox(0, "Info", "You check c:")
    EndIf
EndFunc  ;==>Check1Clicked_C

Func DoA()
;code.....)
    
EndFunc
Func DoD()
;code....   
EndFunc


Func close(); New
    MsgBox(0, "Info", "Exiting")
    Exit
EndFunc  ;==>close
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

CODE
#include <GUIConstants.au3>

#include <File.au3>

Opt("GUIOnEventMode", 1); New

GUICreate("My GUI radio")

Local $button_1, $button_2, $button_3

$button_1 = GUICtrlCreateButton("B&utton 1", 30, 250, 120, 40)

GUICtrlSetOnEvent(-1, "Buttonclicked")

$group_1 = GUICtrlCreateGroup("Group 1", 10, 10, 50, 205)

GUIStartGroup()

$Checkbox1 = GUICtrlCreateCheckbox("C", 20, 50)

GUICtrlSetOnEvent(-1, "Check1Clicked_C")

$Checkbox2 = GUICtrlCreateCheckbox("D", 20, 80)

$Delete = FileDelete ( "\TImer Shop.log" )

GUISetOnEvent($GUI_EVENT_CLOSE, "close"); New)

GUISetState(@SW_SHOW)

While 1

Sleep(100)

WEnd

Func Buttonclicked()

If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then DoA()

If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED Then DoD()

EndFunc ;==>Buttonclicked

Func Check1Clicked_C()

If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then

MsgBox(0, "Info", "You check c:")

EndIf

EndFunc ;==>Check1Clicked_C

Func DoA()

$Delete = FileDelete ( "C:\" )

EndFunc

Func DoD()

$Delete = FileDelete ( "D:\" )

EndFunc

Func close(); New

MsgBox(0, "Info", "Exiting")

Exit

EndFunc ;==>close

waaaa all my drive c and d delete like format ?_?

Edited by solid2005
Link to comment
Share on other sites

O_O

If you want do delete one File, you have to specify it ...

FileDelete ( "D:\test.txt" )

FileDelete ( "C:\test.txt" )

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

No. You have to make a String Variable and then use it:

$Delete = "\TImer Shop.log" 

Func DoA()
FileDelete ( "C:" & $Delete)
EndFunc

Func DoD()
FileDelete ( "D:" & $Delete)
EndFunc

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
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
 Share

  • Recently Browsing   0 members

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