ProgramRunning()

Mac OSX specific forum
User avatar
J. Baker
Addict
Addict
Posts: 2196
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

ProgramRunning()

Post by J. Baker »

It appears that ProgramRunning() quits returning a positive value, even if the app is still running.

Code: Select all

Preview = RunProgram("open", "-a Preview", "", #PB_Program_Open)

 If Preview
  
   While ProgramRunning(Preview) > 0
    
    Debug ProgramRunning(Preview)
    
    Delay(1)
    
   Wend
  
    Debug "No longer running"
   
 EndIf
  
End
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Fred
Administrator
Administrator
Posts: 18499
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: ProgramRunning()

Post by Fred »

It seems to work OK here. 'open' quits as soon than the other program is launched, so it's not running anymore PB wise. Or do I miss something ? Can anyone confirm ?
User avatar
J. Baker
Addict
Addict
Posts: 2196
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: ProgramRunning()

Post by J. Baker »

Fred wrote:It seems to work OK here. 'open' quits as soon than the other program is launched, so it's not running anymore PB wise. Or do I miss something ? Can anyone confirm ?
I thought that ProgramRunning() would keep checking to see if it's running until the app is no longer running. If "open" quits shortly after like you said, is there a reason why it does?

Also, can anyone else confirm?
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Fred
Administrator
Administrator
Posts: 18499
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: ProgramRunning()

Post by Fred »

Just open a Terminal and see the behaviour. 'open' just spawn a new process and gives back the prompt. There is a flag to wait until the app ends: -W

Code: Select all

Preview = RunProgram("open", "-W -a Preview", "", #PB_Program_Open)
User avatar
J. Baker
Addict
Addict
Posts: 2196
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: ProgramRunning()

Post by J. Baker »

Thanks Fred, I'll try it out. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Post Reply