Sign in to follow this  
Followers 0
Fletch

Can i use an API call

13 posts in this topic

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

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Can't get Lotus to retrieve the value that way. Any ideas? (Im using Shell in LotusScript to call the autoit exe

Edited by Fletch

Share this post


Link to post
Share on other sites

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.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I can make it wait using Yield

Share this post


Link to post
Share on other sites

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 ?

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

That is precisely my problem

Share this post


Link to post
Share on other sites

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.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Can the return code set by AutoIt Exit() be retrieved from another program or from the command prompt? How?


Ignorance is strength.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

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