Sign in to follow this  
Followers 0
zpslon

How to return not only %errorlevel% to batch

16 posts in this topic

Need to return two variables from autoit script to batch file, but I found only how to return errorlevel with Exit($var). And errorlevel is only numeric :(, I have symbols in variables.

Is any method except Exit?

Share this post


Link to post
Share on other sites



Did you try EnvSet() to pass values to external variables in the shell environment? You could also pass data through a small text file, or via the registry.

:(


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Did you try EnvSet() to pass values to external variables in the shell environment? You could also pass data through a small text file, or via the registry.

:(

EnvSet()works only for programs launched from script

Through registry or file, don want to save variables as plain text anywhere, login and password :)))))

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

ConsoleWrite("test" & @crlf)
sleep(2000)
ConsoleWrite("test2" & @crlf)

Compile as CUI instead of GUI and run from cmd.exe... can't see why that info should not be available to the executing batch file.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

I think you misread the initial message. :(

Not really :), but... I'm not that into batch file programming... and always assumed that console output can easily be redirected to a variable for further use... might be wrong there :)...

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Changes to the shell environment of the calling batch file are lost when that shell closes. Tell me what you think is more secure about a return value than a local shell variable...?

:)

You want to know how to securely pass credentials to a batch file: Don't!

:)

Edit: The script inherits only a copy of the parent batch file's environment, so that was true but not helpful since the parent shell never sees the changes. Rats.

:(

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Burp. I guess there is.

Strike :) ... and... nice research, I love this sometimes really productive ping-pong game :( ... was watching "Edge of Darkness" in parallel :)... Edited by KaFu

Share this post


Link to post
Share on other sites

When I try to write to console like this, in batch I get not real login and password, but names of variables,

ConsoleWrite('$login $passwd' & @CRLF)

In batch output

D:\!!!!!!\Steam\Test>echo.var1=$login

var1=$login

D:\!!!!!!\Steam\Test>echo.var2=$passwd

var2=$passwd

If I try like this ConsoleWrite($login & @CRLF)

In batch output

D:\!!!!!!\Steam\Test>echo.var1=$login

var1=username

D:\!!!!!!\Steam\Test>echo.var2=$passwd

var2=

But it works only for one variable :(

How to make It work for two variables?

Share this post


Link to post
Share on other sites

It works!

Thank you! :(

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