Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Improving Code::Blocks' Terminal to Launch Code (mac)
(1/1)
Zaubertrank:
I've written a short applescript that stops code::blocks from opening multiple terminals every time you want to run some code in a terminal, but I can't figure out how to use osascript (or whatever else) to convert it into a single line which can be used by code::blocks in its environment settings. Can someone help me out here? Here is the script:
if application "Terminal" is not running then
tell application "Terminal"
activate
do script "$SCRIPT" in front window
end tell
else
tell application "Terminal"
do script "$SCRIPT"
activate
end tell
end if
Alpha:
I have not scripted on a Mac before, so I cannot give specifics. However, I see several solutions.
Change $SCRIPT to a variable that results in the first argument passed to your script (called as an executable). Then bind a command consisting of the name of your script and the variable $SCRIPT to either a tool or the run key. (I am assuming the variable $SCRIPT is a Code::Blocks variable which resolves to the name of the code you are trying to run.)
A more drastic option would be to download Code::Blocks' trunk code, and create a patch to add this functionality from within.
Halan:
Can't this be implented by default? I've got a similiar problem when using the GNOME Terminal on Linux instead of xterm..
oBFusCATed:
Halan:
Test case? What is the exact problem?
If you want to launch a new tab inside already running instance of gnome-terminal,
this is not going to work from the usability stand point.
Zaubertrank: You can put your script in a file and then tell C::B to execute it. I don't know the exact details, but I guess it should "just work" <evil>.
Jenna:
--- Quote from: Halan on February 10, 2012, 03:22:28 pm ---Can't this be implented by default? I've got a similiar problem when using the GNOME Terminal on Linux instead of xterm..
--- End quote ---
Gnome-terminal works fine with:
--- Code: ---gnome-terminal --disable-factory --hide-menubar -t $TITLE -x
--- End code ---
Navigation
[0] Message Index
Go to full version