Yokemate of Keyboards
Posts: 2076 from 2003/2/24
From: po-RNO
Are you doing something in Hollywood?
If you are, then you can do these things without using any external commands/programs:
Code:
Function p_CheckProgram(exe$, port$)
Local result = False
If RunRexxScript("RETURN SHOW('P','" .. port$ .. "')", True) = "0"
; Launch the program if its port wasn't found.
Run(exe$)
; Own WaitForPort implementation, you could also do Execute("WaitForPort", port$) instead.
For Local i = 1 To 10
If RunRexxScript("RETURN SHOW('P','" .. port$ .. "')", True) = "1"
result = True
Break
EndIf
Wait(50)
Next
Else
; Port was found.
result = True
EndIf
Return(result)
EndFunction
If p_CheckProgram("SYS:Applications/FlowStudio/FlowStudio", "FLOWSTUDIO.1")
RunRexxScript("ADDRESS FLOWSTUDIO.1;'OPEN FILE sys:MorphOS.readme LINE 10'", True)
Else
DebugPrint("Couldn't launch the program.")
EndIf