Sign in to follow this  
Followers 0
GEOSoft

If Not Statement

3 posts in this topic

#1 ·  Posted (edited)

Is this right or do I have to rework the top statement?

If NOT FileExists ($File3) AND NOT FileExists ($File4) Then $Status = '0'
    ElseIf Not FileExixst ($File4 AND FileExists ($File3) Then $Status = '1'
    ElseIf Not FileExixst ($File3 AND FileExists ($File4) Then $Status = '2'
    Else
    $Status = '3'
    EndIf
The If "Then" lines wrapped The way i have it the $Status= 'n' is on the same line as the corresponding IF or IFElse statement. Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I don't think you can use the single line syntax unless you are using only a single If statement. It should be:

If Not Condition Then

; Code

ElseIf Not Condition Then

;Code

Else

; Code

EndIf

Also, you may need to put the condition in parenthesis like this:

If Not(FileExists($file1)) AND Not(FileExists($file2)) Then...

That may not be necessary in this case, though.

Edited by Valik

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks Valik;

I have it working with the following

If NOT (FileExists ($File3)) AND NOT (FileExists ($File4)) Then $Status = '0'
    If Not (FileExists ($File4)) AND (FileExists ($File3)) Then $Status = '1'
    If Not (FileExists ($File3)) AND ( FileExists ($File4)) Then $Status = '2'
    If FileExists ($File3) AND FileExists ($File4) Then $Status = '3'

EDIT: Again they are single line statements

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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