COM OBJECT: WBGET FUNCTION
- WBGet function, used in many of the scripts below.
- It can be used to latch onto an Internet Explorer_Server control in Internet Explorer/HTML Help/elsewhere, and do things like get/set the url and zoom etc.
WBGet function - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=39869
==================================================
COM OBJECT: OPEN A URL
Code: Select all
q:: ;internet explorer - set url of current tab
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
vUrl := "https://autohotkey.com/docs/AutoHotkey.htm"
oWB.Navigate(vUrl)
oWB := ""
return
w:: ;internet explorer - open url in existing window
vUrl := "https://autohotkey.com/docs/AutoHotkey.htm"
;if Internet Explorer is the default browser:
;Run, % vUrl
;otherwise:
Run, cmd.exe /c start "C:\Program Files\Internet Explorer\iexplore.exe" "%vUrl%",, Hide
return
;w:: ;internet explorer - open url in existing window (alternative)
vUrl := "https://autohotkey.com/docs/AutoHotkey.htm"
oShell := ComObjCreate("Shell.Application")
oShell.Open(vUrl)
oShell := ""
return
e:: ;internet explorer - open url in new window
vUrl := "https://autohotkey.com/docs/AutoHotkey.htm"
;Run, "C:\Program Files\Internet Explorer\iexplore.exe" "%vUrl%"
Run, iexplore.exe "%vUrl%"
return
COM OBJECT: GET WEBPAGE TITLES AND URLS
Latch onto active tab, get webpage title and url (and close tab):
Code: Select all
;WBGet function - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=39869
q:: ;internet explorer - latch onto active tab, get webpage title and url
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
MsgBox, % oWB.document.title "`r`n" oWB.document.url
;oWB.Quit() ;close tab
;oWB.Quit ;close tab (also works)
oWB := ""
return
Code: Select all
q:: ;internet explorer - get webpage titles and urls for most recently active IE window
;DetectHiddenWindows, On
WinGet, hWnd, ID, ahk_class IEFrame
if !hWnd
return
vOutput := ""
for oWB in ComObjCreate("Shell.Application").Windows
{
if (oWB.HWND = hWnd)
{
try vUrl := oWB.document.url
catch
vUrl := ""
try vTitle := oWB.document.title
catch
vTitle := ""
vOutput .= vTitle "`r`n" vUrl "`r`n`r`n"
}
}
oWB := ""
vOutput := SubStr(vOutput, 1, -2)
;Clipboard := vOutput
MsgBox, % vOutput
return
Code: Select all
q:: ;internet explorer - get webpage titles and urls for all existing tabs
DetectHiddenWindows, On
vOutput := ""
for oWB in ComObjCreate("Shell.Application").Windows
{
if (oWB.Name = "Internet Explorer")
{
try vUrl := oWB.document.url
catch
vUrl := ""
try vTitle := oWB.document.title
catch
vTitle := ""
vOutput .= vTitle "`r`n" vUrl "`r`n`r`n"
}
}
oWB := ""
vOutput := SubStr(vOutput, 1, -2)
;Clipboard := vOutput
MsgBox, % vOutput
return
COM OBJECT: FUNCTIONS FOR LISTING / COUNTING / FOCUSING TABS
Internet Explorer: activate tab - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=34222&p=173827#p173827
==================================================
COM OBJECT: ZOOM / TEXT SIZE (EXECWB)
Internet Explorer get/set zoom/text size - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=26359
==================================================
MENU ITEMS
[save as]
Windows 7 - invert selection, set details view/list view (trigger Explorer/Internet Explorer menu items) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=27564
[hide/show toolbars]
Internet Explorer Winset command list - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=28759
How to open the context menu of the window's title bar - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=35975&p=165570#p165570
Code: Select all
;PostMessage, 0x80F0, 0xA5D7,,, A ;WM_APP+240 := 0x80F0 ;Show tabs on a separate row
;New window: duplicate current tab as a new tab in a new window
;New session: open home page as a new tab in a new window
;PostMessage, 0x111, 381,, Shell DocObject View1, A ;WM_COMMAND := 0x111 ;New tab
;PostMessage, 0x111, 384,, Shell DocObject View1, A ;WM_COMMAND := 0x111 ;Duplicate tab
;PostMessage, 0x111, 275,, Shell DocObject View1, A ;WM_COMMAND := 0x111 ;New window
;PostMessage, 0x111, 285,, Shell DocObject View1, A ;WM_COMMAND := 0x111 ;New session
;PostMessage, 0x111, 256,, Shell DocObject View1, A ;WM_COMMAND := 0x111 ;Open...
;PostMessage, 0x111, 258,, Shell DocObject View1, A ;WM_COMMAND := 0x111 ;Save as...
;PostMessage, 0x111, 382,, Shell DocObject View1, A ;WM_COMMAND := 0x111 ;Close tab
;PostMessage, 0x111, 259,, Shell DocObject View1, A ;WM_COMMAND := 0x111 ;Page setup...
;PostMessage, 0x111, 260,, Shell DocObject View1, A ;WM_COMMAND := 0x111 ;Print...
;PostMessage, 0x111, 277,, Shell DocObject View1, A ;WM_COMMAND := 0x111 ;Print preview...
;PostMessage, 0x111, 262,, Shell DocObject View1, A ;WM_COMMAND := 0x111 ;Properties
COM OBJECT: GET REDIRECTED URL
get redirected url (handle file links and focus loss) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=30778
==================================================
COM OBJECT: WINDOW SPY
[download iWB2 Learner]
Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
Internet Explorer get element under cursor (show borders, show text) (any zoom percentage) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=29458
Internet Explorer Element Spy (alternative to iWB2 Learner) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=13031
==================================================
COM OBJECT: TABS
Internet Explorer: activate tab - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=34222
Internet Explorer - move tab to new window - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=26117
Firefox/Chrome, get tab names/focus tab - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26947
==================================================
COM OBJECT: FRAGMENT IDENTIFIERS
list fragment identifiers on a webpage (hash that jumps to point) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=28053
==================================================
COM OBJECT: CREATE UNIQUE IDENTIFIERS FOR TABS
Internet Explorer: get WB hWnds via object loop (+ do win objects have unique object IDs) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=26082
==================================================
COM OBJECT: CARET BROWSING
Internet Explorer: check if caret is visible (IHTMLCaret IsVisible) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=39615
==================================================
COM OBJECT: GET ELEMENT PROPERTY
[getAttribute method]
[try to get html element properties without causing an error message]
Getting href data, why is it so hard? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=40267
==================================================
COM OBJECT: NAVIGATE TO PREVIOUS/NEXT ITEM (ALT+LEFT/ALT+RIGHT)
Suggestions on documentation improvements - Page 18 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=13&t=1434&p=201485#p201485
==================================================
COM OBJECT: GET SELECTED TEXT
Code: Select all
;WBGet function - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=39869
q:: ;internet explorer - get selected text
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
vText := oWB.document.selection.createRange().text
MsgBox, % vText
oWB := ""
return
COM OBJECT: TABLES: GET TEXT FROM CELLS
webpages: get table text - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=39131
[Google spreadsheet]
Get spreadsheet info - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=44517&p=202084#p202084
Extract table element from a page - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=43003&p=203780#p203780
==================================================
DOWNLOAD TO FILE/VARIABLE (NOT INTERNET EXPLORER SPECIFIC)
[UrlDownloadToFile via DllCall]
Simple Download (Bin, ToString und ToFile) - Gebrauchsfertige Skripte & Funktionen - AutoHotkey Community
https://autohotkey.com/board/topic/89198-simple-download-bin-tostring-und-tofile/
UrlDownloadToFile - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/97642-urldownloadtofile/
==================================================
CLIPBOARD (NOT INTERNET EXPLORER SPECIFIC)
[add in: html from clipboard]
[put html onto clipboard]
GUI COMMANDS: COMPLETE RETHINK - Page 2 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=25893&p=170834#p170834
==================================================
HTMLFILE OBJECT
list of every command/function/variable from across all versions - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=27321
text/list/table functions (latest: add indentation, get nth(-to-last) line of specified length, html to/from text) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=27023
Using IE.Document.GetElementsByClassname - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=28791
==================================================
WINHTTPREQUEST OBJECT
[note: a WinHttpRequest does not require the use of Internet Explorer]
download urls to vars, partially/fullly, via WinHttpRequest - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=26528
UrlDownloadToFile - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/97642-urldownloadtofile/
urls: get date modified - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=37145
==================================================
MOZILLA FIREFOX / GOOGLE CHROME / OTHER WEB BROWSERS
Firefox/Chrome, get tab names/focus tab - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26947
Firefox/Chrome: copy titles/urls to the clipboard - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=22&t=66246
[Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium! - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=42890
Using Selenium with AutoHotkey- Cross browser automation! - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=32323
Get the URL of the current (active) browser tab - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=3702
==================================================
GRAPHICAL USER INTERFACES: ADD INTERNET EXPLORER_SERVER CONTROLS
[create an Internet Explorer_Server control]
[this is now doable via the Gui command and the ActiveX control]
IE_Add() or COM_AtlAxCreateContainer() or AtlAxWin() - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/32138-ie-add-or-com-atlaxcreatecontainer-or-atlaxwin/
==================================================
COM OBJECT (GENERAL)
Basic Webpage Controls with JavaScript / COM - Tutorial - Tutorials - AutoHotkey Community
https://autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/
==================================================
HTML HELP (AUTOHOTKEY HELP) (CHM FILES)
AutoHotkey help file, caret browsing - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=26116
[Solved] AutoHotkey help file navigation - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=30533
HTML Help alternative via Internet Explorer - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=42129
[AutoHotkey Help: focus Index tab]
SendMessage for the new help file of AutoHotkey - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=43262
HTML HELP (API)
DLLCall: Call a topic on existing help window (CHM) with hhctrl.ocx\HtmlHelpA - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=44462&p=201470#p201470
start chm file with specific page - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/12989-start-chm-file-with-specific-page/
[HTML Help: search keyword]
F1 help not jumping to particular URL with v1.1.27.00 help file - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=42014&p=191155#p191155
==================================================
JAVASCRIPT EXAMPLES
Internet Explorer: JavaScript examples - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=60377
==================================================
QUERYSELECTOR / QUERYSELECTORALL
LINKS (BEST):
CSS Selectors Reference
https://www.w3schools.com/cssref/css_selectors.asp
css3 - CSS Selector Clarification: |= vs ^= - Stack Overflow
https://stackoverflow.com/questions/35370441/css-selector-clarification-vs
LINKS (FURTHER):
HTML DOM querySelector() Method
https://www.w3schools.com/jsref/met_document_queryselector.asp
Document.querySelector() - Web APIs | MDN
https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
LINKS (SOME EXAMPLES):
querySelector/querySelectorAll examples - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=62113
javascript - Can I put logical operators in document.querySelectorAll? If so, how? - Stack Overflow
https://stackoverflow.com/questions/36544941/can-i-put-logical-operators-in-document-queryselectorall-if-so-how
javascript - querySelectorAll with multiple conditions - Stack Overflow
https://stackoverflow.com/questions/34001917/queryselectorall-with-multiple-conditions
javascript - How to use querySelectorAll only for elements that have a specific attribute set? - Stack Overflow
https://stackoverflow.com/questions/10777684/how-to-use-queryselectorall-only-for-elements-that-have-a-specific-attribute-set
==================================================
TEMPORARY INTERNET FILES
Code: Select all
q:: ;Internet Explorer - list Temporary Internet Files
vDir1 := "C:\Users\" A_UserName "\AppData\Local\Microsoft\Windows\Temporary Internet Files"
vOutput := ""
Loop, Files, % vDir1 "\*", FR
{
vPath := A_LoopFileFullPath
SplitPath, vPath, vName, vDir, vExt, vNameNoExt, vDrive
vOutput .= vPath "`r`n"
}
Clipboard := vOutput
MsgBox, % "done"
return