AHK Lookup Selection with Online Help Docs

Post your working scripts, libraries and tools for AHK v1.1 and older
gallaxhar
Posts: 143
Joined: 03 Sep 2014, 06:35

AHK Lookup Selection with Online Help Docs

16 May 2016, 04:12

This script allows you to look up any selected text in Scite4AHK by pressing the F1 key.

My script is abandoned, superseded by Nextron's awesome script, here is the link to the post

https://autohotkey.com/boards/viewtopic ... 700#p87700

He should probably make his own thread about it

I only suggest wrapping it with

Code: Select all

#IfWinActive ahk_exe SciTE.exe
#IfWinActive
so you can still use F1 help in other program like autocad etc


Here is nextron's script with the F1 key wrapped and with singleinstance force, for convenience:

Code: Select all

#SingleInstance Force
#IfWinActive ahk_exe SciTE.exe
F1::
AutoHotkeyCommands(q:=""){
	static command
	url:="https://autohotkey.com/docs/"
 
	If (q="")	
		If !(q:=Trim(CtrlC()," `t`n`r"))
			Return
	If !(command){
		html:=UrlDownloadToVar(url "static/content.js"), command:={}, i:=1
		html:=RegExReplace(html,"s)(.*index = \[)(.*?)(\];.*)","$2")
		While i:=RegExMatch(html,"\[""([^""]*)"",""([^""]*)""]",s,i+1)
			command[s1]:=s2
	}
 
	If (v:=command[q]) || (v:=command[q "()"])
		t:=url v
	Else
		For k,v in command
			If InStr(k,q){
				t:=url v
				Break
			}
	If t
		Run % t	
	else
		Run http://www.google.com/cse?cx=010629462602499112316:ywoq_rufgic&q=%q%
Return
}
#IfWinActive
CtrlC(){
	WholeClipBoard:=ClipBoardAll
	ClipBoard =
	Send ^c
	ClipWait,.3
	str:=ClipBoard
	ClipBoard:=WholeClipBoard
	Return, str
}
UrlDownloadToVar(URL) {
 ComObjError(false)
 WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
 WebRequest.SetTimeouts(5000, 5000, 3000, 3000)
 WebRequest.Open("GET", URL)
 WebRequest.Send()
 Return WebRequest.ResponseText
}
Last edited by gallaxhar on 19 May 2016, 10:07, edited 5 times in total.
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: AHK Lookup Selection with Online Help Docs

16 May 2016, 07:37

I have three points of criticism:
• While trying to make look-ups easy by making the script automatically run at startup, I would not like something doing that without asking first, especially if it invokes UAC every time when it does not require admin permissions. It may also be difficult to revert for the inexperienced user trying out the script.
• The script defaults to Internet Explorer to do the search (an keeps it loaded), which may not be the browser of choice for the user.
• Although with good intent, the script moves and resizes the browser window to a different location from the user preferred location, disregarding and overwriting their settings.

I use a similar script which has the added benefit of caching the commands/URL's which reduces the number of page request to one, other than its first use:

Code: Select all

F1::
AutoHotkeyCommands(q:=""){
	static command
	url:="https://autohotkey.com/docs/commands/"
	
	If (q="")	
		If !(q:=Trim(CtrlC()," `t`n`r"))
			Return
	If !(command){
		html:=UrlDownloadToVar(url), command:={}, i:=1
		While i:=RegExMatch(html,"<a href=""([^""]*)"">([^<]*)</a>",s,i+1)
			command[s2]:=s1
	}

	If (v:=command[q]) || (v:=command[q "()"])
		t:=url v
	Else
		For k,v in command
			If InStr(k,q){
				t:=url v
				Break
			}
	If t
		Run % t	
Return
}
CtrlC(){
	WholeClipBoard:=ClipBoardAll
	ClipBoard =
	Send ^c
	ClipWait,.3
	str:=ClipBoard
	ClipBoard:=WholeClipBoard
	Return, str
}
UrlDownloadToVar(URL) {
 ComObjError(false)
 WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
 WebRequest.SetTimeouts(5000, 5000, 3000, 3000)
 WebRequest.Open("GET", URL)
 WebRequest.Send()
 Return WebRequest.ResponseText
}
gallaxhar
Posts: 143
Joined: 03 Sep 2014, 06:35

Re: AHK Lookup Selection with Online Help Docs

16 May 2016, 12:25

Thanks for your feedback, I'm unhappy with the registry edit as well, however there seems to be a new security precaution in Windows 10 for AHK scripts, you can't add them to the startup menu with a lnk and have it run, windows 10 just doesn't run them. I tried everything, even making a lnk with Autohotkey.exe and passing the script as a parameter didn't work. The only option would maybe be to compile the script to exe, but I didn't want to do that, so I went with regwrite. I'm not aware of any elegant workarounds to this. Using the old startmenu link option, I used to have a snippet script that would kindly ask the user, but with regwrite I can see it getting annoying at each start up, not sure how to check if the reg key already exists.

The internet explorer browser may not be the preferred browser, but neither is CHM a preferred browser, the purpose is just a quick read of the docs, pretend it's a built-in help function to Scite4AHK, which is why it takes up the same screen space as scite, because you aren't actually using the browser for "browsing the internet" with your favorites, preferred bookmark bar, etc, you're just "browsing the html docs", like a CHM file does, using IE. I did it this way to use the IE com, that is the only way I know to search the INDEX control of the online docs, which gives far better accuracy and reliability for lookups. Using your script, try to F1 key on "ClipboardAll", doesn't work, because it doesn't search the INDEX control like the script in the OP does.

I like to look up a ton of stuff when reading other peoples code in scite, I wanted as many lookups as possible to just work, that keeps my mind on task and focused, rather than having to punch it in manually.
gallaxhar
Posts: 143
Joined: 03 Sep 2014, 06:35

Re: AHK Lookup Selection with Online Help Docs

16 May 2016, 12:33

@Nextron

I made a two-line patch to the original script which empties the COM "browser" object after the page loads, and doesn't create it on script start, until you need it, that way if you close the IE window or never press F1, there is no IE running in the background for performance reasons.
gallaxhar
Posts: 143
Joined: 03 Sep 2014, 06:35

Re: AHK Lookup Selection with Online Help Docs

16 May 2016, 16:25

Made the script more reliable and fixed a bug where pressing F1 with no selected text wasn't working properly
coolykoen
Posts: 61
Joined: 01 Jun 2015, 06:10

Re: AHK Lookup Selection with Online Help Docs

19 May 2016, 02:58

is it possible to use a window with IE embedded so it looks like a pop up instead of opening a full IE window? (or in my case it opens my default browser)
i really like this idea but i don't know how to make it so, that it opens a small window with no buttons except a close button and the page itself.

example:
Image
(my windows theme is red, but the borders could be any color)


other then that, great idea :)
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: AHK Lookup Selection with Online Help Docs

19 May 2016, 04:12

sure...
small example:

Code: Select all

URL := "https://autohotkey.com/docs/commands/"

Prev := FixIE()
Gui, Margin, 4, 4
Gui Add, ActiveX, xm ym w980 h640 vWB, Shell.Explorer
WB.Navigate(URL)
Gui, Show
return

GuiClose:
FixIE(Prev)
ExitApp

FixIE(Version := 0, ExeName := "")
{
	static Key := "Software\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION"
	static Versions := {7:7000, 8:8888, 9:9999, 10:10001, 11:11001}

	if (Versions.HasKey(Version))
		Version := Versions[Version]

	if !(ExeName)
	{
		if (A_IsCompiled)
			ExeName := A_ScriptName
		else
			SplitPath, A_AhkPath, ExeName
	}

	RegRead, PreviousValue, HKCU, %Key%, %ExeName%
	if (Version = "")
		RegDelete, HKCU, %Key%, %ExeName%
	else
		RegWrite, REG_DWORD, HKCU, %Key%, %ExeName%, %Version%
	return PreviousValue
}
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
coolykoen
Posts: 61
Joined: 01 Jun 2015, 06:10

Re: AHK Lookup Selection with Online Help Docs

19 May 2016, 04:36

jNizM wrote: sure...
small example:
Well, i have a working IE 11... but somehow when i start your script this is all i get:
Image

