Jump to content

Help With Data Returned From Other Programs


Recommended Posts

I have a question. Trying to use SAPVAR in association with AutoIt. SAPVAR is basically a 20k program that determines what version of SAP you have, what patch level, etc. Running SAPVAR w/o command switches runs it in the GUI form, using certain switches causes it to be run via command line, and returning the appropriate answer via a variable %ERRORLEVEL%. I tried calling it like

$temp = Run( "\\server\sapver\sapver.exe /gui /release")
MsgBox( 0, "title", $temp)

Which should return a 4 digit number. When I try running it, I get a different 4 digit number each time. Which is wrong because the version of SAP hasn't changed. Is this the correct way to get data returned from another program? Or does AutoIt not work like this? Any help is appreciated. Thanks

Edited by hcstarck
Link to comment
Share on other sites

I have a question. Trying to use SAPVAR in association with AutoIt. SAPVAR is basically a 20k program that determines what version of SAP you have, what patch level, etc. Running SAPVAR w/o command switches runs it in the GUI form, using certain switches causes it to be run via command line, and returning the appropriate answer via a variable %ERRORLEVEL%. I tried calling it like

$temp = Run( "\\server\sapver\sapver.exe /gui /release")
MsgBox( 0, "title", $temp)

Which should return a 4 digit number. When I try running it, I get a different 4 digit number each time. Which is wrong because the version of SAP hasn't changed. Is this the correct way to get data returned from another program? Or does AutoIt not work like this? Any help is appreciated. Thanks

Well, I figured out what the 4 digit number getting returned is. Per the help file, its the pid. The help file doesn't seem to indicate anyway to get values returned by a program. Can anyone shed some light on this? Thanks
Link to comment
Share on other sites

Lookup StdoutRead in the help file, it may help.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

where is the 4 digit number displayed? in the command line or in a new window?

The 4 digit number that I was getting (that I now know is the pid was displayed the msgbox. The 4 digit number returned by the SAPVER isn't actually displayed anywhere. It is supposed to be returned and exist only in the %ERRORLEVEL% variable.

BigDod, I tried looking up StdoutRead in my help file, wasn't found. Probally means I have an older version. I'll look into that more on the site. Thanks for the pointer, hopefully it leads somewhere.

Link to comment
Share on other sites

  • Moderators

Most of the functions that we use are all in the released version, they are in the Beta:

http://www.autoitscript.com/forum/index.ph...opic=19717&st=0

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

Most of the functions that we use are all in the released version, they are in the Beta:

http://www.autoitscript.com/forum/index.ph...opic=19717&st=0

Thanks. I guessed that, but didn't have time to dig up the beta yesterday. My code currently looks like

#include <constants.au3>

$foo = Run( "\\server\sapver\sapver.exe /gui /compilation", @SystemDir, @SW_HIDE, 

$STDERR_CHILD + $STDOUT_CHILD)

While 1
    $line = StdoutRead($foo)
    If @error = -1 Then ExitLoop
    MsgBox(0, "STDOUT read:", $line)
Wend

While 1
    $line = StderrRead($foo)
    If @error = -1 Then ExitLoop
    MsgBox(0, "STDERR read:", $line)
Wend

MsgBox(0, "Debug", "Exiting...")

And nothing gets returned. I get the Exiting window, and thats all.

This is an example of code to run the sapver that does work in a bat file

set share=\\server\sapver\
set flatfile=fileservertoolsGUIversion.txt

%share%sapver /gui /release
set guirel=%errorlevel%

%share%sapver /gui /compilation
set guicomp=%errorlevel%

%share%sapver /gui /patchlevel
set guipatch=%errorlevel%

echo %computername%,%guirel% %guicomp% %guipatch% >>%flatfile%

So the stdoutread doesn't seem to support what I need it to do. I can run it via the bat file, and I should then be able to parse the outputed text file, but would just like confirmation of that being my only real option.

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