Sign in to follow this  
Followers 0
monte

checkbox condition testing

3 posts in this topic

Hello, I have a gui with a button and a check box. Upon entering the func called by the button, I want to execute something conditioned by the checkbox value. How do you test for the condition of the checkbox? I havn't been able to find the info anywhere (help, here, google). Thank you for you help. Here's my code:

#include <GUIConstants.au3>
#notrayicon
$checkRun = "Emc Script"
If WinExists($checkRun) Then Exit

func sd($sdCheck)
 $vServerClip=clipget()
 $vServerString=stringsplit($vServerClip,@TAB)
 $vServer=$vServerString[22]
 if $sdCheck= 1 then
   runwait("C:\progra~1\lotus\notes\notes.exe myserver/server/folder!!folder\sd.nsf")
   winActivate("server")
   sleep(100)
   send("{F10}vw")
   sleep(100)
   send($vServer)
   send("{ENTER}{ENTER}")
 else
   $site0= ("https://myserver/0000/11111/tmp0")
   $site=stringreplace($site0,"tmp0",$vServer)
   dim $site[5]
   $site[1]= @ComSpec
   $site[2]= $site
   $site[3]= ""
   $site[4]= @SW_HIDE
   Run($site[1] & $site[2], $site[3], $site[4])
 endif
endfunc

GUICreate("script", 400,280)

$button1 = GUICtrlCreateButton ("sd", 60, 10, 40, 40, $BS_ICON)
GUICtrlSetImage (-1, "C:\progra~1\lnotes.ico",0)

$sdCheck = GUICtrlCreateCheckbox ("", 73, 50, 100, 20)

GUISetState ()

While 1
   $msg = GUIGetMsg()
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
   Select
      Case $msg = $button1
         sd($sdCheck)
   EndSelect
WEnd

Share this post


Link to post
Share on other sites



Use GuiCtrlRead to read the state of the checkbox.

#include <GUIConstants.au3>
#notrayicon
$checkRun = "Emc Script"
If WinExists($checkRun) Then Exit
AutoitWinSetTitle($checkRun)

Func sd($sdCheck)
    $vServerClip = ClipGet()
    $vServerString = StringSplit($vServerClip, @TAB)
    $vServer = $vServerString[22]
    If GUICtrlRead($sdCheck) = $GUI_CHECKED Then
        RunWait("C:\progra~1\lotus\notes\notes.exe myserver/server/folder!!folder\sd.nsf")
        WinActivate("server")
        Sleep(100)
        Send("{F10}vw")
        Sleep(100)
        Send($vServer)
        Send("{ENTER}{ENTER}")
    Else
        $site0= ("https://myserver/0000/11111/tmp0")
        $site = StringReplace($site0, "tmp0", $vServer)
        Dim $site[5]
        $site[1] = @ComSpec
        $site[2] = $site
        $site[3] = ""
        $site[4] = @SW_HIDE
        Run($site[1] & $site[2], $site[3], $site[4])
    EndIf
EndFunc

GUICreate("script", 400, 280)

$button1 = GUICtrlCreateButton("sd", 60, 10, 40, 40, $BS_ICON)
GUICtrlSetImage(-1, "C:\progra~1\lnotes.ico", 0)

$sdCheck = GUICtrlCreateCheckbox("", 73, 50, 100, 20)

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Select
        Case $msg = $button1
            sd($sdCheck)
    EndSelect
WEnd

Share this post


Link to post
Share on other sites

MHz, thanks alot! That did it. You just answered in seconds what took me hours to not find! Thank you.

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