my working IE 11:
Image
(yes i know this is not the newest update... but that shouldn't matter since 11 is new enough for this right?)

EDIT:

Code: Select all

Gui, Add, ActiveX, xm w980 h640 vWB, Shell.Explorer
WB.Navigate("https://autohotkey.com/docs/commands/") 
Gui, Show
return
 
GuiClose:
ExitApp
The above code seems to work for me, result:
Image

but how can i integrate that into OP's origenal code to make it work?
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: AHK Lookup Selection with Online Help Docs

19 May 2016, 04:45

Looks like this:
Image

Added Resize

Code: Select all

URL := "https://autohotkey.com/docs/commands/"

Prev := FixIE()
Gui +Resize +hwndhMain
Gui, Margin, 4, 4
Gui Add, ActiveX, xm ym w980 h640 vWB, Shell.Explorer
WB.Navigate(URL)
Gui, Show
return

GuiSize:
    GuiControl, Move, WB, % " xm ym w" (A_GuiWidth - 5) " h" (A_GuiHeight - 5)
return

GuiClose:
FixIE(Prev)
ExitApp

FixIE(Version := 0, ExeName := "")
{
	static Key := "Software\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION"
	static Versions := {7:7000, 8:8888, 9:9999, 10:10001, 11:11001}

	if (Versions.HasKey(Version))
		Version := Versions[Version]

	if !(ExeName)
	{
		if (A_IsCompiled)
			ExeName := A_ScriptName
		else
			SplitPath, A_AhkPath, ExeName
	}

	RegRead, PreviousValue, HKCU, %Key%, %ExeName%
	if (Version = "")
		RegDelete, HKCU, %Key%, %ExeName%
	else
		RegWrite, REG_DWORD, HKCU, %Key%, %ExeName%, %Version%
	return PreviousValue
}
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
gallaxhar
Posts: 143
Joined: 03 Sep 2014, 06:35

Re: AHK Lookup Selection with Online Help Docs

19 May 2016, 04:47

Just a hint, I tried integrating jnizm's solution, but at the end discovered it breaks the javascript functionality of the index control on the documentation page, which is required for this script to work. I don't think using that solution will be easy to make work.
There is a way to get a similar result by using TheaterMode in internet explorer, but it looks even worse, even though it takes up less space. Another option (prettier) would be to remove the titlebar and close buttons altogether (like full screen mode, but forced to a smaller window area). The problem then is that you will have to use the Ctrl+W shortcut to close the window.
coolykoen
Posts: 61
Joined: 01 Jun 2015, 06:10

Re: AHK Lookup Selection with Online Help Docs

19 May 2016, 04:51

gallaxhar wrote:Just a hint, I tried integrating jnizm's solution, but at the end discovered it breaks the javascript functionality of the index control on the documentation page, which is required for this script to work. I don't think using that solution will be easy to make work.
There is a way to get a similar result by using TheaterMode in internet explorer, but it looks even worse, even though it takes up less space. Another option (prettier) would be to remove the titlebar and close buttons altogether (like full screen mode, but forced to a smaller window area). The problem then is that you will have to use the Ctrl+W shortcut to close the window.
The same goes for the code i posted under the EDIT in my previous post?
Well, either way, it was just something i would recommend doing to your script because it would look better and might be just a bit faster, but if it wo't work, too bad :P
gallaxhar
Posts: 143
Joined: 03 Sep 2014, 06:35

Re: AHK Lookup Selection with Online Help Docs

19 May 2016, 04:55

go here in chrome
https://autohotkey.com/docs/commands/
click the INDEX button
then start typing in the edit box below INDEX button
you'll see the results kind of "filter"
this is the functionality required

then open up your script using jznizm stuff, run it
and click the index button , and start typing in the edit box control
does stuff "filter", like before?
if so, you can use that solution easily
coolykoen
Posts: 61
Joined: 01 Jun 2015, 06:10

Re: AHK Lookup Selection with Online Help Docs

19 May 2016, 06:35

gallaxhar wrote:go here in chrome
https://autohotkey.com/docs/commands/
click the INDEX button
then start typing in the edit box below INDEX button
you'll see the results kind of "filter"
this is the functionality required

then open up your script using jznizm stuff, run it
and click the index button , and start typing in the edit box control
does stuff "filter", like before?
if so, you can use that solution easily
i see.... so, then, i wonder if there are other solutions... hmm... well, for now your script will do :) anyway thanks for sharing it it works pretty well <3
gallaxhar
Posts: 143
Joined: 03 Sep 2014, 06:35

Re: AHK Lookup Selection with Online Help Docs

19 May 2016, 06:56

Yes there is a beautiful solution but I am struggling with arrays to understand how to implement it.

The solution is like this:

Take Nextron's script below to start with,

Code: Select all

F1::
AutoHotkeyCommands(q:=""){
	static command
	url:="https://autohotkey.com/docs/commands/"
 
	If (q="")	
		If !(q:=Trim(CtrlC()," `t`n`r"))
			Return
	If !(command){
		html:=UrlDownloadToVar(url), command:={}, i:=1
		While i:=RegExMatch(html,"<a href=""([^""]*)"">([^<]*)</a>",s,i+1)
			command[s2]:=s1
	}
 
	If (v:=command[q]) || (v:=command[q "()"])
		t:=url v
	Else
		For k,v in command
			If InStr(k,q){
				t:=url v
				Break
			}
	If t
		Run % t	
Return
}
CtrlC(){
	WholeClipBoard:=ClipBoardAll
	ClipBoard =
	Send ^c
	ClipWait,.3
	str:=ClipBoard
	ClipBoard:=WholeClipBoard
	Return, str
}
UrlDownloadToVar(URL) {
 ComObjError(false)
 WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
 WebRequest.SetTimeouts(5000, 5000, 3000, 3000)
 WebRequest.Open("GET", URL)
 WebRequest.Send()
 Return WebRequest.ResponseText
}
Then patch it by putting this data file into an array

Code: Select all

