setting shortcuts for running shell commands

garibaldi 1 Reputation point
2022-05-22T21:29:02.253+00:00

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"?

Developer technologies Visual Studio Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. garibaldi 1 Reputation point
    2022-05-23T02:21:43.21+00:00

    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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.