Jump to content

How to return value from autoit compiled script?


MadBoy
 Share

Recommended Posts

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)

Link to comment
Share on other sites

  • Moderators

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.

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

  • Recently Browsing   0 members

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