Autohotkey in Visual Studio Menu - visual-studio-2013

I have a problem to use Autohotkey to open - File menu (inside of Visual Studio) and select "Recent projects & solutions". It works fine inside of notepad with this code:
^+r::
WinMenuSelectItem, Untitled - Notepad, , File, Open
Return
But it does not work inside VS:
WinMenuSelectItem, ahk_class Svitlana-PC • Sniffsters (Debug|Any CPU) - Microsoft Visual Studio, , File, Open
Probably because I cannot specify a wintitle correctly - I tried many variants from WinSpy, but I did not succeed.
Can anybody give me an advice or direction?
Thank you for reading.
Best,
Svitlana

Try activating the window (if that doesn't work, make the mouse click on the title bar of the window).
Then use !f to open the file menu and navigate the menu by sending letter keys. Microsoft programs are always tricky to work with.

Related

how to hide all windows except editor window in Visual Studio 2013?

In Eclipse when you click twice on the tab of the editors Eclipse hide all other windows except the one you write code in and when you do that again(clicking the tab of the document all windows comeback again).
Is there a similar feature in Visual Studio 2013?
Update: I found Auto Hide in Window Menu, but I don't want auto hide, I want to click something to hide windows and click again to show them.
As a programmer i love shortcut keys which is very helpful for productive work. I've search question as you mentioned. But i did not get proper answer. then i've searched solution for me which might helpful to you.
Step 1: Go to visual studio
Step 2: From tool menu open Options menu
Step 3: Go Environment -> Keyboard
Step 4: Select item Window.AutoHideAll from list
Step 5: Set short cut in "Press shortcut keys textbox". I've set Ctrl+Alt+] then click on Assign & then ok.
Step 6: Final step. Use above shortcut to hide all window other than editor window.
View | Full Screen
(In my key bindings: shift+ctrl+enter.)
However, double clicking on an editor tab also works, this is provided by one of the extensions I use, but I'm not sure which.)
Richards answer does work, but has the side effect of maximizing the whole of Visual Studio as well. Sometimes (e.g. when comparing editor text to some other text), I would like Visual Studio to only take half the screen. A solution I found in Visual Studio 2019 was:
Window | Save Window Layout (call it something like Normal layout)
Unpin all the other panes you don't want to see, ToolBox, Solution Explorer, Build Results etc. Typically Left, Right and Bottom
Window | Save Window Layout, call it say maximized Editor.
Window | Apply Window Layout, you can choose Normal or Maximized editor
Visual Studio assigns these shortcut keys automatically of Ctrl+Alt+1 and Ctrl+Alt+2 to the first two Apply Window Layout choices

Visual Studio Clicking Find Results Opens Code in Wrong Window

I'm using Visual Studio 2010 and when I do a "Find in Files" the results are returned to the "Find Results 1" window which is docked below my code editor window.
Before, I would double click on one of the results in the Find Results window and the file I clicked on would open in the code editor panel.
The problem is now when I click on one of the results, it opens in the same panel as the Find Results window which happens to be much smaller than the code editor window which is annoying.
Does anyone know how to make it so that when I double click on the search results they open up in the code editor window again?
Thanks!
Click Window → Reset Window Layout
Works for VS2013 Update 4 and all newer versions, including VS2019.
I thought I had this problem but it was easily fixed by docking the Find Results window using the very bottom of the window position selectors.
The files open in the same position as the Find Results when the window is docked in the positions immediately next to the centre position.
This is also being discussed here:
VS2010 docks code windows in the wrong place
Go the same... irritating... I realized that this unwanted behavior happened only while the app was running in debug. After I stopped debugging, a new panel was created with this file open in it. If I opened new files, they would open in this new panel. If I close all files in this new panel, opening new files from the "Find In Files" open in the standard code editor window (as long as the app is not running).
I had this problem also. I experienced the problem in VS2013. I did not want to do "Window -> Reset Window Layout" because it seemed like that was going to do other stuff that I did not want it to do.
Here was my solution:
I noticed the problem in VS2013 in which I had project "A" open.
I opened another copy of VS2013 and opened project "B".
I closed the copy of VS2013 that was exhibiting the annoying behavior: project A.
I closed the copy of VS2013 that had project B open.
This saved the settings from the "good" copy.
Opened project A in VS2013 and all was well.
Obviously, the caveat is that this requires you notice the problem before you close VS2013. But if you do notice it in time, this is a pretty easy solution.
For those who do not want to dock their "Find Results", "Error List", "Output",... windows to the right, and for those the above answer which is Window->Reset Window Layout doesn't work: may be you are trying to dock wrong place! You should dock these windows to very bottom. Refer here: https://stackoverflow.com/a/2735726/6176317
For me, this was happening with a Visual Studio window containing an SQL file with the Window Split option active. If the cursor was in the top pane of the window, both Ctrl + F (Find) and Ctrl + H (Find & Replace) would cause the find control to appear in the other (main) Visual Studio window. Moving the SQL window into the main window just caused Find and Find & Replace to display the "Find in Files" dialog instead until another tab was selected.
The workaround was to place the cursor in the bottom pane which caused both Find and Find & Replace to work correctly in that pane of that window. Unfortunately as long as the Window Split is there, the bug is still there in the top pane.

Prevent Visual Studio's "Home" page when Pressing the Web Home key

I search the web a lot when writing code. When working in Visual Studio 2008, every time I hit the keyboard's Web Home key (you know the one on every multi media keyboard with the house on it) it opens a browser in VisualStudio - usually to something on MSDN.
Not that I don't like MSDN, but I'd like to open a real browser on my second monitor and go to my home page. Is there a way to tell Visual Studio not to open it's own home page and instead let Windows process it?
You can bypass Visual Studio processing this key by means of the excellent free utility AutoHotkey. It can help with all sorts of automation needs, but in particular Overriding or Disabling Hotkeys of course, see the list of Hotkeys (Mouse, Joystick and Keyboard Shortcuts) too.
Your scenario requires Context-sensitive Hotkeys; the necessary parameters to discriminate target applications via Window class and/or title can be determined via the included Window Spy utility.
While I'm working on a laptop right now, which doesn't feature a Browser Home key, I just tested the following script fragment successfully with another keyboard shortcut:
#IfWinActive ahk_class wndclass_desked_gsk ; Visual Studio browser home key hook
Browser_Home::Run firefox.exe http://example.com
#IfWinActive ; Subsequent mappings/hotkeys in effect for all windows again now
I usually start one keyboard shortcut related script (incidentally called Windowskey.ahk) automatically via my user Start Menu\Programs\Startup folder, and launch other scripts from there via a hotkey as needed ;)
Is there not a way in the visual studio shortcuts to disable the home button?
Does it do that when Visual Studio is not open? If so, check your file associations.
Did your keyboard have an utility to associate the key? Maybe launching the browser directly will avoid your problem
Tools/Options
Environment/Keyboard
In the list, Find View/Home, and assign it to a very complex shortcut keys combination.
Also do the same for View/StartPage and View/WebBrowser
Keyboard shortcuts for the multimedia keys can be customized using something like TweakUI. I think you'd have to modify the Home action for the keyboard, not a Visual Studio shortcut.