"#AllowSameLineComments","commands/_AllowSameLineComments.htm"
"#ClipboardTimeout","commands/_ClipboardTimeout.htm"
"#CommentFlag","commands/_CommentFlag.htm"
"#Delimiter","commands/_EscapeChar.htm#Delimiter"
"#DerefChar","commands/_EscapeChar.htm#DerefChar"
"#ErrorStdOut","commands/_ErrorStdOut.htm"
"#EscapeChar","commands/_EscapeChar.htm"
"#HotkeyInterval","commands/_HotkeyInterval.htm"
"#HotkeyModifierTimeout","commands/_HotkeyModifierTimeout.htm"
"#Hotstring","commands/_Hotstring.htm"
"#If","commands/_If.htm"
"#IfTimeout","commands/_IfTimeout.htm"
"#IfWinActive","commands/_IfWinActive.htm"
"#IfWinExist","commands/_IfWinActive.htm"
"#IfWinNotActive","commands/_IfWinActive.htm"
"#IfWinNotExist","commands/_IfWinActive.htm"
"#Include","commands/_Include.htm"
"#IncludeAgain","commands/_Include.htm"
"#InputLevel","commands/_InputLevel.htm"
"#InstallKeybdHook","commands/_InstallKeybdHook.htm"
"#InstallMouseHook","commands/_InstallMouseHook.htm"
"#KeyHistory","commands/_KeyHistory.htm"
"#LTrim","Scripts.htm#LTrim"
"#MaxHotkeysPerInterval","commands/_MaxHotkeysPerInterval.htm"
"#MaxMem","commands/_MaxMem.htm"
"#MaxThreads","commands/_MaxThreads.htm"
"#MaxThreadsBuffer","commands/_MaxThreadsBuffer.htm"
"#MaxThreadsPerHotkey","commands/_MaxThreadsPerHotkey.htm"
"#MenuMaskKey","commands/_MenuMaskKey.htm"
"#NoEnv","commands/_NoEnv.htm"
"#NoTrayIcon","commands/_NoTrayIcon.htm"
"#Persistent","commands/_Persistent.htm"
"#SingleInstance","commands/_SingleInstance.htm"
"#UseHook","commands/_UseHook.htm"
"#Warn","commands/_Warn.htm"
"#WinActivateForce","commands/_WinActivateForce.htm"
":=","commands/SetExpression.htm"
"A_AhkPath","Variables.htm#AhkPath"
"A_AhkVersion","Variables.htm#AhkVersion"
"A_AppData","Variables.htm#AppData"
"A_AppDataCommon","Variables.htm#AppDataCommon"
"A_AutoTrim","Variables.htm#AutoTrim"
"A_BatchLines","Variables.htm#BatchLines"
"A_CaretX","Variables.htm#Caret"
"A_CaretY","Variables.htm#Caret"
"A_ComputerName","Variables.htm#ComputerName"
"A_ControlDelay","Variables.htm#ControlDelay"
"A_CoordMode...","Variables.htm#CoordMode"
"A_Cursor","Variables.htm#Cursor"
"A_DD","Variables.htm#DD"
"A_DDD","Variables.htm#DDDD"
"A_DDDD","Variables.htm#DDDD"
"A_DefaultGui","Variables.htm#DefaultGui"
"A_DefaultListView","Variables.htm#DefaultListView"
"A_DefaultMouseSpeed","Variables.htm#DefaultMouseSpeed"
"A_DefaultTreeView","Variables.htm#DefaultTreeView"
"A_Desktop","Variables.htm#Desktop"
"A_DesktopCommon","Variables.htm#DesktopCommon"
"A_DetectHiddenText","Variables.htm#DetectHiddenText"
"A_DetectHiddenWindows","Variables.htm#DetectHiddenWindows"
"A_EndChar","Variables.htm#EndChar"
"A_EventInfo","Variables.htm#EventInfo"
"A_ExitReason","Variables.htm#ExitReason"
"A_FileEncoding","Variables.htm#FileEncoding"
"A_FormatFloat","Variables.htm#FormatFloat"
"A_FormatInteger","Variables.htm#FormatInteger"
"A_Gui","Variables.htm#Gui"
"A_GuiControl","Variables.htm#GuiControl"
"A_GuiControlEvent","Variables.htm#GuiControlEvent"
"A_GuiEvent","Variables.htm#GuiEvent"
"A_GuiHeight","Variables.htm#GuiWidth"
"A_GuiWidth","Variables.htm#GuiWidth"
"A_GuiX","Variables.htm#GuiX"
"A_GuiY","Variables.htm#GuiY"
"A_Hour","Variables.htm#Hour"
"A_IconFile","Variables.htm#IconFile"
"A_IconHidden","Variables.htm#IconHidden"
"A_IconNumber","Variables.htm#IconNumber"
"A_IconTip","Variables.htm#IconTip"
"A_Index","commands/Loop.htm"
"A_IPAddress1 through 4","Variables.htm#IPAddress"
"A_Is64bitOS","Variables.htm#Is64bitOS"
"A_IsAdmin","Variables.htm#IsAdmin"
"A_IsCompiled","Variables.htm#IsCompiled"
"A_IsCritical","Variables.htm#IsCritical"
"A_IsPaused","Variables.htm#IsPaused"
"A_IsSuspended","Variables.htm#IsSuspended"
"A_IsUnicode","Variables.htm#IsUnicode"
"A_KeyDelay","Variables.htm#KeyDelay"
"A_KeyDelayPlay","Variables.htm#KeyDelayPlay"
"A_KeyDuration","Variables.htm#KeyDelay"
"A_KeyDurationPlay","Variables.htm#KeyDelayPlay"
"A_Language","Variables.htm#Language"
"A_Language Values","misc/Languages.htm"
"A_LastError","Variables.htm#LastError"
"A_LineFile","Variables.htm#LineFile"
"A_LineNumber","Variables.htm#LineNumber"
"A_LoopField","commands/LoopParse.htm#LoopField"
"A_LoopFileAttrib","commands/LoopFile.htm#LoopFileAttrib"
"A_LoopFileDir","commands/LoopFile.htm#LoopFileDir"
"A_LoopFileExt","commands/LoopFile.htm#LoopFileExt"
"A_LoopFileFullPath","commands/LoopFile.htm#LoopFileFullPath"
"A_LoopFileLongPath","commands/LoopFile.htm#LoopFileLongPath"
"A_LoopFileName","commands/LoopFile.htm#LoopFileName"
"A_LoopFileShortName","commands/LoopFile.htm#LoopFileShortName"
"A_LoopFileShortPath","commands/LoopFile.htm#LoopFileShortPath"
"A_LoopFileSize","commands/LoopFile.htm#LoopFileSize"
"A_LoopFileSizeKB","commands/LoopFile.htm#LoopFileSizeKB"
"A_LoopFileSizeMB","commands/LoopFile.htm#LoopFileSizeMB"
"A_LoopFileTimeAccessed","commands/LoopFile.htm#LoopFileTimeAccessed"
"A_LoopFileTimeCreated","commands/LoopFile.htm#LoopFileTimeCreated"
"A_LoopFileTimeModified","commands/LoopFile.htm#LoopFileTimeModified"
"A_LoopReadLine","commands/LoopReadFile.htm#LoopReadLine"
"A_LoopRegKey","commands/LoopReg.htm#vars"
"A_LoopRegName","commands/LoopReg.htm#vars"
"A_LoopRegSubKey","commands/LoopReg.htm#vars"
"A_LoopRegTimeModified","commands/LoopReg.htm#vars"
"A_LoopRegType","commands/LoopReg.htm#vars"
"A_MDay","Variables.htm#DD"
"A_Min","Variables.htm#Min"
"A_MM","Variables.htm#MM"
"A_MMM","Variables.htm#MMM"
"A_MMMM","Variables.htm#MMMM"
"A_Mon","Variables.htm#MM"
"A_MouseDelay","Variables.htm#MouseDelay"
"A_MouseDelayPlay","Variables.htm#MouseDelay"
"A_MSec","Variables.htm#MSec"
"A_MyDocuments","Variables.htm#MyDocuments"
"A_Now","Variables.htm#Now"
"A_NowUTC","Variables.htm#NowUTC"
"A_NumBatchLines","Variables.htm#BatchLines"
"A_OSType","Variables.htm#OSType"
"A_OSVersion","Variables.htm#OSVersion"
"A_PriorHotkey","Variables.htm#PriorHotkey"
"A_PriorKey","Variables.htm#PriorKey"
"A_ProgramFiles","Variables.htm#ProgramFiles"
"A_Programs","Variables.htm#Programs"
"A_ProgramsCommon","Variables.htm#ProgramsCommon"
"A_PtrSize","Variables.htm#PtrSize"
"A_RegView","Variables.htm#RegView"
"A_ScreenDPI","Variables.htm#ScreenDPI"
"A_ScreenHeight","Variables.htm#Screen"
"A_ScreenWidth","Variables.htm#Screen"
"A_ScriptDir","Variables.htm#ScriptDir"
"A_ScriptFullPath","Variables.htm#ScriptFullPath"
"A_ScriptHwnd","Variables.htm#ScriptHwnd"
"A_ScriptName","Variables.htm#ScriptName"
"A_Sec","Variables.htm#Sec"
"A_SendLevel","Variables.htm#SendLevel"
"A_SendMode","Variables.htm#SendMode"
"A_Space","Variables.htm#Space"
"A_StartMenu","Variables.htm#StartMenu"
"A_StartMenuCommon","Variables.htm#StartMenuCommon"
"A_Startup","Variables.htm#Startup"
"A_StartupCommon","Variables.htm#StartupCommon"
"A_StoreCapslockMode","Variables.htm#StoreCapslockMode"
"A_StringCaseSense","Variables.htm#StringCaseSense"
"A_Tab","Variables.htm#Tab"
"A_Temp","Variables.htm#Temp"
"A_ThisFunc","Variables.htm#ThisFunc"
"A_ThisHotkey","Variables.htm#ThisHotkey"
"A_ThisLabel","Variables.htm#ThisLabel"
"A_ThisMenu","Variables.htm#ThisMenu"
"A_ThisMenuItem","Variables.htm#ThisMenuItem"
"A_ThisMenuItemPos","Variables.htm#ThisMenuItemPos"
"A_TickCount","Variables.htm#TickCount"
"A_TimeIdle","Variables.htm#TimeIdle"
"A_TimeIdlePhysical","Variables.htm#TimeIdlePhysical"
"A_TimeSincePriorHotkey","Variables.htm#TimeSincePriorHotkey"
"A_TimeSinceThisHotkey","Variables.htm#TimeSinceThisHotkey"
"A_TitleMatchMode","Variables.htm#TitleMatchMode"
"A_TitleMatchModeSpeed","Variables.htm#TitleMatchModeSpeed"
"A_UserName","Variables.htm#UserName"
"A_WDay","Variables.htm#WDay"
"A_WinDelay","Variables.htm#WinDelay"
"A_WinDir","Variables.htm#WinDir"
"A_WorkingDir","Variables.htm#WorkingDir"
"A_YDay","Variables.htm#YDay"
"A_Year","Variables.htm#YYYY"
"A_YWeek","Variables.htm#YWeek"
"A_YYYY","Variables.htm#YYYY"
"abbreviation expansion","Hotstrings.htm"
"Abs()","Functions.htm#Abs"
"absolute value, abs()","Functions.htm#Abs"
"Acknowledgements","misc/Acknowledgements.htm"
"ACos()","Functions.htm#ACos"
"activate a window","commands/WinActivate.htm"
"ActiveX controls (GUI)","commands/GuiControls.htm#ActiveX"
"add","commands/EnvAdd.htm"
"Address of a variable","Variables.htm#amp"
"administrator privileges for scripts","Variables.htm#RequireAdmin"
"ahk2exe","Scripts.htm#ahk2exe"
"ahk_class","misc/WinTitle.htm#ahk_class"
"ahk_exe","misc/WinTitle.htm#ahk_exe"
"ahk_group","misc/WinTitle.htm#ahk_group"
"ahk_id","misc/WinTitle.htm#ahk_id"
"ahk_pid","misc/WinTitle.htm#ahk_pid"
"AllowSameLineComments","commands/_AllowSameLineComments.htm"
"alnum","commands/IfIs.htm"
"alpha","commands/IfIs.htm"
"AltGr","Hotkeys.htm#AltGr"
"AltTab","Hotkeys.htm#alttab"
"AlwaysOnTop (WinSet)","commands/WinSet.htm"
"append to file","commands/FileAppend.htm"
"Arrays","misc/Arrays.htm"
"Asc()","Functions.htm#Asc"
"ASCII conversion","commands/Transform.htm"
"ASin()","Functions.htm#ASin"
"assigning values to variables","Variables.htm#AssignOp"
"ATan()","Functions.htm#ATan"
"attributes of files and folders","commands/FileGetAttrib.htm"
"auto-execute section","Scripts.htm"
"auto-replace text as you type it","Hotstrings.htm"
"AutoIt v2 compatibility","misc/AutoIt2Compat.htm"
"AutoTrim","commands/AutoTrim.htm"
"balloon tip","commands/TrayTip.htm"
"base (Objects)","Objects.htm#Custom_Objects"
"beep the PC speaker","commands/SoundBeep.htm"
"between (check if var between two values)","commands/IfBetween.htm"
"Bind method (Func object)","objects/Func.htm#Bind"
"bitwise operations","Variables.htm#bitwise"
"blind-mode Send","commands/Send.htm#blind"
"BlockInput","commands/BlockInput.htm"
"blocks (lines enclosed in braces)","commands/Block.htm"
"BoundFunc object","objects/Functor.htm#BoundFunc"
"Break","commands/Break.htm"
"buffering","commands/_MaxThreadsBuffer.htm"
"built-in functions","Functions.htm#BuiltIn"
"built-in variables","Variables.htm#BuiltIn"
"Button controls (GUI)","commands/GuiControls.htm#Button"
"button list (mouse and joystick)","KeyList.htm"
"button state","commands/GetKeyState.htm"
"ByRef","Functions.htm#ByRef"
"Call method (Func object)","objects/Func.htm#Call"
"callbacks","commands/RegisterCallback.htm"
"case sensitive strings","commands/StringCaseSense.htm"
"Catch","commands/Catch.htm"
"Ceil()","Functions.htm#Ceil"
"Changelog","AHKL_ChangeLog.htm"
"Checkbox controls (GUI)","commands/GuiControls.htm#Checkbox"
"choose file","commands/FileSelectFile.htm"
"choose folder","commands/FileSelectFolder.htm"
"Chr()","Functions.htm#Chr"
"class (Objects)","Objects.htm#Custom_Classes"
"class name of a window","commands/WinGetClass.htm"
"Click a mouse button","commands/Click.htm"
"Clipboard","misc/Clipboard.htm"
"ClipboardAll","misc/Clipboard.htm#ClipboardAll"
"ClipWait","commands/ClipWait.htm"
"Clone method (Object)","objects/Object.htm#Clone"
"close a window","commands/WinClose.htm"
"CLSID List (My Computer, etc.)","misc/CLSID-List.htm"
"color names, RGB/HTML","commands/Progress.htm#colors"
"color of pixels","commands/PixelSearch.htm"
"COM","commands/ComObjCreate.htm"
"ComboBox controls (GUI)","commands/GuiControls.htm#ComboBox"
"comma operator (multi-statement)","Variables.htm#comma"
"command line parameters","Scripts.htm#cmd"
"commands, alphabetical list","commands/index.htm"
"CommentFlag","commands/_CommentFlag.htm"
"comments in scripts","Scripts.htm#Comments"
"ComObj...()","commands/ComObjActive.htm"
"ComObjActive()","commands/ComObjActive.htm"
"ComObjArray()","commands/ComObjArray.htm"
"ComObjConnect()","commands/ComObjConnect.htm"
"ComObjCreate()","commands/ComObjCreate.htm"
"ComObjError()","commands/ComObjError.htm"
"ComObjFlags()","commands/ComObjFlags.htm"
"ComObjGet()","commands/ComObjGet.htm"
"ComObjQuery()","commands/ComObjQuery.htm"
"ComObjType()","commands/ComObjType.htm"
"ComObjValue()","commands/ComObjValue.htm"
"Compatibility","Compat.htm"
"compile a script","Scripts.htm#ahk2exe"
"ComSpec","Variables.htm#ComSpec"
"concatenate, in expressions","Variables.htm#concat"
"concatenate, script lines","Scripts.htm#continuation"
"context menu (GUI)","commands/Gui.htm#GuiContextMenu"
"continuation sections","Scripts.htm#continuation"
"Continue","commands/Continue.htm"
"Control","commands/Control.htm"
"ControlClick","commands/ControlClick.htm"
"ControlFocus","commands/ControlFocus.htm"
"ControlGet","commands/ControlGet.htm"
"ControlGetFocus","commands/ControlGetFocus.htm"
"ControlGetPos","commands/ControlGetPos.htm"
"ControlGetText","commands/ControlGetText.htm"
"ControlMove","commands/ControlMove.htm"
"ControlSend","commands/ControlSend.htm"
"ControlSendRaw","commands/ControlSend.htm"
"ControlSetText","commands/ControlSetText.htm"
"convert a script to an EXE","Scripts.htm#ahk2exe"
"coordinates","commands/CoordMode.htm"
"CoordMode","commands/CoordMode.htm"
"copy file","commands/FileCopy.htm"
"copy folder/directory","commands/FileCopyDir.htm"
"Cos()","Functions.htm#Cos"
"create file","commands/FileAppend.htm"
"create folder/directory","commands/FileCreateDir.htm"
"Critical","commands/Critical.htm"
"current directory","commands/SetWorkingDir.htm"
"current thread","misc/Threads.htm"
"cursor shape","Variables.htm#Cursor"
"custom combination hotkeys","Hotkeys.htm#Features"
"Custom controls (GUI)","commands/GuiControls.htm#Custom"
"dates and times (compare)","commands/EnvSub.htm"
"dates and times (math)","commands/EnvAdd.htm"
"dates and times (of files)","commands/FileSetTime.htm"
"DateTime controls (GUI)","commands/GuiControls.htm#DateTime"
"debugger","commands/OutputDebug.htm"
"debugging a script","Scripts.htm#debug"
"decimal places","commands/SetFormat.htm"
"delete files","commands/FileDelete.htm"
"delete folder/directory","commands/FileRemoveDir.htm"
"Delete method (Object)","objects/Object.htm#Delete"
"Delimiter","commands/_EscapeChar.htm"
"DerefChar","commands/_EscapeChar.htm"
"DetectHiddenText","commands/DetectHiddenText.htm"
"DetectHiddenWindows","commands/DetectHiddenWindows.htm"
"dialog FileSelectFile","commands/FileSelectFile.htm"
"dialog FileSelectFolder","commands/FileSelectFolder.htm"
"dialog InputBox","commands/InputBox.htm"
"dialog MsgBox","commands/MsgBox.htm"
"digit","commands/IfIs.htm"
"disk space","commands/DriveSpaceFree.htm"
"divide (math)","Variables.htm#divide"
"DllCall()","commands/DllCall.htm"
"download a file","commands/URLDownloadToFile.htm"
"DPI scaling","commands/Gui.htm#DPIScale"
"drag and drop (GUI windows)","commands/Gui.htm#GuiDropFiles"
"drag the mouse","commands/MouseClickDrag.htm"
"Drive","commands/Drive.htm"
"DriveGet","commands/DriveGet.htm"
"DriveSpaceFree","commands/DriveSpaceFree.htm"
"DropDownList controls (GUI)","commands/GuiControls.htm#DropDownList"
"Dynamic function calls","Functions.htm#DynCall"
"Edit","commands/Edit.htm"
"Edit controls (GUI)","commands/GuiControls.htm#Edit"
"Else","commands/Else.htm"
"Enumerator object","objects/Enumerator.htm"
"EnvAdd","commands/EnvAdd.htm"
"EnvDiv","commands/EnvDiv.htm"
"EnvGet","commands/EnvGet.htm"
"environment variables","Variables.htm#env"
"environment variables (change them)","commands/EnvSet.htm"
"EnvMult","commands/EnvMult.htm"
"EnvSet","commands/EnvSet.htm"
"EnvSub","commands/EnvSub.htm"
"EnvUpdate","commands/EnvUpdate.htm"
"ErrorLevel","misc/ErrorLevel.htm"
"ErrorStdOut","commands/_ErrorStdOut.htm"
"escape sequence","commands/_EscapeChar.htm"
"EscapeChar","commands/_EscapeChar.htm"
"Exception()","commands/Throw.htm#Exception"
"Exit","commands/Exit.htm"
"ExitApp","commands/ExitApp.htm"
"Exp()","Functions.htm#Exp"
"expressions","Variables.htm#Expressions"
"ExtractInteger -> NumGet()","commands/NumGet.htm"
"False","Variables.htm#Boolean"
"FAQ (Frequently Asked Questions)","FAQ.htm"
"file attributes","commands/FileSetAttrib.htm"
"File object","objects/File.htm"
"file or folder (does it exist)","commands/IfExist.htm"
"file pattern","commands/LoopFile.htm"
"file, creating","commands/FileAppend.htm"
"file, reading","commands/LoopReadFile.htm"
"file, writing/appending","commands/FileAppend.htm"
"FileAppend","commands/FileAppend.htm"
"FileCopy","commands/FileCopy.htm"
"FileCopyDir","commands/FileCopyDir.htm"
"FileCreateDir","commands/FileCreateDir.htm"
"FileCreateShortcut","commands/FileCreateShortcut.htm"
"FileDelete","commands/FileDelete.htm"
"FileEncoding","commands/FileEncoding.htm"
"FileExist()","Functions.htm#FileExist"
"FileGetAttrib","commands/FileGetAttrib.htm"
"FileGetShortcut","commands/FileGetShortcut.htm"
"FileGetSize","commands/FileGetSize.htm"
"FileGetTime","commands/FileGetTime.htm"
"FileGetVersion","commands/FileGetVersion.htm"
"FileInstall","commands/FileInstall.htm"
"FileMove","commands/FileMove.htm"
"FileMoveDir","commands/FileMoveDir.htm"
"FileOpen","commands/FileOpen.htm"
"FileRead","commands/FileRead.htm"
"FileReadLine","commands/FileReadLine.htm"
"FileRecycle","commands/FileRecycle.htm"
"FileRecycleEmpty","commands/FileRecycleEmpty.htm"
"FileRemoveDir","commands/FileRemoveDir.htm"
"FileSelectFile","commands/FileSelectFile.htm"
"FileSelectFolder","commands/FileSelectFolder.htm"
"FileSetAttrib","commands/FileSetAttrib.htm"
"FileSetTime","commands/FileSetTime.htm"
"Finally","commands/Finally.htm"
"find a file","commands/IfExist.htm"
"find a string","commands/StringGetPos.htm"
"find a window","commands/WinExist.htm"
"floating point (check if it is one)","commands/IfIs.htm"
"floating point (SetFormat)","commands/SetFormat.htm"
"Floor()","Functions.htm#Floor"
"focus","commands/ControlFocus.htm"
"folder/directory copy","commands/FileCopyDir.htm"
"folder/directory create","commands/FileCreateDir.htm"
"folder/directory move","commands/FileMoveDir.htm"
"folder/directory remove","commands/FileRemoveDir.htm"
"folder/directory select","commands/FileSelectFolder.htm"
"Fonts","misc/FontsStandard.htm"
"For-loop","commands/For.htm"
"Format()","commands/Format.htm"
"format (defaults)","commands/SetFormat.htm"
"FormatTime","commands/FormatTime.htm"
"free space","commands/DriveSpaceFree.htm"
"FTP uploading example","commands/FileAppend.htm#FTP"
"functions (defining and calling)","Functions.htm"
"functions (libraries)","Functions.htm#lib"
"Func object","objects/Func.htm"
"Func()","Objects.htm#Function_References"
"g-label (responding to GUI events)","commands/Gui.htm#label"
"game automation","commands/PixelSearch.htm"
"GetAddress method (Object)","objects/Object.htm#GetAddress"
"GetCapacity method (Object)","objects/Object.htm#GetCapacity"
"GetKeyName()","Functions.htm#GetKeyName"
"GetKeySC()","Functions.htm#GetKeyName"
"GetKeyState","commands/GetKeyState.htm"
"GetKeyState()","Functions.htm#GetKeyState"
"GetKeyVK()","Functions.htm#GetKeyName"
"global variables in functions","Functions.htm#Global"
"Gosub","commands/Gosub.htm"
"Goto","commands/Goto.htm"
"GroupActivate","commands/GroupActivate.htm"
"GroupAdd","commands/GroupAdd.htm"
"GroupBox controls (GUI)","commands/GuiControls.htm#GroupBox"
"GroupClose","commands/GroupClose.htm"
"GroupDeactivate","commands/GroupDeactivate.htm"
"Gui","commands/Gui.htm"
"Gui control types","commands/GuiControls.htm"
"Gui styles reference","misc/Styles.htm"
"GuiClose (label)","commands/Gui.htm#GuiClose"
"GuiContextMenu (label)","commands/Gui.htm#GuiContextMenu"
"GuiControl","commands/GuiControl.htm"
"GuiControlGet","commands/GuiControlGet.htm"
"GuiDropFiles (label)","commands/Gui.htm#GuiDropFiles"
"GuiEscape (label)","commands/Gui.htm#GuiEscape"
"GuiSize (label)","commands/Gui.htm#GuiSize"
"HasKey method (Object)","objects/Object.htm#HasKey"
"HBITMAP:","misc/ImageHandles.htm"
"hexadecimal format","commands/SetFormat.htm"
"hibernate or suspend","commands/Shutdown.htm#Suspend"
"HICON:","misc/ImageHandles.htm"
"hidden text","commands/DetectHiddenText.htm"
"hidden windows","commands/DetectHiddenWindows.htm"
"HKEY_CLASSES_ROOT","commands/RegRead.htm"
"HKEY_CURRENT_CONFIG","commands/RegRead.htm"
"HKEY_CURRENT_USER","commands/RegRead.htm"
"HKEY_LOCAL_MACHINE","commands/RegRead.htm"
"HKEY_USERS","commands/RegRead.htm"
"hook","commands/_InstallKeybdHook.htm"
"Hotkey","Hotkeys.htm"
"Hotkey command","commands/Hotkey.htm"
"Hotkey controls (GUI)","commands/GuiControls.htm#Hotkey"
"Hotkey, ListHotkeys","commands/ListHotkeys.htm"
"Hotkey, other features","HotkeyFeatures.htm"
"HotkeyInterval","commands/_HotkeyInterval.htm"
"HotkeyModifierTimeout","commands/_HotkeyModifierTimeout.htm"
"hotstrings and auto-replace","Hotstrings.htm"
"HTML color names","commands/Progress.htm#colors"
"HWND (of a control)","commands/ControlGet.htm#Hwnd"
"HWND (of a window)","misc/WinTitle.htm#ahk_id"
"icon, changing","commands/Menu.htm#Icon"
"ID number for a window","commands/WinGet.htm"
"If","commands/IfEqual.htm"
"If (expression)","commands/IfExpression.htm"
"If var not between Low and High","commands/IfBetween.htm"
"If var not in/contains MatchList","commands/IfIn.htm"
"If var is not type","commands/IfIs.htm"
"IfEqual","commands/IfEqual.htm"
"IfExist","commands/IfExist.htm"
"IfGreater","commands/IfEqual.htm"
"IfGreaterOrEqual","commands/IfEqual.htm"
"IfInString","commands/IfInString.htm"
"IfLess","commands/IfEqual.htm"
"IfLessOrEqual","commands/IfEqual.htm"
"IfMsgBox","commands/IfMsgBox.htm"
"IfNotEqual","commands/IfEqual.htm"
"IfNotExist","commands/IfExist.htm"
"IfNotInString","commands/IfInString.htm"
"IfWinActive","commands/WinActive.htm"
"IfWinExist","commands/WinExist.htm"
"IfWinNotActive","commands/WinActive.htm"
"IfWinNotExist","commands/WinExist.htm"
"IL_Add()","commands/ListView.htm#IL_Add"
"IL_Create()","commands/ListView.htm#IL_Create"
"IL_Destroy()","commands/ListView.htm#IL_Destroy"
"Image Lists (GUI)","commands/ListView.htm#IL"
"ImageSearch","commands/ImageSearch.htm"
"Include","commands/_Include.htm"
"infrared remote controls","scripts/WinLIRC.htm"
"IniDelete","commands/IniDelete.htm"
"IniRead","commands/IniRead.htm"
"IniWrite","commands/IniWrite.htm"
"Input","commands/Input.htm"
"InputBox","commands/InputBox.htm"
"Insert method (Object)","objects/Object.htm#Insert"
"InsertAt method (Object)","objects/Object.htm#InsertAt"
"InsertInteger -> NumPut()","commands/NumPut.htm"
"Install","commands/FileInstall.htm"
"Installer Options","Scripts.htm#install"
"InstallKeybdHook","commands/_InstallKeybdHook.htm"
"InstallMouseHook","commands/_InstallMouseHook.htm"
"InStr()","commands/InStr.htm"
"integer (check if it is one)","commands/IfIs.htm"
"integer (SetFormat)","commands/SetFormat.htm"
"Interrupt","commands/Thread.htm"
"IsByRef()","Functions.htm#IsByRef"
"IsFunc()","Functions.htm#IsFunc"
"IsLabel()","Functions.htm#IsLabel"
"IsObject()","Objects.htm"
"Join (continuation sections)","Scripts.htm#Join"
"Joystick","KeyList.htm#Joystick"
"JScript, embedded/inline","commands/DllCall.htm#COM"
"key list (keyboard, mouse, joystick)","KeyList.htm"
"key state","commands/GetKeyState.htm"
"keyboard hook","commands/_InstallKeybdHook.htm"
"KeyHistory","commands/KeyHistory.htm"
"keystrokes, sending","commands/Send.htm"
"KeyWait","commands/KeyWait.htm"
"labels","misc/Labels.htm"
"last found window","misc/WinTitle.htm#LastFoundWindow"
"length of a string","commands/StringLen.htm"
"Length method (Object)","objects/Object.htm#Length"
"Length method (File object)","objects/File.htm#Length"
"libraries of functions","Functions.htm#lib"
"license","license.htm"
"line continuation","Scripts.htm#continuation"
"ListBox controls (GUI)","commands/GuiControls.htm#ListBox"
"ListHotkeys","commands/ListHotkeys.htm"
"ListLines","commands/ListLines.htm"
"ListVars","commands/ListVars.htm"
"ListView controls (GUI)","commands/ListView.htm"
"ListView, getting text from","commands/ControlGet.htm#List"
"Ln()","Functions.htm#Ln"
"lnk (link/shortcut) file","commands/FileCreateShortcut.htm"
"LoadPicture","commands/LoadPicture.htm"
"local variables","Functions.htm#Locals"
"Locale","commands/StringCaseSense.htm#Locale"
"Log()","Functions.htm#Log"
"logarithm, log()","Functions.htm#Log"
"logoff","commands/Shutdown.htm"
"long file name (converting to)","commands/LoopFile.htm#LoopFileLongPath"
"Loop","commands/Loop.htm"
"Loop (until)","commands/Until.htm"
"Loop (while)","commands/While.htm"
"Loop, Reg (registry)","commands/LoopReg.htm"
"Loop, Files and folders","commands/LoopFile.htm"
"Loop, Parse a string","commands/LoopParse.htm"
"Loop, Read file contents","commands/LoopReadFile.htm"
"lParam","commands/PostMessage.htm"
"LTrim (continuation sections)","Scripts.htm#LTrim"
"LTrim()","commands/Trim.htm"
"LV_Add()","commands/ListView.htm#LV_Add"
"LV_Delete()","commands/ListView.htm#LV_Delete"
"LV_DeleteCol()","commands/ListView.htm#LV_DeleteCol"
"LV_GetCount()","commands/ListView.htm#LV_GetCount"
"LV_GetNext()","commands/ListView.htm#LV_GetNext"
"LV_GetText()","commands/ListView.htm#LV_GetText"
"LV_Insert()","commands/ListView.htm#LV_Insert"
"LV_InsertCol()","commands/ListView.htm#LV_InsertCol"
"LV_Modify()","commands/ListView.htm#LV_Modify"
"LV_ModifyCol()","commands/ListView.htm#LV_ModifyCol"
"LV_SetImageList()","commands/ListView.htm#LV_SetImageList"
"macro","misc/Macros.htm"
"math operations (expressions)","Variables.htm#Expressions"
"MaxHotkeysPerInterval","commands/_MaxHotkeysPerInterval.htm"
"MaxIndex()","objects/Object.htm#MinMaxIndex"
"MaxThreads","commands/_MaxThreads.htm"
"MaxThreadsBuffer","commands/_MaxThreadsBuffer.htm"
"MaxThreadsPerHotkey","commands/_MaxThreadsPerHotkey.htm"
"Menu","commands/Menu.htm"
"MenuGetHandle","commands/MenuGetHandle.htm"
"MenuGetName","commands/MenuGetName.htm"
"Menu Bar (GUI)","commands/Gui.htm#Menu"
"Menu Icon","commands/Menu.htm#MenuIcon"
"message list (WM_*)","misc/SendMessageList.htm"
"messages, receiving","commands/OnMessage.htm"
"messages, sending","commands/PostMessage.htm"
"meta-functions (Objects)","Objects.htm#Meta_Functions"
"MinIndex()","objects/Object.htm#MinMaxIndex"
"Mod()","Functions.htm#Mod"
"modal (always on top)","commands/MsgBox.htm"
"modulo, mod()","Functions.htm#Mod"
"MonthCal controls (GUI)","commands/GuiControls.htm#MonthCal"
"mouse hook","commands/_InstallMouseHook.htm"
"mouse speed","commands/SetDefaultMouseSpeed.htm"
"mouse wheel","commands/Click.htm"
"MouseClick","commands/MouseClick.htm"
"MouseClickDrag","commands/MouseClickDrag.htm"
"MouseGetPos","commands/MouseGetPos.htm"
"MouseMove","commands/MouseMove.htm"
"move a window","commands/WinMove.htm"
"move file","commands/FileMove.htm"
"move folder/directory","commands/FileMoveDir.htm"
"MsgBox","commands/MsgBox.htm"
"multiply","commands/EnvMult.htm"
"mute (changing it)","commands/SoundSet.htm"
"NewEnum method (Object)","objects/Object.htm#NewEnum"
"NoTimers","commands/Thread.htm"
"NoTrayIcon","commands/_NoTrayIcon.htm"
"number","commands/IfIs.htm"
"number format","commands/SetFormat.htm"
"NumGet","commands/NumGet.htm"
"NumPut","commands/NumPut.htm"
"Objects (general information)","Objects.htm"
"Object functions and methods","objects/Object.htm"
"ObjAddRef()","commands/ObjAddRef.htm"
"ObjBindMethod()","commands/ObjBindMethod.htm"
"ObjClone()","objects/Object.htm#Clone"
"ObjDelete()","objects/Object.htm#Delete"
"ObjGetAddress()","objects/Object.htm#GetAddress"
"ObjGetCapacity()","objects/Object.htm#GetCapacity"
"ObjHasKey()","objects/Object.htm#HasKey"
"ObjInsert()","objects/Object.htm#Insert"
"ObjInsertAt()","objects/Object.htm#InsertAt"
"ObjLength()","objects/Object.htm#Length"
"ObjMaxIndex()","objects/Object.htm#MinMaxIndex"
"ObjMinIndex()","objects/Object.htm#MinMaxIndex"
"ObjNewEnum()","objects/Object.htm#NewEnum"
"ObjPop()","objects/Object.htm#Pop"
"ObjPush()","objects/Object.htm#Push"
"ObjRawSet()","objects/Object.htm#RawSet"
"ObjRelease()","commands/ObjAddRef.htm"
"ObjRemove()","objects/Object.htm#Remove"
"ObjRemoveAt()","objects/Object.htm#RemoveAt"
"ObjSetCapacity()","objects/Object.htm#SetCapacity"
"OnClipboardChange","commands/OnClipboardChange.htm"
"OnExit","commands/OnExit.htm"
"OnMessage()","commands/OnMessage.htm"
"open file","commands/FileOpen.htm"
"operators in expressions","Variables.htm#Operators"
"Ord()","Functions.htm#Ord"
"OutputDebug","commands/OutputDebug.htm"
"OwnDialogs (GUI)","commands/Gui.htm#OwnDialogs"
"Owner of a GUI window","commands/Gui.htm#Owner"
"parameters passed into a script","Scripts.htm#cmd"
"parse a string (Loop)","commands/LoopParse.htm"
"parse a string (StringSplit)","commands/StringSplit.htm"
"Pause","commands/Pause.htm"
"performance of scripts","misc/Performance.htm"
"Picture controls (GUI)","commands/GuiControls.htm#Picture"
"PID (Process ID)","commands/Process.htm"
"PixelGetColor","commands/PixelGetColor.htm"
"PixelSearch","commands/PixelSearch.htm"
"play a sound or video file","commands/SoundPlay.htm"
"Pop method (Object)","objects/Object.htm#Pop"
"PostMessage","commands/PostMessage.htm"
"power (exponentiation)","Variables.htm#pow"
"prefix and suffix keys","Hotkeys.htm"
"print a file","commands/Run.htm"
"priority of a process","commands/Process.htm"
"priority of a thread","commands/Thread.htm"
"Process","commands/Process.htm"
"ProgramFiles","Variables.htm#ProgramFiles"
"Progress","commands/Progress.htm"
"Progress controls (GUI)","commands/GuiControls.htm#Progress"
"properties (Objects)","Objects.htm#Custom_Classes_property"
"properties of a file or folder","commands/Run.htm"
"Push method (Object)","objects/Object.htm#Push"
"quit script","commands/ExitApp.htm"
"Radio controls (GUI)","commands/GuiControls.htm#Radio"
"Random","commands/Random.htm"
"RawRead method (File object)","objects/File.htm#RawRead"
"RawWrite method (File object)","objects/File.htm#RawWrite"
"read file","commands/FileRead.htm"
"Read method (File object)","objects/File.htm#Read"
"READONLY","commands/FileGetAttrib.htm"
"reboot","commands/Shutdown.htm"
"Reference-Counting","Objects.htm#Refs"
"REG_BINARY","commands/RegRead.htm"
"REG_DWORD","commands/RegRead.htm"
"REG_EXPAND_SZ","commands/RegRead.htm"
"REG_MULTI_SZ","commands/RegRead.htm"
"REG_SZ","commands/RegRead.htm"
"RegDelete","commands/RegDelete.htm"
"RegEx: Quick Reference","misc/RegEx-QuickRef.htm"
"RegEx: Callouts","misc/RegExCallout.htm"
"RegEx: SetTitleMatchMode RegEx","commands/SetTitleMatchMode.htm#RegEx"
"RegExMatch()","commands/RegExMatch.htm"
"RegExReplace()","commands/RegExReplace.htm"
"RegisterCallback()","commands/RegisterCallback.htm"
"registry loop","commands/LoopReg.htm"
"RegRead","commands/RegRead.htm"
"Regular Expression Callouts","misc/RegExCallout.htm"
"regular expressions: Quick Reference","misc/RegEx-QuickRef.htm"
"regular expressions: RegExMatch()","commands/RegExMatch.htm"
"regular expressions: RegExReplace()","commands/RegExReplace.htm"
"regular expressions: SetTitleMatchMode RegEx","commands/SetTitleMatchMode.htm#RegEx"
"RegWrite","commands/RegWrite.htm"
"Reload","commands/Reload.htm"
"remap joystick","misc/RemapJoystick.htm"
"remap keys or mouse buttons","misc/Remap.htm"
"remote controls, hand-held","scripts/WinLIRC.htm"
"remove folder/directory","commands/FileRemoveDir.htm"
"Remove method (Object)","objects/Object.htm#Remove"
"RemoveAt method (Object)","objects/Object.htm#RemoveAt"
"rename file","commands/FileMove.htm"
"resize a window","commands/WinMove.htm"
"restart the computer","commands/Shutdown.htm"
"Return","commands/Return.htm"
"RGB color names","commands/Progress.htm#colors"
"RGB colors","commands/PixelGetColor.htm"
"Round()","Functions.htm#Round"
"rounding a number","Functions.htm#Round"
"RTrim()","commands/Trim.htm"
"Run","commands/Run.htm"
"RunAs","commands/RunAs.htm"
"RunWait","commands/Run.htm"
"SB_SetIcon()","commands/GuiControls.htm#SB_SetIcon"
"SB_SetParts()","commands/GuiControls.htm#SB_SetParts"
"SB_SetText()","commands/GuiControls.htm#SB_SetText"
"scan code","commands/Send.htm#vk"
"scientific notation","commands/SetFormat.htm#sci"
"Script Showcase","scripts/index.htm"
"Scripts","Scripts.htm"
"select file","commands/FileSelectFile.htm"
"select folder","commands/FileSelectFolder.htm"
"Send","commands/Send.htm"
"SendEvent","commands/Send.htm#SendEvent"
"sending data between scripts","commands/OnMessage.htm#SendString"
"SendInput","commands/Send.htm#SendInputDetail"
"SendLevel","commands/SendLevel.htm"
"SendMessage","commands/PostMessage.htm"
"SendMode","commands/SendMode.htm"
"SendPlay","commands/Send.htm#SendPlayDetail"
"SendRaw","commands/Send.htm"
"SetBatchLines","commands/SetBatchLines.htm"
"SetCapacity method (Object)","objects/Object.htm#SetCapacity"
"SetCapsLockState","commands/SetNumScrollCapsLockState.htm"
"SetControlDelay","commands/SetControlDelay.htm"
"SetDefaultMouseSpeed","commands/SetDefaultMouseSpeed.htm"
"SetEnv","commands/SetEnv.htm"
"SetFormat","commands/SetFormat.htm"
"SetKeyDelay","commands/SetKeyDelay.htm"
"SetMouseDelay","commands/SetMouseDelay.htm"
"SetNumLockState","commands/SetNumScrollCapsLockState.htm"
"SetRegView","commands/SetRegView.htm"
"SetScrollLockState","commands/SetNumScrollCapsLockState.htm"
"SetStoreCapslockMode","commands/SetStoreCapslockMode.htm"
"SetTimer","commands/SetTimer.htm"
"SetTitleMatchMode","commands/SetTitleMatchMode.htm"
"SetWinDelay","commands/SetWinDelay.htm"
"SetWorkingDir","commands/SetWorkingDir.htm"
"short file name (8.3 format)","commands/LoopFile.htm#LoopFileShortPath"
"short-circuit boolean evaluation","Functions.htm#ShortCircuit"
"shortcut file","commands/FileCreateShortcut.htm"
"Shutdown","commands/Shutdown.htm"
"Silent Install/Uninstall","Scripts.htm#install"
"Sin()","Functions.htm#Sin"
"SingleInstance","commands/_SingleInstance.htm"
"size of a file/folder","commands/FileGetSize.htm"
"size of a window","commands/WinGetPos.htm"
"Sleep","commands/Sleep.htm"
"Slider controls (GUI)","commands/GuiControls.htm#Slider"
"Sort","commands/Sort.htm"
"SoundBeep","commands/SoundBeep.htm"
"SoundGet","commands/SoundGet.htm"
"SoundGetWaveVolume","commands/SoundGetWaveVolume.htm"
"SoundPlay","commands/SoundPlay.htm"
"SoundSet","commands/SoundSet.htm"
"SoundSetWaveVolume","commands/SoundSetWaveVolume.htm"
"space","commands/IfIs.htm"
"speed of a script","commands/SetBatchLines.htm"
"spinner control (GUI)","commands/GuiControls.htm#UpDown"
"SplashImage","commands/Progress.htm"
"SplashTextOff","commands/SplashTextOn.htm"
"SplashTextOn","commands/SplashTextOn.htm"
"SplitPath","commands/SplitPath.htm"
"splitting long lines","Scripts.htm#continuation"
"Sqrt()","Functions.htm#Sqrt"
"standard library","Functions.htm#lib"
"standard output (stdout)","commands/FileAppend.htm"
"static variables","Functions.htm#static"
"StatusBar controls (GUI)","commands/GuiControls.htm#StatusBar"
"StatusBarGetText","commands/StatusBarGetText.htm"
"StatusBarWait","commands/StatusBarWait.htm"
"StrGet()","commands/StrPutGet.htm"
"string (search for)","commands/InStr.htm"
"string: InStr()","commands/InStr.htm"
"string: SubStr()","commands/SubStr.htm"
"StringCaseSense","commands/StringCaseSense.htm"
"StringGetPos","commands/StringGetPos.htm"
"StringLeft","commands/StringLeft.htm"
"StringLen","commands/StringLen.htm"
"StringLower","commands/StringLower.htm"
"StringMid","commands/StringMid.htm"
"StringReplace","commands/StringReplace.htm"
"StringRight","commands/StringLeft.htm"
"StringSplit","commands/StringSplit.htm"
"StringTrimLeft","commands/StringTrimLeft.htm"
"StringTrimRight","commands/StringTrimLeft.htm"
"StringUpper","commands/StringLower.htm"
"StrLen()","commands/StringLen.htm"
"StrPut()","commands/StrPutGet.htm"
"StrReplace()","commands/StringReplace.htm"
"StrSplit()","commands/StringSplit.htm"
"structures, via DllCall","commands/DllCall.htm#struct"
"styles for GUI command","misc/Styles.htm"
"SubStr()","commands/SubStr.htm"
"subtract","commands/EnvSub.htm"
"Super-global variables","Functions.htm#SuperGlobal"
"Suspend","commands/Suspend.htm"
"suspend or hibernate","commands/Shutdown.htm#Suspend"
"SysGet","commands/SysGet.htm"
"Tab controls (GUI)","commands/GuiControls.htm#Tab"
"Tan()","Functions.htm#Tan"
"terminate a window","commands/WinKill.htm"
"terminate script","commands/ExitApp.htm"
"ternary operator (?:)","Variables.htm#ternary"
"Text controls (GUI)","commands/GuiControls.htm#Text"
"Thread","commands/Thread.htm"
"threads","misc/Threads.htm"
"Throw","commands/Throw.htm"
"time","commands/IfIs.htm"
"Timer (timed subroutines)","commands/SetTimer.htm"
"times and dates (compare)","commands/EnvSub.htm"
"times and dates (math)","commands/EnvAdd.htm"
"times and dates (of files)","commands/FileSetTime.htm"
"title of a window","commands/WinSetTitle.htm"
"ToolTip","commands/ToolTip.htm"
"Transform","commands/Transform.htm"
"transparency of a window","commands/WinSet.htm#trans"
"tray icon","commands/_NoTrayIcon.htm"
"tray menu (customizing)","commands/Menu.htm"
"TrayTip","commands/TrayTip.htm"
"TreeView controls (GUI)","commands/TreeView.htm"
"Trim","commands/AutoTrim.htm"
"Trim()","commands/Trim.htm"
"True","Variables.htm#Boolean"
"Try","commands/Try.htm"
"Tutorial","Tutorial.htm"
"TV_Add()","commands/TreeView.htm#TV_Add"
"TV_Delete()","commands/TreeView.htm#TV_Delete"
"TV_Get()","commands/TreeView.htm#TV_Get"
"TV_GetChild()","commands/TreeView.htm#TV_GetChild"
"TV_GetCount()","commands/TreeView.htm#TV_GetCount"
"TV_GetNext()","commands/TreeView.htm#TV_GetNext"
"TV_GetParent()","commands/TreeView.htm#TV_GetParent"
"TV_GetPrev()","commands/TreeView.htm#TV_GetPrev"
"TV_GetSelection()","commands/TreeView.htm#TV_GetSelection"
"TV_GetText()","commands/TreeView.htm#TV_GetText"
"TV_Modify()","commands/TreeView.htm#TV_Modify"
"TV_SetImageList()","commands/TreeView.htm#TV_SetImageList"
"Unicode text and clipboard","commands/Transform.htm"
"Until","commands/Until.htm"
"UpDown controls (GUI)","commands/GuiControls.htm#UpDown"
"URLDownloadToFile","commands/URLDownloadToFile.htm"
"UseHook","commands/_UseHook.htm"
"user (run as a different user)","commands/RunAs.htm"
"user library","Functions.htm#lib"
"variables, assigning to","commands/SetEnv.htm"
"variables, built-in","Variables.htm#BuiltIn"
"variables, comparing them","commands/IfEqual.htm"
"variables, ListVars","commands/ListVars.htm"
"variables, MAIN","Variables.htm"
"variables, type of data","commands/IfIs.htm"
"variadic functions","Functions.htm#Variadic"
"variants (duplicate hotkeys and hotstrings)","commands/_IfWinActive.htm#variant"
"VarSetCapacity()","commands/VarSetCapacity.htm"
"VBScript, embedded/inline","commands/DllCall.htm#COM"
"version of a file","commands/FileGetVersion.htm"
"virtual key","commands/Send.htm#vk"
"volume (changing it)","commands/SoundSet.htm"
"wait (sleep)","commands/Sleep.htm"
"wait for a key to be released or pressed","commands/KeyWait.htm"
"Wheel hotkeys for mouse","Hotkeys.htm#Wheel"
"Wheel, simulating rotation","commands/Click.htm"
"While-loop","commands/While.htm"
"whitespace","commands/AutoTrim.htm"
"wildcards (for files & folders)","commands/LoopFile.htm"
"WinActivate","commands/WinActivate.htm"
"WinActivateBottom","commands/WinActivateBottom.htm"
"WinActivateForce","commands/_WinActivateForce.htm"
"WinActive()","commands/WinActive.htm"
"Winamp automation","misc/Winamp.htm"
"WinClose","commands/WinClose.htm"
"window group","misc/WinTitle.htm#ahk_group"
"window messages","misc/SendMessageList.htm"
"WinExist()","commands/WinExist.htm"
"WinGet","commands/WinGet.htm"
"WinGetActiveStats","commands/WinGetActiveStats.htm"
"WinGetActiveTitle","commands/WinGetActiveTitle.htm"
"WinGetClass","commands/WinGetClass.htm"
"WinGetPos","commands/WinGetPos.htm"
"WinGetText","commands/WinGetText.htm"
"WinGetTitle","commands/WinGetTitle.htm"
"WinHide","commands/WinHide.htm"
"WinKill","commands/WinKill.htm"
"WinLIRC, connecting to","scripts/WinLIRC.htm"
"WinMaximize","commands/WinMaximize.htm"
"WinMenuSelectItem","commands/WinMenuSelectItem.htm"
"WinMinimize","commands/WinMinimize.htm"
"WinMinimizeAll","commands/WinMinimizeAll.htm"
"WinMinimizeAllUndo","commands/WinMinimizeAll.htm"
"WinMove","commands/WinMove.htm"
"WinRestore","commands/WinRestore.htm"
"WinSet","commands/WinSet.htm"
"WinSetTitle","commands/WinSetTitle.htm"
"WinShow","commands/WinShow.htm"
"WinSize (via WinMove)","commands/WinMove.htm"
"WinTitle","misc/WinTitle.htm"
"WinWait","commands/WinWait.htm"
"WinWaitActive","commands/WinWaitActive.htm"
"WinWaitClose","commands/WinWaitClose.htm"
"WinWaitNotActive","commands/WinWaitActive.htm"
"WM_* (Windows messages)","misc/SendMessageList.htm"
"WM_COPYDATA","commands/OnMessage.htm#SendString"
"working directory","commands/SetWorkingDir.htm"
"wParam","commands/PostMessage.htm"
"write file","commands/FileAppend.htm"
"Write method (File object)","objects/File.htm#Write"
"WS_* (GUI styles)","misc/Styles.htm"
"XButton","commands/Click.htm"
"YYYYMMDDHH24MISS","commands/FileSetTime.htm#YYYYMMDD"
"{Blind}","commands/Send.htm#blind"
Then what you want to do when the user presses F1, is search if that text CONTAINS or matches the beginning of the keys in the array,
and if so, use Nextron's code to go to that value-url in the array. If no match is found, send the user to the docs homepage. Later, you could make that exception search the docs through google, for an extra feature.

