Jump to content

AND operator is not working


Jochem
 Share

Recommended Posts

$close = ProcessWaitClose($process1, 1000) And ProcessWaitClose($process2, 1000) And ProcessWaitClose($process3, 1000)
            If $close = 1 Then
                $log = FileOpen($logpath & $logpathprog1 & $comptername & ".log", 1)
                FileWriteLine($log, "closed: " & @MDAY & "-" & @MON & " " & @HOUR & ":" & @MIN)
                FileClose($log)

The AND operator is not working like this but is working more like OR. But I want just to write a log file if all the processes are close and not just one of them.

Edited by Jochem
Link to comment
Share on other sites

$close = ProcessWaitClose($process1, 1000) And ProcessWaitClose($process2, 1000) And ProcessWaitClose($process3, 1000)
            If $close = 1 Then
                $log = FileOpen($logpath & $logpathprog1 & $comptername & ".log", 1)
                FileWriteLine($log, "closed: " & @MDAY & "-" & @MON & " " & @HOUR & ":" & @MIN)
                FileClose($log)

The AND operator is not working like this but is working more like OR. But I want just to write a log file if all the processes are close and not just one of them.

Is this working as you expect it to (try changing parameters):

$a = 1
$b = 1
$c = 0

$close = $a And $b And $c

If $close Then
    ConsoleWrite(@MDAY & "-" & @MON & " " & @HOUR & ":" & @MIN & @CRLF)
Else
    ConsoleWrite("! At least one is false." & @CRLF)
EndIf

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

$iPID_1 = Run ("notepad.exe")
$iPID_2 = Run ("notepad.exe")
$iPID_3 = Run ("notepad.exe")

If (ProcessWaitClose ($iPID_1, 0)) AND (ProcessWaitClose ($iPID_2, 1000)) AND (ProcessWaitClose ($iPID_3, 1000)) Then
    MsgBox (0, "", "All Closed")
EndIf

Cheers,

Brett

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