Jump to content

Recommended Posts

Posted (edited)

This probably exists. I thought of this last night when i went to bed.

Edit: I build this because i've had need for this in the past, but always solved it in a fixed way. The generic way is the better one imo.

; ----------------------------------------------------------------------------
; AutoIt Version: 3.1.0
; Author:        Jos van Egmond <>
;
; Script Function:
;   Example, with function, of Change.
;   Use this as If Change("hello") Then MsgBox(0,"Alert", "$hello has changed");
; ----------------------------------------------------------------------------

$i = 0

While 1
    $i += random(0,1,1)
    If Change("i") Then;variable name in string without $
        MsgBox(0, "Alert", "$i has changed $i = "&$i)
    Else
        MsgBox(0, "Alert", "$i has NOT! changed $i = "&$i)
    EndIf
WEnd

Func Change($var)
    If IsDeclared($var&"_variable_copy") Then
        If Eval($var) == Eval($var&"_variable_copy") Then
            Assign($var&"_variable_copy",Eval($var),0)
            Return 0
        Else
            Assign($var&"_variable_copy",Eval($var),0)
            Return 1
        EndIf
    Else
        Assign($var&"_variable_copy",Eval($var),2)
        Return 0
    EndIf
EndFunc
Edited by jvanegmond

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...