This will have the complete "Index help" functionality like my script does, with much better performance, speed, reliability, clean-look, and it could be more easily made to work with jznizm's non-js activex control.
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: AHK Lookup Selection with Online Help Docs

19 May 2016, 09:53

Using the index instead of the command page does look like an improvement, as does the Google redirect on no results (both implemented below). To show the page in an embedded IE opposed to the default browser, only the two run commands would have to be replaced with a function that takes the URL as an argument and opens the gui.

Code: Select all

F1::
AutoHotkeyCommands(q:=""){
	static command
	url:="https://autohotkey.com/docs/"
 
	If (q="")	
		If !(q:=Trim(CtrlC()," `t`n`r"))
			Return
	If !(command){
		html:=UrlDownloadToVar(url "static/content.js"), command:={}, i:=1
		html:=RegExReplace(html,"s)(.*index = \[)(.*?)(\];.*)","$2")
		While i:=RegExMatch(html,"\[""([^""]*)"",""([^""]*)""]",s,i+1)
			command[s1]:=s2
	}
 
	If (v:=command[q]) || (v:=command[q "()"])
		t:=url v
	Else
		For k,v in command
			If InStr(k,q){
				t:=url v
				Break
			}
	If t
		Run % t	
	else
		Run http://www.google.com/cse?cx=010629462602499112316:ywoq_rufgic&q=%q%
Return
}
CtrlC(){
	WholeClipBoard:=ClipBoardAll
	ClipBoard =
	Send ^c
	ClipWait,.3
	str:=ClipBoard
	ClipBoard:=WholeClipBoard
	Return, str
}
UrlDownloadToVar(URL) {
 ComObjError(false)
 WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
 WebRequest.SetTimeouts(5000, 5000, 3000, 3000)
 WebRequest.Open("GET", URL)
 WebRequest.Send()
 Return WebRequest.ResponseText
}
gallaxhar
Posts: 143
Joined: 03 Sep 2014, 06:35

