retrieve the results of a program in a variable

Just starting out? Need help? Post your questions and find answers here.
NY152
User
User
Posts: 29
Joined: Sun May 14, 2006 12:33 am

retrieve the results of a program in a variable

Post by NY152 »

Hello,

For need a program, I need to run another program and retrieve its result in a variable. I do not know how. Anyone have an idea?

In advance, thank you
.:NY152:.
firace
Addict
Addict
Posts: 946
Joined: Wed Nov 09, 2011 8:58 am

Re: retrieve the results of a program in a variable

Post by firace »

Here's a simple example:

Code: Select all

PRG = RunProgram("cmd" , "/c echo %computername%" , "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Hide)

If PRG 
  While ProgramRunning(PRG)
    If AvailableProgramOutput(PRG)
      V$ = ReadProgramString(PRG)
      Debug V$ 
    EndIf
  Wend
  
  CloseProgram(PRG) 
EndIf
Hope this helps.
Post Reply