Sign in to follow this  
Followers 0
arcker

Retrieve output information of a script

8 posts in this topic

i would like to be able to stdout a script

i've sought in the help without results

i want to be able to send information to $result when

$result=(;run autoitscript)

i've tried with return in the script, but when return is called, the script is stopped

any ideas ?

thx


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites



i would like to be able to stdout a script

i've sought in the help without results

i want to be able to send information to $result when

$result=(;run autoitscript)

i've tried with return in the script, but when return is called, the script is stopped

any ideas ?

thx

Are You looking for an Exit Code?

If so look in the Help for Exit in Keywords

That will still stop the script


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

yes but i need to get some information about the exit code


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites

yes but i need to get some information about the exit code

would help if you gave an example of the script your attempting

for example:

$ExitCode = RunWait(@SystemDir & "\winver.exe")
MsgBox(0,"Exit Code", $ExitCode)

Now in the RunWait, could be a script that you have compiled and may have different exit codes depending on what happens.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

ok, i want to launch another script the ping the machine until no error

when no error, i want to have the exit code of the exit, to set on the main script that the server i good now

$message=run(;autoitexe scriptping.au3 /$server)

when $message = 0 then guictrlsetdata($genreralstatus,"good")


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

ok, i want to launch another script the ping the machine until no error

when no error, i want to have the exit code of the exit, to set on the main script that the server i good now

$message=run(;autoitexe scriptping.au3 /$server)

when $message = 0 then guictrlsetdata($genreralstatus,"good")

i suspect your going to need either a runwait or put the other script in the main script in a while statement

i.e. examples

$var = Ping("www.AutoItScript.com",250)
While @error
    $var = Ping("www.AutoItScript.com",250)
WEnd
MsgBox(0,"Ping", "It's there")

$var = Ping("gafrostnoping.com",250)
While @error
    MsgBox(0,"Ping", "It's not there")
    $var = Ping("gafrostnoping.com",250)
WEnd
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

euh no sorry, i've already done this, alot

what i want, in my main script, is to ping several servers (no problem here)

when there is an error on one server, this launch another script to test continuisly the server with problem, but don't stop the main script

but the main script muste know when the test is finished, so the script


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Can you adapt this, it pings 20 machines at once and the main script just waits, I know it's not exactly what you want to do but you could adapt the principle.

#include <array.au3>
AdlibEnable("Adlib", 1000)

Dim $Foo[21], $aResult
Global $Return

For $a = 1 to 20
$NewTempFile = @sec & Int (Random () * 1000000)  & ".Au3"
$IP = '"100.100.100.' & $a & '"'
FileWriteLine ($NewTempFile,'$Result = Ping ('& $IP & ')')
FileWriteLine ($NewTempFile,'ConsoleWrite (' & $IP & '"|" & $Result  )')
FileWriteLine ($NewTempFile,'Sleep (5000)')
$Foo[$a] = Run(@AutoItExe & ' /AutoIt3ExecuteScript ' & $NewTempFile,@scriptdir,  @SW_show, 7)
Sleep (50)
Next

While 1

    $Complete = StringSplit ($Return, "-")
    If Ubound ($Complete)  > 20 then exitloop _ArrayDisplay ($Complete,"Title")
    Sleep (1000)
    Wend

Func Adlib ()
    For $i = 1 to Ubound ($Foo) - 1 
        If @error then exitloop
    $line = StdoutRead($foo[$i],"",true)
    If $Line <> 0 then 
        $line = StdoutRead($foo[$i])
        $Return = $Return  & $Line & "-"
EndIf
Next
EndFunc
Edited by ChrisL

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