Re: AHK Lookup Selection with Online Help Docs

19 May 2016, 10:01

I would wrap that F1 hotkey in
#IfWinActive ahk_exe SciTE.exe
#IfWinActive
so you can still use F1 help in other program like autocad etc

otherwise that is a huge improvement, I'm going to link to that one in the OP since mine is useless now
coolykoen
Posts: 61
Joined: 01 Jun 2015, 06:10

Re: AHK Lookup Selection with Online Help Docs

19 May 2016, 14:48

Nextron wrote:Using the index instead of the command page does look like an improvement, as does the Google redirect on no results (both implemented below). To show the page in an embedded IE opposed to the default browser, only the two run commands would have to be replaced with a function that takes the URL as an argument and opens the gui.

Code: Select all

F1::
AutoHotkeyCommands(q:=""){
	static command
	url:="https://autohotkey.com/docs/"
 
	If (q="")	
		If !(q:=Trim(CtrlC()," `t`n`r"))
			Return
	If !(command){
		html:=UrlDownloadToVar(url "static/content.js"), command:={}, i:=1
		html:=RegExReplace(html,"s)(.*index = \[)(.*?)(\];.*)","$2")
		While i:=RegExMatch(html,"\[""([^""]*)"",""([^""]*)""]",s,i+1)
			command[s1]:=s2
	}
 
	If (v:=command[q]) || (v:=command[q "()"])
		t:=url v
	Else
		For k,v in command
			If InStr(k,q){
				t:=url v
				Break
			}
	If t
		Run % t	
	else
		Run http://www.google.com/cse?cx=010629462602499112316:ywoq_rufgic&q=%q%
Return
}
CtrlC(){
	WholeClipBoard:=ClipBoardAll
	ClipBoard =
	Send ^c
	ClipWait,.3
	str:=ClipBoard
	ClipBoard:=WholeClipBoard
	Return, str
}
UrlDownloadToVar(URL) {
 ComObjError(false)
 WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
 WebRequest.SetTimeouts(5000, 5000, 3000, 3000)
 WebRequest.Open("GET", URL)
 WebRequest.Send()
 Return WebRequest.ResponseText
}
so... i tried this:

