Author Topic: Improving Code::Blocks' Terminal to Launch Code (mac)  (Read 10590 times)

Offline Zaubertrank

  • Single posting newcomer
  • *
  • Posts: 7
Improving Code::Blocks' Terminal to Launch Code (mac)
« on: January 25, 2012, 05:04:18 am »
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
« Last Edit: January 25, 2012, 05:06:35 am by Zaubertrank »

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Improving Code::Blocks' Terminal to Launch Code (mac)
« Reply #1 on: January 25, 2012, 05:46:15 am »
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.

Offline Halan

  • Multiple posting newcomer
  • *
  • Posts: 43
Re: Improving Code::Blocks' Terminal to Launch Code (mac)
« Reply #2 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..

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Improving Code::Blocks' Terminal to Launch Code (mac)
« Reply #3 on: February 10, 2012, 03:28:52 pm »
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>.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7256
Re: Improving Code::Blocks' Terminal to Launch Code (mac)
« Reply #4 on: February 10, 2012, 06:10:43 pm »
Can't this be implented by default? I've got a similiar problem when using the GNOME Terminal on Linux instead of xterm..
Gnome-terminal works fine with:
Code
gnome-terminal --disable-factory --hide-menubar -t $TITLE -x