ShawnLuo Posted September 1, 2010 Share Posted September 1, 2010 Hi, all, AutoIt can compile au3 file to *.exe. My question is if the *.exe file can return a value? and if can, how to get the return value? I found someone says use @exitcode, but I still don't know how it works. that will be very nice if you can give me a example. thank you so much! Link to comment Share on other sites More sharing options...
czardas Posted September 1, 2010 Share Posted September 1, 2010 I don't understand this. What do you mean by a return value? operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
wakillon Posted September 1, 2010 Share Posted September 1, 2010 (edited) Hi, all, AutoIt can compile au3 file to *.exe. My question is if the *.exe file can return a value? and if can, how to get the return value?I found someone says use @exitcode, but I still don't know how it works. that will be very nice if you can give me a example.thank you so much! A return value exe to exe ?At the end of first exe, it run second exe with parameters, that second exe can get by $cmdlines Edited September 1, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
UEZ Posted September 1, 2010 Share Posted September 1, 2010 Here a small example: #AutoIt3Wrapper_OutFile=Test.exe #AutoIt3Wrapper_Change2CUI=y $msg = MsgBox(4, "Return Code", "Give Exit Code true back?") If $msg = 6 Then Exit(1) Else Exit(0) EndIf Here the cmd code: @echo off test.exe echo %errorlevel% Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
czardas Posted September 1, 2010 Share Posted September 1, 2010 Gee I have a lot to learn. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
ShawnLuo Posted September 2, 2010 Author Share Posted September 2, 2010 Here a small example: #AutoIt3Wrapper_OutFile=Test.exe #AutoIt3Wrapper_Change2CUI=y $msg = MsgBox(4, "Return Code", "Give Exit Code true back?") If $msg = 6 Then Exit(1) Else Exit(0) EndIf Here the cmd code: @echo off test.exe echo %errorlevel% Br, UEZ Thanks a lot, your return value can see it cmd window, but how can I get it(the return value) in my autoit script? Link to comment Share on other sites More sharing options...
UEZ Posted September 2, 2010 Share Posted September 2, 2010 I cannot follow you! Your script produces the exit code and you want to pipe it back to your script? That makes not sense!But you can use $cmdline variable to use parameter for your exe -> see Command Line Parameters in help file.Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
trancexx Posted September 2, 2010 Share Posted September 2, 2010 GetExitCodeProcess of course.I'm sure there are lots of examples around. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
wakillon Posted September 2, 2010 Share Posted September 2, 2010 Thanks a lot, your return value can see it cmd window, but how can I get it(the return value) in my autoit script? Like this... ; The first exe Run ( @ScriptDir & '\Second.exe ' & $_Parameterl & ' ' & $_Parameter2 ) ; The second exe If @Compiled Then If $CmdLine[0] < 2 Then Exit $_Parameterl= $CmdLine[1] $_Parameter2= $CmdLine[2] EndIf AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
bo8ster Posted September 2, 2010 Share Posted September 2, 2010 Simply only the caller can see the exit code of the your script because no code is run after the exit command. You can have an AutoIt script call another then look at the exit code if you really must. If you are attempting to do error handling there are other ways of doing this. Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now