Code: Select all

#SingleInstance Force
#IfWinActive ahk_exe SciTE.exe
F1::
AutoHotkeyCommands(q:=""){
	static command
	url:="https://autohotkey.com/docs/"
 
	If (q="")	
		If !(q:=Trim(CtrlC()," `t`n`r"))
			Return
	If !(command){
		html:=UrlDownloadToVar(url "static/content.js"), command:={}, i:=1
		html:=RegExReplace(html,"s)(.*index = \[)(.*?)(\];.*)","$2")
		While i:=RegExMatch(html,"\[""([^""]*)"",""([^""]*)""]",s,i+1)
			command[s1]:=s2
	}
 
	If (v:=command[q]) || (v:=command[q "()"])
		t:=url v
	Else
		For k,v in command
			If InStr(k,q){
				t:=url v
				Break
			}
	If t
	{
		Gui, Add, ActiveX, xm w980 h640 vWB, Shell.Explorer
		WB.Navigate("%t%") 
		Gui +resize
		Gui, Show
		return
	}
	else
	{
		Gui, Add, ActiveX, xm w980 h640 vWB, Shell.Explorer
		WB.Navigate("http://www.google.com/cse?cx=010629462602499112316:ywoq_rufgic&q=%q%") 
		Gui +resize
		Gui, Show
		return
	}
 
GuiClose:
ExitApp
Return
}
#IfWinActive
CtrlC(){
	WholeClipBoard:=ClipBoardAll
	ClipBoard =
	Send ^c
	ClipWait,.3
	str:=ClipBoard
	ClipBoard:=WholeClipBoard
	Return, str
}
UrlDownloadToVar(URL) {
 ComObjError(false)
 WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
 WebRequest.SetTimeouts(5000, 5000, 3000, 3000)
 WebRequest.Open("GET", URL)
 WebRequest.Send()
 Return WebRequest.ResponseText
}
but it gives an error upon pressing F1 saying:

