question

brickkkkksss avatar image
0 Votes"
brickkkkksss asked brickkkkksss edited

setting shortcuts for running shell commands

hi!
i am trying to improve my workflow inside VS; right now it consists of launching the app, Ctrl+' to open the Terminal and every time i modify a file, Ctrl+S to save it, mouse click to get the Terminal window focus and ArrowUp+Return to execute this command: csound file.csd and in case i need to stop the performance i press Ctrl+Fn+F12 (my computer Ctrl+BREAK) as Ctrl+C does nothing

i tried to create an External Tool by setting the command as cmd.exe and the argument as csound file.csd but it just opens the Terminal without running the argument and i can not interact with it... i know i could use something like VScode but i started to learn Unity and i wish to stay with a single editor. do you have any guidance on how to set Alt+, as save the file and run on shell "csound $FILE_PATH" & Alt+. as "killall csound"?

vs-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

brickkkkksss avatar image
0 Votes"
brickkkkksss answered brickkkkksss edited

ok! i found a way,

  1. i installed VCmd Extension then i restarted Visual Studio to make it work

  2. cmd is the page that i used to run a command from the box arguments, which translates into me creating a new External Tool called startCsound with command as powershell.exe and arguments as /c csound $(ItemPath)

  3. and another one called stopCsound with the argument as /c taskkill /f /IM csound.exe

  4. setting the shortcuts under Tools > Options > Environment > Keyboard > Show commands containing: VCmd.Command1 and another shortcut for VCmd.Command2

  5. then i went to Extensions > VCmd > Commands and Add(ed) two commands with this script

204427-image.png
note that the second script should have Tools.ExternalCommand3 and not ...ExternalCommand2! [or whatever the command number of your start and stop External Tool is] and you can, on the second script, remove the line that that save the files (DTE.ExecuteCommand("File.SaveAll")


the bit that i did not understood;

running DTE.ExecuteCommand("View.ViewCode") as suggested on this thread instead of DTE.ExecuteCommand("Window.ActivateDocumentWindow") throws me this error
204483-image.png







image.png (17.6 KiB)
image.png (21.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.