Sign in to follow this  
Followers 0
SystemWontAccept

Variable for 'run command' changes to number

4 posts in this topic

#1 ·  Posted (edited)

Don't ask what I'm trying to do, because this isn't it. I've just simplified the code so you can replicate the results.

#include <Constants.au3>
Local $Test = Run (@ComSpec & " /c dir, @ScriptDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
MsgBox(0, 'WTF', $Test)

I thought the MsgBox would display the same contents I put in the variable but it doesn't. It displays just a number, that changes every run. 6180, 7316, 6604, etc. What's going on?

Ed

Edited by SystemWontAccept

Share this post


Link to post
Share on other sites



#2 ·  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

$Test will contain the process ID of the process called by Run.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Don't ask what I'm trying to do, because this isn't it. I've just simplified the code so you can replicate the results.

#include <Constants.au3>
Local $Test = Run (@ComSpec & " /c dir, @ScriptDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
MsgBox(0, 'WTF', $Test)

I thought the MsgBox would display the same contents I put in the variable but it doesn't. It displays just a number, that changes every run. 6180, 7316, 6604, etc. What's going on?

Ed

Congratulations on not making any sense at all.

The msgbox display exactly what the variable has, a PID (assuming you fix that obvious error).

You see, when you do this:

$SomeVariable = SomeFunction()

You save the return-value from that func! And what does the helpfile say Run() returns? The PID for the app runned, which happen to be a number.

So the msgbox DO display the content of the variable.

If this is not what you want to do, then you need to explain it to us. You may be a mind-reader, but we are certainly not :D

Edited by AdmiralAlkex

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