Usefull shortcut to automatically attach to a certain process

I was tired of doing Crl + Alt + p to launch to Attach To Process dialog, press m to select maya and finally press Enter. So I was looking to automate this and came across a useful extension called Visual Commander

Install the Visual Commander extension (Tools -> Extensions and Updates -> Online)

Description from the site:
The freemium Visual Commander extension lets you automate repetitive tasks in Visual Studio 2013/2012/2010. You can reuse existing Visual Studio macros from previous versions of the IDE and create new commands and extensions in C# or VB. You can also record and playback keyboard commands for the Visual Studio text editor

This will add a new menu item called VCMD. Add a new command with the following code;

Dim proc
For Each proc In DTE.Debugger.LocalProcesses
If proc.Name.ToString().EndsWith("maya.exe", StringComparison.OrdinalIgnoreCase) Then
proc.Attach()
System.Diagnostics.Debug.WriteLine("Attached To Maya")
Exit Sub
End IF
Next
MessageBox.Show("Maya process not found", "Attach To Maya")

Visit http://vlasovstudio.com/visual-commander/ To create a hotkey for your commands.


5 Comments

guest · October 1, 2015 at 1:08 pm

Dim proc
For Each proc In DTE.Debugger.LocalProcesses
If proc.Name.ToString().EndsWith(“maya.exe”, StringComparison.OrdinalIgnoreCase) Then
proc.Attach()
System.Diagnostics.Debug.WriteLine(“Attached To Maya”)
Exit Sub
End IF
Next
MessageBox.Show(“Maya process not found”, “Attach To Maya”)

————Compile————

(1,0): error BC30001: Statement is not valid in a namespace.
(2,0): error BC30689: Statement cannot appear outside of a method body/multiline lambda.
(3,0): error BC30689: Statement cannot appear outside of a method body/multiline lambda.
(4,0): error BC30188: Declaration expected.
(5,0): error BC30188: Declaration expected.
(6,0): error BC30689: Statement cannot appear outside of a method body/multiline lambda.
(7,0): error BC30087: ‘End If’ must be preceded by a matching ‘If’.
(8,0): error BC30035: Syntax error.
(9,0): error BC30188: Declaration expected.

———–This is my Errors—–

I guess this problem is my wrong VB syntax.
but I don’t know which use the namespace module and many things….

    Jos · October 6, 2015 at 11:13 am

    Hi, thanks for the comment. What version of VS are you using?

      guest · October 15, 2015 at 1:02 pm

      Thanks reply.
      My ver is VS 2013.

guest · October 1, 2015 at 12:58 pm

Thanks for your all for maya scripts.
I’m doing use very well “ToMaya” This is so useful
but I don’t know how to use this VB Script.

I was wrote all the same as your description.
and press the Compile button then many occurred Errors.

I just follow Commands..->Add->Code: (your code here copy/paste) -> Save -> Run —->>> Error

How can I fix this? can you more description?

Sergo · January 10, 2015 at 4:24 am

Thanks for this, I’m so tired to attach those things each time, but I was also lazy to research 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *