Hello,
I tried to write few lines of code to understand the question
I don't see why Delay(4000) in your code.
You also need to prevent the console from closing.
Here is my test code
Code: Select all
EnableExplicit
Define console, winscp_handle, Event, string$
console=OpenConsole("Control WinSCP",#PB_Ascii)
#flags=#PB_Program_Open|#PB_Program_Read|#PB_Program_Write|#PB_Program_Ascii|#PB_Program_Hide
winscp_handle = RunProgram("winscp.com","","",#flags,console)
If console And winscp_handle
If OpenWindow(0,0,0,100,100,#Empty$,#PB_Window_Invisible)
PrintN("Winscp: help to displays help.")
PrintN(#Empty$)
WriteProgramStringN(winscp_handle,#Empty$,#PB_Ascii)
Repeat
Event=WaitWindowEvent(20)
string$=Input()
If string$<>#Empty$
Select string$
Case "exit" : Break
Default
WriteProgramStringN(winscp_handle,string$+#CRLF$,#PB_Ascii)
While AvailableProgramOutput(winscp_handle)
PrintN(ReadProgramString(winscp_handle,#PB_Ascii))
Wend
EndSelect
EndIf
ForEver
EndIf
CloseConsole()
EndIf
Help Remarks about
ReadProgramString(winscp_handle,#PB_Ascii)
However, the function remains blocked indefinitely if the program requests the intervention of the user. For example, return a yes / no choice to the program to continue.
Gérard
■ Win10 64-bit (Intel Celeron CPU N2920 @ 1.86GHz, 4,0GB RAM, Intel HD Graphics) & PB 6.00 LTS
■ Vivre et laisser vivre.
■ PureBasic pour le fun
■ cage sur le forum Français
■ Mes sites:
http://pbcage.free.fr -
http://yh.toolbox.free.fr