Jump to content
Sign in to follow this  
caramen

How to toggle this var ? Logic help.

Recommended Posts

Hello guys,

Seem simple but i dont get it work.

I whant to list process only if process list is changing.

I canot toggle even playing with some process.

#include <Array.au3>


Global $aProcessListPrev1 , $aProcessListPrev2

While 1
    $aProcessListPrev1 = _ArrayToString(ProcessList (), " :: ", 4, 7, @CRLF, 2, 5)
    ;_ArrayDisplay($aProcessListPrev1)
    If $aProcessListPrev1 = $aProcessListPrev2 Then
       Msgbox(0,"","Scan proc KO")
       $ToggleProcessList = 1
       ;$aProcessListPrev1 = _ArrayToString(ProcessList (), " :: ", 4, 7, @CRLF, 2, 5)
       $aProcessListPrev2 = _ArrayToString(ProcessList (), " :: ", 4, 7, @CRLF, 2, 5)
    Else
       Msgbox(0,"","Scan proc OK")
       $ToggleProcessList = 0
       ;$aProcessListPrev1 = _ArrayToString(ProcessList (), " :: ", 4, 7, @CRLF, 2, 5)
       $aProcessListPrev2 = _ArrayToString(ProcessList (), " :: ", 4, 7, @CRLF, 2, 5)
    EndIf
    If $ToggleProcessList = 1 Then
       Msgbox(0,"","Toggle 1")
    Else
       Msgbox(0,"","Toggle 0")
    EndIf
WEnd
#include <Array.au3>


Global $aProcessListPrev1 , $aProcessListPrev2

While 1
    $aProcessListPrev1 = ProcessList ()
    ;_ArrayDisplay($aProcessListPrev1)
    If $aProcessListPrev1 = $aProcessListPrev2 Then
       Msgbox(0,"","Scan proc KO")
       $ToggleProcessList = 1
       ;$aProcessListPrev1 = ProcessList ()
       $aProcessListPrev2 = ProcessList ()
    Else
       Msgbox(0,"","Scan proc OK")
       $ToggleProcessList = 0
       ;$aProcessListPrev1 = ProcessList ()
       $aProcessListPrev2 = ProcessList ()
    EndIf
    If $ToggleProcessList = 1 Then
       Msgbox(0,"","Toggle 1")
    Else
       Msgbox(0,"","Toggle 0")
    EndIf
WEnd

I dont want to use _ArrayMaxIndex becose i am closing an application to open an other it will not toggle.

To say more:

I want to get $ToggleProcessList = 0 If Process list does not change

and $ToggleProcessList = 1 If process list change

I will do same with WinList

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

The first function _ArrayToString is incorrect, what are the last two delimiters "2, 5" when you only have 2 columns?  And why only the rows between 4 and 7?  Can't you use the processname to get the list down?

Share this post


Link to post
Share on other sites

I just copy pasted it from help file. To point to an other logic.

 

I need to fix this to use in a function without processname.


My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks.

Not sure i think i got it :

#include <Array.au3>


Global $aProcessListPrev1 , $aProcessListPrev2 , $aProcessListPrev11 = 0 , $aProcessListPrev22 = 0

    $aProcessListPrev1 = ProcessList ()
    $aProcessListPrev11 = _ArrayToString($aProcessListPrev1, "|")
    MsgBox(0,"$aProcessListPrev11",""&$aProcessListPrev11)

While 1

    ;_ArrayDisplay($aProcessListPrev1)
    If $aProcessListPrev11 = $aProcessListPrev22 Then
       Msgbox(0,"","Scan proc IDEM NO NEXT")
       $ToggleProcessList = 1
       ;$aProcessListPrev1 = _ArrayToString(ProcessList (), "|", -1,-1)
       $aProcessListPrev2 = ProcessList ()
       $aProcessListPrev22 = _ArrayToString($aProcessListPrev2, "|" )
       MsgBox(0,"$aProcessListPrev22 NO NEXT",""&$aProcessListPrev22)
    Else
       Msgbox(0,"","Scan proc NO IDEM YES NEXT")
       $ToggleProcessList = 0
       ;$aProcessListPrev1 = _ArrayToString(ProcessList (), "|", -1 , -1 )
         $aProcessListPrev1 = ProcessList ()
         $aProcessListPrev11 = _ArrayToString($aProcessListPrev1, "|")
         $aProcessListPrev2 = ProcessList ()
         $aProcessListPrev22 = _ArrayToString($aProcessListPrev2, "|" )
       MsgBox(0,"$aProcessListPrev11 YES NEXT",""&$aProcessListPrev11)
       MsgBox(0,"$aProcessListPrev22 YES NEXT",""&$aProcessListPrev22)
    EndIf
    If $ToggleProcessList = 0 Then
       Msgbox(0,"","Toggle 0 NO IDEM YES NEXT")
    Else
       Msgbox(0,"","Toggle 1 YES IDEM NO NEXT")
    EndIf
 WEnd

Testing...


My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Yes it's working.

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...