Jump to content

IF Statment Question


 Share

Recommended Posts

Hello Everyone,

What may be a simple If Statement question...

Can we use 'and' in an if statement in AutoIt?

For example

if $A =1 and $B = 1 and $C = 1 then
;do what ya want
else
;do something else
endif

I'd rather not do nested if statements if i can avoid it.

Thanks in advance!

- Woody

Link to comment
Share on other sites

Hello Everyone,

What may be a simple If Statement question...

Can we use 'and' in an if statement in AutoIt?

For example

if $A =1 and $B = 1 and $C = 1 then
;do what ya want
else
;do something else
endif

I'd rather not do nested if statements if i can avoid it.

Thanks in advance!

Are you working in SciTE? That makes it easy to just try something like that to see if it works... but yes, you can use both "AND" and "OR" in your conditional statements.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Yes, I am working in SciTE...

Looks to be a syntax issue. I think I have it worked out. In short I am validating the value of an input field. The value is being returned as "4104" verses NULL when a value has not been entered. Any idea why?

I think you need to show us some of the code.
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

Ok sorry about the confusion. I've got it worked out. I was attempting to validate the value of the input control variable and not the GUICtrlRead(of that input control)

if GUICtrlRead($DBInput) <> "" and GUICtrlRead($UserInput) <> "" and GUICtrlRead($PassInput) <> "" Then 
    IniWrite("c:\databases.ini",$c,"database",GUICtrlRead($DBInput))
    IniWrite("c:\databases.ini",$c,"User",GUICtrlRead($UserInput))
    IniWrite("c:\databases.ini",$c,"Pass",GUICtrlRead($PassInput))
    RefreshDB()
Else
     msgbox(48,"Error","You must enter all fields to continue!")
EndIf

Originally I was attempting to validate the value of $DBInput and not GUICtrlRead($DBInput)

Thanks again for your assistance!

Edited by JWoodruff

- Woody

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