Trouble with RunProgram()
Posted: Thu Apr 29, 2010 11:56 pm
I'm having some trouble with the RunProgram command. I've searched and searched, but none of the solutions seem to work for me. I'm trying to open the Terminal and use the "cal" command to display a calendar inside a message box. It's pretty much the same as the example code in the help file under the RunProgram command. Here's what I have.
I've thought maybe the directory isn't right, but I've tried everything that I know. I even used the set directory command at the start of my code so it will be in the "/Applications" directory, but it doesn't work. Then I figured maybe it was just having trouble running the Terminal app, so I tried other applications. Nothing seems to work. The example code, which opens the pbcompiler, works perfectly though.
Displaying a calendar is just a test, my final code will actually execute a different command. I just can't figure out why it won't open the Terminal. Any help would be appreciated!
P.S. If there's a topic, or somewhere in the help file, that solves my problem, feel free to point me in that direction. I usually hate asking questions because I feel like the answer has been given multiple times before. In this case, I honestly couldn't find a solution that solved my problem.
Code: Select all
Terminal = RunProgram("/Applications/Utilities/Terminal.app", "cal", "", #PB_Program_Open|#PB_Program_Read)
Output$ = ""
If Terminal
While ProgramRunning(Terminal)
Output$ + ReadProgramString(Terminal) + Chr(13)
Wend
Output$ + Chr(13) + Chr(13)
Output$ + "Exitcode: " + Str(ProgramExitCode(Terminal))
EndIf
MessageRequester("Output", Output$)
Displaying a calendar is just a test, my final code will actually execute a different command. I just can't figure out why it won't open the Terminal. Any help would be appreciated!
P.S. If there's a topic, or somewhere in the help file, that solves my problem, feel free to point me in that direction. I usually hate asking questions because I feel like the answer has been given multiple times before. In this case, I honestly couldn't find a solution that solved my problem.