Visual Studio: Shortcut Attach To Process

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.

Tagged , , ,

5 thoughts on “Visual Studio: Shortcut Attach To Process

  1. guest says:

    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….

  2. guest says:

    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?

  3. Sergo says:

    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 *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>