Code: Select all
; PB IDE tool to edit current code with TextMate (needs /usr/local/bin/mate; see Prefs/Terminal)
; Arguments: /usr/local/bin/mate -wl%SELECTION '%TEMPFILE'
; Options: Wait until tool quits, Hide Editor, Reload (into current source) after tool has quit
Procedure simpleShell(ShellCommand$)
Protected shell = RunProgram("/bin/sh", "", "", #PB_Program_Open | #PB_Program_Write)
If shell
WriteProgramStringN(shell, ShellCommand$)
WriteProgramData(shell, #PB_Program_Eof, 0)
While ProgramRunning(shell) : Delay(10) : Wend
CloseProgram(shell)
EndIf
EndProcedure
j = CountProgramParameters() - 1
For i = 0 To j
a$ + ProgramParameter(i) + " "
Next i
If FindString(a$, "/usr/local/bin/mate -wl") = 1 ; format %SELECTION for mate
a$ = StringField(a$, 1, "x") + ":" + StringField(a$, 2, "x") + "-" + StringField(a$, 3, "x") + ":" + StringField(a$, 4, "x")
EndIf
simpleShell(a$)
simpleShell(~"osascript \n tell app \"purebasic\" to activate \n beep \n say \"done!\" ")
…and DON'T MISS THIS PB TextMate bundle!!!