Jump to content

Help With Syntax


Recommended Posts

I have these lines in my script, but I wonder if there is an other way that I can put it. :">

If GuiCtrlRead($CheckXls) <> 1 and GuiCtrlRead($CheckSAP) <> 1 and GuiCtrlRead($CheckSurf) <> 1 and GuiCtrlRead($CheckMcAfee) <> 1 and GuiCtrlRead($CheckExch) <> 1 then
MsgBox(16, "Vroege Dienst", "None of the options are selected. Klik OK to stop the program.")
Exit
Endif
Edited by Lempke
Link to comment
Share on other sites

Using continuation characters would make it easier to read.

Your code with "_" used

If GUICtrlRead($CheckXls) <> 1 And _
    GUICtrlRead($CheckSAP) <> 1 And _
    GUICtrlRead($CheckSurf) <> 1 And _
    GUICtrlRead($CheckMcAfee) <> 1 And _
    GUICtrlRead($CheckExch) <> 1 Then
    MsgBox(16, "Vroege Dienst", "None of the options are selected. Klik OK to stop the program.")
    Exit
EndIf

or a small function to help out

If _NotChecked($CheckXls) And _
    _NotChecked($CheckSAP) And _
    _NotChecked($CheckSurf) And _
    _NotChecked($CheckMcAfee) And _
    _NotChecked($CheckExch) Then
    MsgBox(16, "Vroege Dienst", "None of the options are selected. Klik OK to stop the program.")
    Exit
EndIf

Func _NotChecked($handle)
    Return GUICtrlRead($handle) <> 1
EndFunc

Either way, the continuation characters transform the code into a clearer structure of code.

Using arrays instead would help to loop through each to determine it's state. If you have alot of checkboxes the arrays are the best choice.

Link to comment
Share on other sites

Using continuation characters would make it easier to read.

Your code with "_" used

That's exactly what I was looking for.

I am still a newby when using AutoIt, :think: but lovin' the program. :(

THX MHz

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...