Fletch Posted November 25, 2004 Share Posted November 25, 2004 Hey guys been searching the forum, net and the help file for ages but have no found an answer. Can I make a call to the windows api and if so how? Basically i need to call Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long) So my code will exit with an 'exit code'. The purpose of this is I have been asked to launch my code (Autoit script) from LotusScript, so im using a Shell command to launch it, but i need to pass a return value back that lotus can retrieve. Many thanks Link to comment Share on other sites More sharing options...
Mr.Wizard Posted November 25, 2004 Share Posted November 25, 2004 You will need to use the latest alpha (called "unstable") version of AutoIt from here and then look up DllCall in the help file supplied with that version I have a catapult. Give me all the money or I will fling an enormous rock at your head. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 25, 2004 Developers Share Posted November 25, 2004 (edited) So my code will exit with an 'exit code'. <{POST_SNAPBACK}>whats wrong with using the returncode after Exit ? e.g.Exit 1 Edited November 25, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Fletch Posted November 25, 2004 Author Share Posted November 25, 2004 (edited) Can't get Lotus to retrieve the value that way. Any ideas? (Im using Shell in LotusScript to call the autoit exe Edited November 25, 2004 by Fletch Link to comment Share on other sites More sharing options...
Developers Jos Posted November 25, 2004 Developers Share Posted November 25, 2004 Can't get Lotus to retrieve the value that way. Any ideas? (Im using Shell in LotusScript to call the autoit exe<{POST_SNAPBACK}>isn't Shell in LotusScript the same as Run in Autoit? Think it doesn't wait till the shelled program is finished. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Fletch Posted November 25, 2004 Author Share Posted November 25, 2004 I can make it wait using Yield Link to comment Share on other sites More sharing options...
Developers Jos Posted November 25, 2004 Developers Share Posted November 25, 2004 I can make it wait using Yield<{POST_SNAPBACK}>yes, but how do you retrieve the exit code from the program you run with shell within Lotusscript ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Fletch Posted November 25, 2004 Author Share Posted November 25, 2004 That is precisely my problem Link to comment Share on other sites More sharing options...
Developers Jos Posted November 25, 2004 Developers Share Posted November 25, 2004 That is precisely my problem<{POST_SNAPBACK}>Then i guess i don't know what you wanted to do with the ExitProcess call in Autoit.You have to find a solution in Lotusscript. An idea could be that AutoIt writes the returncode to a file or INI file and you read that in LotusScript. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Henrik Posted November 26, 2004 Share Posted November 26, 2004 Can the return code set by AutoIt Exit() be retrieved from another program or from the command prompt? How? Ignorance is strength. Link to comment Share on other sites More sharing options...
SlimShady Posted November 26, 2004 Share Posted November 26, 2004 You can use a batch file. Here's a working example: A script that exits and returns an exit code: ToolTip(" ", @DesktopWidth - 50, @DesktopHeight - 50) Exit 2 A batch file that runs the script and stores the exit code in a file: @ECHO OFF "%userprofile%\Desktop\Test.exe" SET EXITCODE=%errorlevel% ECHO Exit code is: %EXITCODE% ::Write the exit code to a file ECHO %EXITCODE% > %TEMP%\ExitCode.tmp NOTEPAD %TEMP%\ExitCode.tmp PAUSE Link to comment Share on other sites More sharing options...
Fletch Posted November 26, 2004 Author Share Posted November 26, 2004 Then i guess i don't know what you wanted to do with the ExitProcess call in Autoit.You have to find a solution in Lotusscript. An idea could be that AutoIt writes the returncode to a file or INI file and you read that in LotusScript.Well I can use another API call in lotus to 'pick up the code'I was also thinking a file or ini could do it thanks. Link to comment Share on other sites More sharing options...
Henrik Posted November 26, 2004 Share Posted November 26, 2004 Can the return code set by AutoIt Exit() be retrieved from another program or from the command prompt? How?<{POST_SNAPBACK}>Found an answer myself, posting links in case anyone else might need this.The necessary Win32 API calls & how to use them can be found in these articles:129797 and 129796. Ignorance is strength. 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