Just starting out? Need help? Post your questions and find answers here.
rndrei
Enthusiast
Posts: 182 Joined: Thu Dec 28, 2023 9:04 pm
Post
by rndrei » Wed Apr 02, 2025 3:40 pm
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
NicTheQuick
Addict
Posts: 1527 Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:
Post
by NicTheQuick » Wed Apr 02, 2025 3:55 pm
What program did you start with it? Maybe it has terminated itself already.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Mindphazer
Enthusiast
Posts: 487 Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie
Post
by Mindphazer » Wed Apr 02, 2025 4:49 pm
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
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
Axolotl
Addict
Posts: 872 Joined: Wed Dec 31, 2008 3:36 pm
Post
by Axolotl » Wed Apr 02, 2025 4:50 pm
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.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home . Now started with Linux (VM: Ubuntu 22.04 ).
BarryG
Addict
Posts: 4219 Joined: Thu Apr 18, 2019 8:17 am
Post
by BarryG » Wed Apr 02, 2025 10:05 pm
rndrei wrote: Wed Apr 02, 2025 3:40 pm ERROR: The program is no longer running
Maybe you need the #PB_Program_Wait flag for RunProgram(), because you didn't include it.
AZJIO
Addict
Posts: 2223 Joined: Sun May 14, 2017 1:48 am
Post
by AZJIO » Thu Apr 03, 2025 5:05 am
rndrei wrote: Wed Apr 02, 2025 3:40 pm
The first parameter must be a executable file. There should not be "+file".
Axolotl
Addict
Posts: 872 Joined: Wed Dec 31, 2008 3:36 pm
Post
by Axolotl » Thu Apr 03, 2025 3:45 pm
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?
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home . Now started with Linux (VM: Ubuntu 22.04 ).
rndrei
Enthusiast
Posts: 182 Joined: Thu Dec 28, 2023 9:04 pm
Post
by rndrei » Sat Apr 05, 2025 2:39 pm
I figured it out! Lay out all the code, it is very large.The error was in Closeprogram ()