Hi all! So I'm trying to send a command to JSDocs via hidden command prompt then receive data back in program.
Any help as always is GREATLY appreciated!
Thank You! <3
Send command & receive data from JSDocs?
Send command & receive data from JSDocs?
Last edited by Mythros on Tue Jun 02, 2020 4:27 pm, edited 1 time in total.
Re: Send command & receive data from JSDocs?
Here is what I have so far thanks to Kiffi & a few others :
Code: Select all
EnableExplicit
Define TempJsFilename.s = "temp.js"
CreateFile(0, TempJsFilename)
WriteStringN(0, "a")
CloseFile(0)
Define Dummy.s
Define RPE.s ; ReadProgramError
Define RPS.s ; ReadProgramString
Define Exitcode
Define NodeJs = RunProgram ( "cmd.exe", "/c node " + Chr(34) + TempJsFilename + Chr(34), "", #PB_Program_Open | #PB_Program_Read | #PB_Program_Error | #PB_Program_Hide)
If NodeJs
While ProgramRunning(NodeJs)
Dummy = ReadProgramError(NodeJs)
If Dummy
RPE + Dummy + #CRLF$
EndIf
Dummy = ReadProgramString(NodeJs)
If Dummy
RPS + Dummy + #CRLF$
EndIf
Wend
Exitcode = ProgramExitCode(NodeJs)
CloseProgram(NodeJs) ; Close the connection to the program
EndIf
Define Output.s
If RPS <> ""
Output + "ReadProgramString: " + #CRLF$ + RPS + #CRLF$
EndIf
If RPE <> ""
Output + "ReadProgramError: " + #CRLF$ + RPE + #CRLF$
EndIf
If Exitcode <> 0
Output + "ExitCode: " + Exitcode + #CRLF$
EndIf
MessageRequester("", Output)
DeleteFile(TempJsFilename)
Last edited by Mythros on Tue Jun 02, 2020 4:26 pm, edited 1 time in total.