Sign in to follow this  
Followers 0
njscorpion

problem with OnAutoItExit function

5 posts in this topic

hi all,

i was trying to implement OnAutoItExit () function

the following is my script:

Opt("OnExitFunc","_beforeExiting")

sleep(5000)

Func _beforeExiting()
    Switch @exitMethod
        Case 0 ;Natural closing.
            MsgBox(0,"Exit Method",@exitMethod)
        Case 1 ;close by Exit function.
            MsgBox(0,"Exit Method",@exitMethod)
        Case 2 ;close by clicking on exit of the systray.
            MsgBox(0,"Exit Method",@exitMethod)
        Case 3 ;close by user logoff.
            MsgBox(0,"Exit Method",@exitMethod)
        Case 4 ;close by Windows shutdown.
            MsgBox(0,"Exit Method",@exitMethod)
        Case Else
            MsgBox(0,"Exit Method","Unknown")
    EndSwitch
EndFunc

when i use SciTe Editor for execution it works well, but when i right click and execute or compile it to exe and run it throws an exception

Right-click Execute:

Posted Image

EXE Error:

Posted Image

Am i doing something wrong?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Check the version of AutoIt that you are using. It is possible that SciTe uses the beta and when you run it is run as release.

thanks for ur reply.

after your reply i tried compiling the the exe using SciTe Editor and the out put worked but how do i fix it? also how do i check which version is actually used to compile the exe, in SciTe i am using "Ctrl+F7" for Beta build it requires "Alt+F7". how do i set system default version?

Edited by njscorpion

Share this post


Link to post
Share on other sites

In your start menu under AutoIt\Beta\ there is a shortcut called "Toggle AU3 beta". You can click that to switch from beta to release or the other way.

I suggest you just download the latest version of AutoIt anyway: The version you are using is from before v3.1.0 which was released on 7 February of 2005! To update AutoIt there is a nice tool called "Check For Updates" for updates, you can find it in your AutoIt folder...

Or maybe you don't have the tool, because you're using such an old version.. In that case download the newest version from the AutoIt website. : )

Share this post


Link to post
Share on other sites

...is from before v3.1.0 ...

i am actually using version 3.3.0.0

thanks a lot :D

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