Sign in to follow this  
Followers 0
MadBoy

How to return value from autoit compiled script?

3 posts in this topic

Hello,

Is there a way to return code from AutoIt compiled script the same way like functions do? I know that "Return" can be used only within functions, but i do need to return diffrent code then 0 (that is always returned for autoit scripts). Options like putting stuff into registry/creating files somewhere etc aren't solution for me and i know about them. This package is to be used in Altiris and it reads the return code and that's what my company expects from this package.

With regards,

MadBoy


My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hello,

Is there a way to return code from AutoIt compiled script the same way like functions do? I know that "Return" can be used only within functions, but i do need to return diffrent code then 0 (that is always returned for autoit scripts). Options like putting stuff into registry/creating files somewhere etc aren't solution for me and i know about them. This package is to be used in Altiris and it reads the return code and that's what my company expects from this package.

With regards,

MadBoy

You can get the exit code from the app from a dllcall() (from another app) if you don't want to write the exit code anywhere.

You could use OnAutoItExit() + ConsoleWrite() and have the external app catch the stdout.

Exit 4
Func OnAutoItExit()
    Switch @exitCode
        Case 0
            MsgBox(64, "Info", "Normal Exit")
        Case 4
            MsgBox(64, "Info", "Exit type 4")
        Case Else
            MsgBox(64, "Info", "Whatever")
    EndSwitch
EndFunc
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Exit 4

This alone will do just fine Smoke_N :) Wasn't aware that Exit can take values :) Testing it right now.


My little company: Evotec (PL version: Evotec)

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