Open two instances of a file in a single Visual Studio session

I have a file, xyz.cpp. I want to open two instances of this file in Visual studio (BTW, I am using Visual Studio 2005). Why would I want to do so? I want to compare two sections of the same file side by side. I know workarounds such as:
Make a copy of the file. But the problem is that it's not elegant, and I don't want to make copies every time I am faced with this.
I can split the window into two. The problem with split it that I can split it horizontally only. The result of a horizontal split is that the right half of my screen is white space.
If I were able to split it vertically or open two instances of the same file, it would increase the number of lines of code I can compare.
Visual Studio
Here's how to do it...
Select the tab you want two copies of
Select menu Window → New Window from the menu.
Right click the new tab and select New Vertical Tab Group
If New Window is not listed in the *Window menu note that the command does exist, even as of Visual Studio 2017. Add it to the Window menu using menu Tools → Customize → Commands. At that point decide where to put the New Window command and select Add Command.
VS Code
In Visual Studio Code version 1.25.1 and later
Way 1
You can simply left click on your file in the side-panel (explorer) and press Ctrl + Enter.
Way 2
Simply right click on your file in the Visual Studio Code side-panel (explorer) and select the first option open to the side.
For Visual Basic, HTML and JScript and RDL Expression, the Window > New Window option mentioned in PaulB's answer is disabled.
However an option can be changed in the Registry to enable the menu item.
All other languages do not restrict to a single code window so you can use PaulB's answer without editing the registry.
Enabling New Window in Windows Registry.[1] [2]
Go to the following registry key. This example is for Basic (Visual Basic), but the key is also there for HTML, JScript and RDL Expression.
64-bit OS: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Languages\Language Services\Basic
32-bit OS: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Languages\Language Services\Basic
Find the value Single Code Window Only and do one of the following:
Set it to 0
Rename the value
Delete the value (use caution!)
This will enable the "New Window" menu item, but it may still not be visible in the menu.
Adding Menu Item
To actually see the New Window menu item I had to add it back into the menu:
Tools > Customize... > Commands > Add Command...
Select 'Menu Bar' the select the 'Window' menu in the dropdown
Add Command... > Window > New Window > OK
Restoring Registry Value
Copy-paste this to notepad, save as a .reg file and import the file into your registry to restore the initial setting.
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Languages\Language Services\Basic]
"Single Code Window Only"=dword:00000001
Go to menu → Windows → New Window:
You can use the Windows → New Window option to duplicate the current window. See more at: Why I like Visual Studio 2010? Undock Windows
Open the file (if you are using multiple tab groups, make sure your file is selected).
Menu Window → Split
(alternately, there's this tiny nub just above the editor's vertical scroll bar - grab it and drag down)
This gives you two (horizontal) views of the same file. Beware that any edit-actions will reflect on both views.
Once you are done, grab the splitter and drag it up all the way (or menu Window → Remove Split).
How to open two instances of the same file side by side in Visual Studio 2019:
Open the file.
Click Window → New Window.
A new window should be open with the same file.
Click on Window → New Vertical Document Group.
Result:
With the your file opened, go to command window (menu View → Other Windows → Command window, or just Ctrl + Alt + A)
Type:
Window.NewWindow
And then
Window.NewVerticalTabGroup
worked for me (Visual Studio 2017).
Or using menus:
Menu Window → New Window
Menu Window → New vertical tap group
Luke's answer didn't work for me. The 'New Window' command was already listed in the customize settings, but not showing up in the .js tabs context menu, despite deleting the registry setting.
So I used:
Tools
Customize...
Keyboard...
Scroll down to select Window.NewWindow
And I pressed and assigned the shortcut keys, Ctrl + Shift + W.
That worked for me.
==== EDIT ====
Well, 'worked' was too strong. My keyboard shortcut does indeed open another tab on the same JavaScript file, but rather unhelpfully it does not render the contents; it is just an empty white window! You may have better luck.
Window menu, New Horizontal/Vertical Tab Group there will do, I think.
When working with Visual Studio 2013 and VB.NET I found that you can quite easily customize the menu and add the "New Window" command - there is no need to mess with the registry!
God only knows why Microsoft chose not to include the command for some languages...?
For newer versions (such as Visual Studio 2017)
Select the window you want to duplicate.
Go to the window tab and click on split at the top of the list.
When you are done, click it again to toggle it off.
For file types, where the same file can't be opened in a vertical tab group (for example .vb files) you can
Open 2 different instances of Visual Studio
Open the same file in each instance
Resize the IDE windows & place them side by side to achieve your layout.
If you save to disk in one instance though, you'll have to reload the file when you switch to the other. Also if you make edits in both instances, you'll have to resolve on the second save. Visual Studio prompts you in both cases with various options. You'll simplify your life a bit if you edit in only the one instance.
I don't have a copy of Visual Studio 2005, but this process works on Visual Studio 2008:
Open xyz.cpp along with some other file.
Right click on tab header and select new vertical tab group.
Left click on that other file in the first tab group.
Open xyz.cpp through solution explorer again.
You should now have two instances of file in separate vertical tab groups.
To work on two sections of one long file, simply use a shortcut (Ctrl + \) or click on the split editor window while you are on the selected tab. The icon is on the top-right of the Visual Studio Code.

