Search via Google Alt+F2 entire line not just selected text
-
@Alexander-Anisimov said:
Normally
there is an Alt+F2 combination for Google searchNo, this isn’t a default keycombo in Notepad++.
You could create a macro for your desired action; it would look something like this in
shortcuts.xml
:<Macro name="Search internet for current line text" Ctrl="no" Alt="yes" Shift="no" Key="113"> <Action type="0" message="2453" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2453" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2345" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2315" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2315" wParam="0" lParam="0" sParam="" /> <Action type="2" message="0" wParam="42075" lParam="0" sParam="" /> </Macro>
Note that 42075 is the command number for “search internet” and that the other actions in the macro come from THIS posting.
Note that in the macro definition, I assigned the macro to keycombo Alt+F2. If you have something else assigned to that, you’d want to remove it before putting this macro in place.
-
@Alan-Kilborn yes, I understand that, it may not be default, but my question is not about the shortcut keys, but about how that search is executed? and can it be executed onto an entire line wherever cursor is? without selecting text
-
@Alexander-Anisimov said in Search via Google Alt+F2 entire line not just selected text:
how that search is executed?
The “Search Internet” command 42075 is exactly the action that Edit > On Selection > Search Internet executes. @Alan-Kilborn put it into Macro form for you.
and can it be executed onto an entire line wherever cursor is?
Yes. The macro that Alan provided for you implements that: it starts your caret (typing cursor) where you had it; then it moves it to the start of the line, then it selects from there to the end of the line. So now your selection is the entire line, so it then runs the “Search Internet” command using the contents of the current selection.
If you were confused by the XML-based Macro that @Alan-Kilborn posted for you:
- Open
%AppData%\Notepad++\shortcuts.xml
- Go to the
</Macros>
line - Paste the
<Macro>...</Macro>
that @Alan-Kilborn shared just above the</Macros>
line - Save
- Exit Notepad++
- Run Notepad++
- Your Macros menu now has the entry “Search internet for current line text”, and the keyboard shortcut
Alt+F2
will run that macro for you.
- Open
-
@Alan-Kilborn yeah this seems to work
but when I added that macro - it only selects the line,
and that persists regardless - wether Alt+F2 for Google search is present in shorcuts.xml or not.
it just selects the entire line without doing the rest (the search)UPD:
I even added “Google Search” to your last line<Action type="2" message="0" wParam="42075" lParam="0" sParam="Google Search" />
still won’t work
Maybe that’s because my v. is 6.9
But I prefer to stay with itAlso actually two commands are enough for that macro:
<Action type="0" message="2312" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2315" wParam="0" lParam="0" sParam="" />
No matter what I tried, it only selects entire line and does nothing afterwards:
I tried:
<Action type="0" message="2312" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2315" wParam="0" lParam="0" sParam="" /> <Action type="2" message="0" wParam="42075" lParam="0" sParam="Google Search" />
<Action type="0" message="2312" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2315" wParam="0" lParam="0" sParam="" /> <Action type="1" message="0" wParam="0" lParam="0" sParam="Google Search" />
<Action type="0" message="2312" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2315" wParam="0" lParam="0" sParam="" /> <Action type="1" message="0" wParam="42075" lParam="0" sParam="Google Search" />
<Action type="0" message="2312" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2315" wParam="0" lParam="0" sParam="" /> <Action type="1" message="0" wParam="42075" lParam="16777251" sParam="Google Search" />
None of those worked. It keeps selecting a line but does not do anything after.
-
@Alexander-Anisimov said :
I even added “Google Search” to your last line
<Action type=“2” message=“0” wParam=“42075” lParam=“0” sParam=“Google Search” />
This does nothing.
still won’t work
Maybe that’s because my v. is 6.9
But I prefer to stay with itWhen something doesn’t work, sticking with software that is almost a decade old is probably not going to get you to a solution.
-
@Alan-Kilborn said in Search via Google Alt+F2 entire line not just selected text:
When something doesn’t work, sticking with software that is almost a decade old is probably not going to get you to a solution.
Software version has nothing to do with my task, and my task is straightforward enough to work across the board. IMHO
-
@Alexander-Anisimov said:
Software version has nothing to do with my task,
Why are you so sure about this?
and my task is straightforward enough to work across the board. IMHO
It’s a straightforward thing, if you use current Notepad++ software (e.g. 8.7) and follow my solution as outlined above.
I don’t think people here should reach back in time almost 10 years to assist with your problem, when you haven’t offered a valid reason why you should stick with software that old.
-
@Alexander-Anisimov said in Search via Google Alt+F2 entire line not just selected text:
Software version has nothing to do with my task
But software version almost always has to do with whether or not a piece of software can accomplish your task in the way you want to.
Between v6.9 and modern Notepad++, the application changed the way it implemented internet search: in v6.9, it was a Run menu command, which is literally running the URL
https://www.google.com/search?q=$(CURRENT_WORD)
from the command-line-equivalent, passing in the current selection to the$(CURRENT_WORD)
variable. In modern Notepad++, it’s Edit > On Selection > Search on Internet, which uses the Settings > Preferences > Search Engine setting to pick which search engine to search with.Notepad++ macros have never been able to record actions from the Run menu (because the Run-menu is user-editable, the underlying menu command ID numbers can change from one run of Notepad++ to the next; since macros rely on the menu command ID, they cannot guarantee that they would run the same command every time you use the macro, so they don’t let you record those actions).
On the other hand, Notepad++ macros can record most of the built-in commands. In modern Notepad++, with the Search on Internet command as a permanent, built-in action rather than a volatile Run-menu action, it is macro recordable.
So the task you want is not a feature that existed in v6.9. And saying “I want a new feature without upgrading” is a self-contradictory request.
Your choices, at this point:
- Upgrade to Notepad++ v8.7, to get all the modern features of Notepad++, rather than limiting yourself to the features available a decade ago
- Stay with Notepad++ v6.9, and either
- accept that you won’t have the search the whole line feature
- do a two stage action, where first you run a macro that selects the whole line with a keystroke, then run the Search-with-Google Run-menu command with a second keystroke (how horrible, having to do two different shortcuts to perform two separate actions)
- there are probably other things that a knowledgable hacker could do to implement a similar command using old plugins that were compatible with v6.9 executable… but it’s doubtful anyone here would spend the time and effort necessary to help you with that, since you already know the right solution to get exactly what you’ve asked for is to upgrade Noteapd++ and use the macro that was already handed to you. Hence, if you want to find a workaround, you’ll probably have to investigate those old plugins yourself, and figure out how to do it. But all that effort would be a lot less than just upgrading to a supported Notepad++ version, where there is a known-working solution.
So it’s up to you to to choose which path to go down at this point.
-
@Alexander-Anisimov, With one exception, the Notepad++ project has never had the concept of maintaining old versions. You will never see a form of v6.9, or any older version, updated and released.
If using v6.9 is important to you then download the source code and build your personal fork of v6.9 that has the features that you desire. This fork will be your personal project. Changes that you want to contribute will never be accepted into the main project unless that contribution is to the current version.
Notepad++'s version numbers have never followed a pattern other than the most recent release has a higher number of some sort than the previous release.
I started out this forum post with “with one exception.” The exception is that while version 7 was the first 64-bit release the project continues build and and make available for download X86 or 32-bit executables. Starting with version 7, and all succeeding versions there have been 32-bit and 64-bit executables available for download. The 32 and 64 bit downloads are identical in terms of the feature sets and configuration/setting files. Somewhere along the line ARM64 downloads also became available as part of the package of downloads available for each release. Notepad++ for the ARM64 is identical in terms of features and its data files as the X64 and X86 downloads.
-
@PeterJones thank you, Peter for your detailed exposition.
The only caveat I have to comment your post with is:
My version of Notepad++ still has that
“> Settings > Preferences > Search Engine setting to pick which search engine to search with”
So I don’t see the problem, meaning I don’t see how mechanics would be different, or anything macros-wise would be different from newer version of Notepad++?But you do make sense, thank you.
-
@mkupper all I am trying to do is to understand what functions my version is missing compared to new versions that prevent me from running that macro succesfully. is all.
-
@mkupper said:
With one exception, the Notepad++ project has never had the concept of maintaining old versions.
The exception is that while version 7 was the first 64-bit release the project continues build and and make available for download X86 or 32-bit executablesI don’t see how offering a 32-bit release along with a 64-bit release qualifies as “maintaining old versions”. It’s merely a “choice” for the user for a specific version.