Jump to content

Compiling script breaks it.


Recommended Posts

When I run my script without compiling it, it works just fine.

When I compile the script and run it this part of the script doesn't run properly. Here's my terrible explanation of what's supposed to happen but doesn't once its compiled.
I have part of the script call the Function _Update well once it calls _Update it runs ShellExecute("C:\Test\test\run\Email.au3") immediately and doesn't wait 5 minutes. 

$iMinutes = 5
$hTimer = TimerInit()

Func _Update()
    AdlibRegister(_Update, 2000)
    If TimerDiff($hTimer) > ($iMinutes * 60000) And ProcessExists($recheck) Then
        ;ConsoleWrite("5 minutes have passed!" & @CRLF)
        ShellExecute("C:\Test\test\run\Email.au3")
        AdlibUnRegister(_Update)
        $hTimer = TimerInit()
    ElseIf Not ProcessExists($recheck) Then
        AdlibUnRegister(_Update)
    EndIf
EndFunc

Anyone have any suggestions on what I can do to fix this?

Link to comment
Share on other sites

Okay, I just had to add Dim in front of a few variables.

Local $iMinutes = 5
Dim $hTimer = TimerInit()

Func _Update()
    AdlibRegister(_Update, 2000)
    If TimerDiff($hTimer) > ($iMinutes * 60000) And ProcessExists($recheck) Then
        ;ConsoleWrite("5 minutes have passed!" & @CRLF)
        ShellExecute("C:\Test\test\run\Email.au3")
        AdlibUnRegister(_Update)
        Dim $hTimer = TimerInit()
    ElseIf Not ProcessExists($recheck) Then
        AdlibUnRegister(_Update)
    EndIf
EndFunc

 

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

×
×
  • Create New...