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.