background preloader

AHK & javascript

Facebook Twitter

Basic Webpage Controls with JavaScript / COM - Tutorial - Tutorials. *IMPORTANT: please ask coding questions in the Ask For Help forum Basic Webpage Controls with Javascript / COM This tutorial requires AutoHotkey(_L) with built-in COM Support.

Basic Webpage Controls with JavaScript / COM - Tutorial - Tutorials

Purpose The purpose of this tutorial is to teach the intermediate AHK user how to start using COM to control webpages. My goal is to provide methods for controlling webpages, similar to how the AHK Control Commands can control Windows Applications. This tutorial is going to be high level, but will provide links to those who want to dig deeper into these concepts. You don't need to have much programming experience, but I will assume you feel comfortable writing and executing AHK scripts. The HTML DOM - (Document Object Model) A basic understanding of the HTML DOM is essential for controlling webpages. "Let me say it a different way: COM is the steering wheel - the HTML DOM is a road map - AHK is the car" ~tank Thank You: Terms - The following terms will be used throughout this tutorial.

Object Name and Index. Using one line JavaScript code to manipulate Web pages. Use AutoHotKey to Write a JavaScript Bookmarklet to the Browser Window. To make a hotkey that does something complicated in the browser you will probably need to send a JavaScript bookmarklet to the browser address bar.

Use AutoHotKey to Write a JavaScript Bookmarklet to the Browser Window

For example, suppose you wanted a hotkey that sent the current page as a bookmark to You'd do something like this: ^d:: Send ! D Send javascript:location.href= ' return The above code re-maps the combination of the control key (^) and the d to send alt-d (the ! The {t} and the {Enter} will send the + key and the Enter key respectively, the curly brackets are used as escapes in AutoHotKey, and the + sign is generally used as a shortcut for the shift key. Obviously, you could make variations in the hotkeys by mapping a key combination to send a JavaScript passing the address of the current page and mapping another key combination to pass the domain of the current page.

Run javascript OR js bookmarklet with ahk OR autohotkey. How To Use/Run External Javascript function. This may become a long post... just a heads up At my work we use Maximo (MRO) and i have for some time now used Ahk and COM to automat lots of the mundane tasks... and have been having one issue with this for some months now, when using Element.value := Somevalue the value will be set, but it is not sent to the server only the input field holds the value After lots of tests with.

How To Use/Run External Javascript function

COM_L Inject javascript - View topic. IE_InjectJS(hWnd_MainWindow, JS_to_Inject, VarNames_to_Return="", JS_to_Invoke1="", JS_to_Invoke2=""){global Block, fURL, myProg;FixSilent ;MsgBox, 4096,, fURL is: %fURL%, 2 ;theURL := IE_InjectJS(hwnd, "", "document.location.href");return theURL.

COM_L Inject javascript - View topic

COM_L Inject javascript. Hi TLM,Thanks for the reply.

COM_L Inject javascript

Sorry for my late reply. I got involved with the ie_inject function, but it usesthe execscript function which will be discontinued by Microsoft with IE 11+, I hear.BTW: I am using AHK_L version Unicode. jethrow does not like the phrase COM_L so Ihave stopped using it.Your idea is very interesting but I don't see how a javascript would get executed after it is appended.pwb.document.getElementsByTagName("Body")[0].innerHTML := StringI have tried this and many other variations.

Note the ` escaping for % characters to avoid errors for String = String = ( <script> function Go() { = "hidden"; var img1 = document.getElementsByTagName("img").item(0); var sw = screen.width; var sh = screen.height; var iw = img1.width; var ih = img1.height; var ir = iw/ih; var sr= sw/sh; if(sr <= ir) = "100`%"; else = "100`%"; } </script> ) pwb.document.getElementsByTagName("Body")[0].innerHTML .= String. Is there any way to execute javascript code via AHK?

<How to>use COM Object and Javascript in IE11 - Tutorials.