[Alt]+[F1] to launch url or websearch on keyword

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

[Alt]+[F1] to launch url or websearch on keyword

Post by blueznl »

A long time ago far far away... oh wait. That's a different forum :-)

Some time ago I wrote a little tool CodeCaddy, yet these days the PB IDE seems to have made most of it superfluous. Yet there's one new feature I've been playing around with which I miss in the PB IDE.

I would like to be able to press ALT+F1 on any word inside the IDE, which then launches an external search, depending on the nature of the keyword.

For example:

1. If the word under the cursor is an URL (http://www.... or http://....) I would like a browser to open with that page.

2. If the word under the cursor is ending on an underscore, then launch a number of searches for that word MINUS the underscore, it's a great way to deal with WinAPI. In my setup I use the following parameters for the search:

http://google.com/search?q=%keyword%
http://www.google.nl/codesearch?q=%keyw ... earch+Code
http://google.com/search?q=site:purearea.net+%keyword%_
http://google.com/search?q=site:forums. ... %keyword%_
http://google.com/search?q=site:msdn.mi ... y+%keyword%

3. Otherwise, launch a search for the keyword.

http://google.com/search?q=%keyword%
http://google.com/search?q=site:purearea.net+%keyword%
http://google.com/search?q=site:forums. ... h+%keyword%
http://google.com/search?q=site:www.pur ... n+%keyword%

I'll upload the latest version of CodeCaddy in a moment to show what I mean.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
Bisonte
Addict
Addict
Posts: 1308
Joined: Tue Oct 09, 2007 2:15 am

Re: [Alt]+[F1] to launch url or websearch on keyword

Post by Bisonte »

there is an external tool at german forum from chi since 2009...
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: [Alt]+[F1] to launch url or websearch on keyword

Post by blueznl »

Bisonte wrote:there is an external tool at german forum from chi since 2009...
I think CodeCaddy dates back to 2005 or so :-) but the thing is: I'd like to have this as part of the PB IDE instead of an external tool. Nothing important or urgent, just nice to have.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: [Alt]+[F1] to launch url or websearch on keyword

Post by Danilo »

blueznl wrote:I would like to be able to press ALT+F1 on any word inside the IDE, which then launches an external search, depending on the nature of the keyword.
I am using ALT+F1 for API search (On Windows: [Editor Tool] VS2010 Help Integration, on Mac OS X: PB IDE Tool: Dash Mac OS X API help starter),
and other guys use other tools for this already. I would like to let this be like it always was, as there already exist many different help add-ons.

There are also more search engines available, and not everybody would like integration of google search into the IDE.
You already did what you wanted to have with your CodeCaddy tool, so no need to force your own ALT+F1 thing to us. ;)
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 796
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: [Alt]+[F1] to launch url or websearch on keyword

Post by Zebuddi123 »

Also this i wrote and use regular set as a tool, assign key combination, left "ctrl & ¬" (not symbol) easy for right handers

Code: Select all

Define ScintillaID.i = Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))
Define Position.i, Min.i, Max.i, Text.s

Position = SendMessage_(ScintillaID, #SCI_GETCURRENTPOS, #Null, #Null)
Min = SendMessage_(ScintillaID, #SCI_WORDSTARTPOSITION, Position, #True)
Max = SendMessage_(ScintillaID, #SCI_WORDENDPOSITION, Position, #True)
For Position = Min To Max-1
	Text + Chr(SendMessage_(ScintillaID, #SCI_GETCHARAT, Position, #Null))
Next

If Right(Text,1)="_"
	Text=Left(Text,Len(Text)-1)
	RunProgram("http://social.msdn.microsoft.com/search/en-us/windows/desktop?query="+Text+Chr(38)+"Function Refinement=181")
ElseIf Left(Text,4)="#PB_"
	RunProgram("http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fwww.purebasic.fr%2Fenglish+"+text)
ElseIf Left(Text,4)="#SCI"
	RunProgram("http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fwww.purebasic.fr%2Fenglish+"+text)
ElseIf Left(Text,1)="#" And Mid(Text,2,2)<>"PB"
	Text=Mid(Text,2)
	RunProgram("http://social.msdn.microsoft.com/search/en-us/windows/desktop?query="+Text+Chr(38)+"Refinement=181")
Else
	RunProgram("http://www.google.com/search?q=site%3Ahttp%3A%2F%2Fwww.purebasic.fr%2Fenglish+"+text)
EndIf
End
Zebuddi. :D
malleo, caput, bang. Ego, comprehendunt in tempore
Post Reply