Jump to content

Dont work StdoutRead with Putty.exe


nill
 Share

Recommended Posts

Jos

 

Now its work thanks!

 

But I need perform several operation after login on server
But console window straight close after run

I need login on server read in console that login is ok and then run another operation

How its possyble ?

 

Link to comment
Share on other sites

  • Developers

That makes sense since your script will end when it has read the STDOUT.
Just start adding the logic to read STDOUT, then respond by sending information back to STDIN ...etc ..etc

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Open the HelpFile and look at the StdinWrite() function and its examples....  it is all there.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

$iPID = Run(@ComSpec & " /C " & $puty_exe & " -ssh -l " & $user & " " & $host & " -P " & $port & " -pw " & $password, @ScriptDir,@SW_MAXIMIZE,  $STDIN_CHILD)
Sleep(30000)
StdinWrite($iPID, "v-add-domain admin domen.com 1.1.2.2 [RESTART];" & @CRLF)

I read many examples and put $STDIN_CHILD in Run

Now I can add next operation after login

 

But I cant write output text to variable

I get text in SciTe but dont understand how

>"C:\Program Files\AutoIt3\SciTE\..\AutoIt3.exe" /ErrorStdOut "C:\test3.au3"    
Last login: Sun Aug  7 04:39:41 2016 from 37.194.206.65
]0;root@trimp:~[?1034h[root@trimp ~]# v-add-domain admin domen.com 1.1.2.2 [RESTART] ;
Error: Web domain domen.com exist
]0;root@trimp:~[root@trimp ~]# 
]0;root@trimp:~[root@trimp ~]# >Exit code: 0    Time: 30.27

Edited by nill
Link to comment
Share on other sites

  • Developers
2 hours ago, nill said:

But I cant write output text to variable

I get text in SciTe but dont understand how

You aren't showing all code, but you probably still have the ConsoleWrite statements in it that will do this.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Jos
Its all code, I have in top only the definition of variables $user, $host and etc
I dont have  ConsoleWrite in code
I noticed that I have text in SciTe only if I run cmd.exe

If I close cmd.exe, SciTe console dont have any text
in general, the question remains


How get text from plink.exe in variable ?
 


 

 

 

Link to comment
Share on other sites

  • Developers

Ah, ok, that means that SciTE is rreading the STDOUT and showing it.
Your initial scripts posted did retrieve the STDOUT and STDERR, so you should know how to retrieve that into a variable as that is already in there.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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

×
×
  • Create New...