Error: A control's variable must be global or static.

Specifically: vWB

Line#
022: if InStr(k,q)
022: {
023: t := url v
024: Break
025: }
026: if t
027: {
---> 028: Gui,Add,ActiveX,xm w980 h640 vWB,Shell.Explorer
029: WB.Navigate("%t%")
030: Gui,+resize
031: Gui,Show
032: Return
033: }
034: Else
035: {

The current thread will exit.


Is there anyway to do this?

EDIT:
the next problem that i found is that even if it somehow opens the gui with a browser control.....
it seems like putting %t% in line 29 won't work so this code doesnt work anyway:

Code: Select all

WB.Navigate("%t%")
same goes for line 38 so this won't work either:

Code: Select all

WB.Navigate("http://www.google.com/cse?cx=010629462602499112316:ywoq_rufgic&q=%q%")
what can i change to make the WB.Navigate("URL") react to the variables correctly?
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: AHK Lookup Selection with Online Help Docs

19 May 2016, 17:13

Error: A control's variable must be global or static that can be fixed by making the variable global by putting Global WB somewhere in the function.

WB.Navigate(...) is a function where the input parameter is an expression. Quotes are used when text must be interpreted literally. Percentages are used when a literal text is expected but a variable is the input. They don't mix (percentages inside quotes) but can be used together through concatenation, so it would be used like: WB.Navigate("http://www.google.com/cse?cx=0106294626 ... _rufgic&q=" q).

I don't like having the same piece of code twice, that is why I suggested creating a function that creates the GUI. Like this, with some other tweaks in AutoHotkeyCommandsGui():

Code: Select all

#SingleInstance Force
#IfWinActive ahk_exe SciTE.exe
F1::
AutoHotkeyCommands(q:=""){
	static command
	url:="https://autohotkey.com/docs/"
 
	If (q="")	
		If !(q:=Trim(CtrlC()," `t`n`r"))
			Return
	If !(command){
		html:=UrlDownloadToVar(url "static/content.js"), command:={}, i:=1
		html:=RegExReplace(html,"s)(.*index = \[)(.*?)(\];.*)","$2")
		While i:=RegExMatch(html,"\[""([^""]*)"",""([^""]*)""]",s,i+1)
			command[s1]:=s2
	}
 
	If (v:=command[q]) || (v:=command[q "()"])
		t:=url v
	Else
		For k,v in command
			If InStr(k,q){
				t:=url v
				Break
			}
	If t
		AutoHotkeyCommandsGui(t)
	else
		;Run http://www.google.com/cse?cx=010629462602499112316:ywoq_rufgic&q=%q% ;browser
		AutoHotkeyCommandsGui("http://www.google.com/cse?cx=010629462602499112316:ywoq_rufgic&q=" q) ;Embedded window
Return
}
#IfWinActive
AutoHotkeyCommandsGui(url){
	Global WB
	Gui,New,
	Gui,Margin,0,0
	Gui, Add, ActiveX, xm w980 h640 vWB, Shell.Explorer
	WB.Navigate(url) 
	Gui +resize +AlwaysOnTop
	Gui, Show,,AutoHotkey Quick Reference
	return
	
	GuiClose:
		Gui,Destroy
	Return
	GuiSize:
		GuiControl,Move,WB,w%A_GuiWidth% h%A_GuiHeight%
	Return
}
CtrlC(){
	WholeClipBoard:=ClipBoardAll
	ClipBoard =
	Send ^c
	ClipWait,.3
	str:=ClipBoard
	ClipBoard:=WholeClipBoard
	Return, str
}
UrlDownloadToVar(URL) {
 ComObjError(false)
 WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
 WebRequest.SetTimeouts(5000, 5000, 3000, 3000)
 WebRequest.Open("GET", URL)
 WebRequest.Send()
 Return WebRequest.ResponseText
}
coolykoen
Posts: 61
Joined: 01 Jun 2015, 06:10

Re: AHK Lookup Selection with Online Help Docs

20 May 2016, 01:12

Nextron wrote:Error: A control's variable must be global or static that can be fixed by making the variable global by putting Global WB somewhere in the function.

WB.Navigate(...) is a function where the input parameter is an expression. Quotes are used when text must be interpreted literally. Percentages are used when a literal text is expected but a variable is the input. They don't mix (percentages inside quotes) but can be used together through concatenation, so it would be used like: WB.Navigate("http://www.google.com/cse?cx=0106294626 ... _rufgic&q=" q).

I don't like having the same piece of code twice, that is why I suggested creating a function that creates the GUI. Like this, with some other tweaks in AutoHotkeyCommandsGui():

Code: Select all

#SingleInstance Force
#IfWinActive ahk_exe SciTE.exe
F1::
AutoHotkeyCommands(q:=""){
	static command
	url:="https://autohotkey.com/docs/"
 
	If (q="")	
		If !(q:=Trim(CtrlC()," `t`n`r"))
			Return
	If !(command){
		html:=UrlDownloadToVar(url "static/content.js"), command:={}, i:=1
		html:=RegExReplace(html,"s)(.*index = \[)(.*?)(\];.*)","$2")
		While i:=RegExMatch(html,"\[""([^""]*)"",""([^""]*)""]",s,i+1)
			command[s1]:=s2
	}
 
	If (v:=command[q]) || (v:=command[q "()"])
		t:=url v
	Else
		For k,v in command
			If InStr(k,q){
				t:=url v
				Break
			}
	If t
		AutoHotkeyCommandsGui(t)
	else
		;Run http://www.google.com/cse?cx=010629462602499112316:ywoq_rufgic&q=%q% ;browser
		AutoHotkeyCommandsGui("http://www.google.com/cse?cx=010629462602499112316:ywoq_rufgic&q=" q) ;Embedded window
Return
}
#IfWinActive
AutoHotkeyCommandsGui(url){
	Global WB
	Gui,New,
	Gui,Margin,0,0
	Gui, Add, ActiveX, xm w980 h640 vWB, Shell.Explorer
	WB.Navigate(url) 
	Gui +resize +AlwaysOnTop
	Gui, Show,,AutoHotkey Quick Reference
	return
	
	GuiClose:
		Gui,Destroy
	Return
	GuiSize:
		GuiControl,Move,WB,w%A_GuiWidth% h%A_GuiHeight%
	Return
}
CtrlC(){
	WholeClipBoard:=ClipBoardAll
	ClipBoard =
	Send ^c
	ClipWait,.3
	str:=ClipBoard
	ClipBoard:=WholeClipBoard
	Return, str
}
UrlDownloadToVar(URL) {
 ComObjError(false)
 WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
 WebRequest.SetTimeouts(5000, 5000, 3000, 3000)
 WebRequest.Open("GET", URL)
 WebRequest.Send()
 Return WebRequest.ResponseText
}
Thank you so much! that works flawlessly :)
Though i have allready found some minor issues (that i don't mind because i don't need it), for example, the search bar at the top of the /docs page doesn't work correctly, upon searching, it just gives normal search results, but once you click on a result, it'll open that in a new full IE browser window :P

But, let's be honest, i won't use that search anyway so like i said i don't mind :) Thanks everyone for the help :P
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: AHK Lookup Selection with Online Help Docs

20 May 2016, 07:41

The embedded browser does have its limitations. The few occasions I use it it's solely for static targets without navigating. So I haven't bothered to see if there's a way around that. A bigger drawback is that Ctrl+C doesn't work. Then again, I have this script set up to open the page in the default browser.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: Bing [Bot], Skrell and 132 guests