Sign in to follow this  
Followers 0
hcstarck

Help With Data Returned From Other Programs

7 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Lookup StdoutRead in the help file, it may help.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

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


_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post


Link to post
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.

Share this post


Link to post
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


[center]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.[/center]

Share this post


Link to post
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.

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