Okay, so finally I solved this !
Steps :
Open Script Editor
app.
Create new Script and paste this code :
on run argv
tell application "Terminal" to activate
tell application "Terminal" to do script "cd ~" in selected tab of the front window
tell application "Terminal" to do script "cd " & item 2 of argv in selected tab of the front window
tell application "Terminal" to do script "clear" in selected tab of the front window
tell application "Terminal" to do script "bash " & item 1 of argv in selected tab of the front window
end run
save this file inside the folder in which you are coding/ or provide path while executing.
This will look like this :
I saved it in /Users/aayush/Downloads
folder as automated_run
.
This script editor app will save this script as automated_run.scpt
.
Now open CodeRunner App
.
Select Run Settings...
,
Now Copy the command written in Run Command
field before the $filename
.
[For example, If I am coding in shell scripting then I will copy the bash
from the command bash $filename
; for python, I will copy python3
from python3 $filename
]
Then open the script editor and see the line number 6
and paste your command in place of "bash "
. Here I am coding in shell scripting so that as per my requirement, I used 'bash ' here.
Then in CodeRunner
, Paste this code in place of run command
in Run Setting...
:
osascript automated_run.scpt $filename $PWD
It will look like this now :
Now you have two options : you can make this run command as default or you can use this as temporary. That is your choice.
now close this window.
and run any sample program to check this functionality which we just implemented.
Let's run sample program :
I made a sample file named helloaayush.sh
and stored that in /Users/aayush/Downloads

Now after pressing the Run
button :
A new terminal window will open and your code output will be visible there.

Let me know if something is unclear :)