Page 1 of 1

ProgramRunning

Posted: Wed Apr 02, 2025 3:40 pm
by rndrei
Gives an error: ERROR: The program is no longer running

Code: Select all

    prog_run=RunProgram(f_path+file,"","" #PB_Program_Open | #PB_Program_Read | #PB_Program_Write | #PB_Program_Error | #PB_Program_Hide)
        While ProgramRunning(prog_run)         
          If AvailableProgramOutput(prog_run)
            Output_run=ReadProgramString(prog_run)
            PrintN(Output_run)
            if key_enter=#True
              WriteProgramStringN(prog_run, GetGadgetText(#String_run))                
            endif
          EndIf
       Wend

Re: ProgramRunning

Posted: Wed Apr 02, 2025 3:55 pm
by NicTheQuick
What program did you start with it? Maybe it has terminated itself already.

Re: ProgramRunning

Posted: Wed Apr 02, 2025 4:49 pm
by Mindphazer
You should check if your RunProgram() is valid :

Code: Select all

prog_run=RunProgram(f_path+file,"","" #PB_Program_Open | #PB_Program_Read | #PB_Program_Write | #PB_Program_Error | #PB_Program_Hide)
If prog_run
  While ProgramRunning(prog_run)         
    If AvailableProgramOutput(prog_run)
      Output_run=ReadProgramString(prog_run)
      PrintN(Output_run)
      If key_enter=#True
        WriteProgramStringN(prog_run, GetGadgetText(#String_run))                
      EndIf
    EndIf
  Wend
EndIf

Re: ProgramRunning

Posted: Wed Apr 02, 2025 4:50 pm
by Axolotl
First, there is an error in the RunProgram() parameter list, because after the last "" the comma is missing.
Secondly, I feel that the WriteProgramString() function should not be included in the block if AvailableProgramOutput() .... .
BTW: Without a running code, it is hard to help.

Re: ProgramRunning

Posted: Wed Apr 02, 2025 10:05 pm
by BarryG
rndrei wrote: Wed Apr 02, 2025 3:40 pmERROR: The program is no longer running
Maybe you need the #PB_Program_Wait flag for RunProgram(), because you didn't include it.

Re: ProgramRunning

Posted: Thu Apr 03, 2025 5:05 am
by AZJIO
rndrei wrote: Wed Apr 02, 2025 3:40 pm

Code: Select all

RunProgram(f_path+file
The first parameter must be a executable file. There should not be "+file".

Re: ProgramRunning

Posted: Thu Apr 03, 2025 3:45 pm
by Axolotl
As I already wrote, the code is unfortunately not complete....
So we can only assume things. Maybe it is like this

Code: Select all

Global f_path.s ; = <valid path to executables> 
Global file.s   ; = <valid name of an executable> 
Maybe it isn't?

Re: ProgramRunning

Posted: Sat Apr 05, 2025 2:39 pm
by rndrei
I figured it out! Lay out all the code, it is very large.The error was in Closeprogram ()