Visual Studio 2005 quick file search

In Eclispe you can do Ctrl+Shift+R and a Window popup where you can write the name of the file (or just the beginning of it) and to press enter to go directly to the file.
What is the equivalence in Visual Studio 2005? (Ctrl+Shift+F is not what I would like).
From Top 11 VS 2005 IDE tips and tricks:
This is the Find dropdown that is on the Standard Toolbar, not the Find dialog. Use the shortcut CTRL+D to activate the Find dropdown in normal mode. Use CTRL+/ to activate the Find dropdown in command mode
To quickly go to a file, type CTRL+D, >open <start of file name>. Intellisense works here just like in the Command Window. "of" (short for "open file") can be used instead of open.
I am not sure if there is a built-in command but there are some addons like VS File Finder
Hit Ctrl+D (Find Combo - the one in the toolbar), write ">of " and the name of the file.
I am using ReSharper, so I am not sure if the shortcut is exactly this one in your case.
I don't know if there is an equivalence, but you can probably do it with the macro editor. It's pretty powerful and you can do pretty much what you want with it.
In plain VS.NET 2005, Go to the command window (Ctrl-D), type "openfile" (or just "of") and the file name.
If you have Resharper (and you should have it), you can type Ctrl-N and type in the class name, or Ctrl-Shift-N and type in the filename.
Gulzar proposed VS File Finder that was the greatest solution here.
But I installed SonicFilFinder because the GUI was better. It works like a charm and you can use the HotKey you want. Really fast and no need of of the mouse. It's free.
In VS 2010, you can use Edit > Navigate To... (Ctrl+comma).
Pro:
Also searches objects/methods
Con:
Doesn't support * wildcards
Window isn't dockable
See: MSDN Blog

Resources