Page 1 of 1

TextMate + Shell from IDE!

Posted: Sat Sep 28, 2024 5:20 pm
by Piero
This can also be useful to "quickly setup" shell stuff from IDE (but you can only use 'single quotes' on IDE tool settings…)

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!!!
 

Update

Posted: Mon Sep 30, 2024 5:18 pm
by Piero
The ALPHA bundle is getting better…
You can now download the newer version (always on link above)

Video
 
 

Mostly Done!

Posted: Fri Oct 04, 2024 2:39 am
by Piero
I don't need scopes etc. (at least for now…)

Also added help stuff for TextMate…


Enjoy!

Forum Command :)

Posted: Fri Oct 04, 2024 7:30 am
by Piero
Squashed the "bug" that was sometimes slowing down TM osascripts
Also added:

Code: Select all

"Wrap for Forum"
to get bbcoded selection on clipboard (needs gecho)

Small fix

Posted: Sat Oct 05, 2024 10:31 am
by Piero
Small (but I think useful) fix to "Check & Goto 1st Error"
You can fix it yourself duplicating a line without redownloading the bundle:

Code: Select all

-- 2 times to always get tooltip on the right spot:
tell application "TextMate" to get url "txmt://open?line=" & third word of a & "&column=1"
tell application "TextMate" to get url "txmt://open?line=" & third word of a & "&column=1"

Well…

Posted: Sun Oct 06, 2024 9:34 am
by Piero
I think I'm done with this bundle (as an example that you can "expand")

Added a PB Light color theme, similar to PB default; on readme there's a link to easily modify themes or create new ones (also see System Color Picker)
Refined the shell stuff that was in "bug testing stage"
Added "Create link for Forum" (I did it using LaunchBar before, but this is a bit better)

Don't forget to "install" the PB IDE tool, and to see how to setup the fuzzy autocomplete (I have the support text file in "~/bin"; that's a "bin" folder in my home folder)… I also made "two" fuzzy autocomplete for the PB IDE (one is to "search" all open documents…)

Suggestions, Bug Reports and Questions Welcome (but before: this bundle is already full of help stuff) ;)

Special thanks to HeX0R; you made me drink a lot of beer! (see the smart indent source code for USEFUL infos and options)

Explore and… HAVE FUN!
Piero

Re: Well…

Posted: Sun Oct 06, 2024 7:32 pm
by HeX0R
Piero wrote: Sun Oct 06, 2024 9:34 amSpecial thanks to HeX0R; you made me drink a lot of beer! (see the smart indent source code for USEFUL infos and options)
:twisted:

Re: Well…

Posted: Sun Oct 06, 2024 8:00 pm
by Piero
HeX0R wrote: Sun Oct 06, 2024 7:32 pm:twisted:
1st of all, Thank You!
I tried to make Smart Indent work with selection (not the entire source code) and also to make the dialogs "modal/frontmost" (it was a problem if they stayed on background…) but didn't waste too much time (I had to improve the bundle); I coded the indentation, but it has a (very small) problem with "select-case", and I'm not the only one that got into this……

Resuming: Thanks for the beers! ;)