Jump to content

Can i use an API call


Fletch
 Share

Recommended Posts

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

  • Developers

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

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

  • Developers

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

  • Developers

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

  • Developers

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

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

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

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

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...