Hi,
it is possible to programmatically - and somehow - set values in firefox from ahk. The following example demonstrate how to do this using a custom temporary extension - admittedly, this is for specific real use cases and has limited possibilities.
. restart firefox and navigate to
about:debugging#/runtime/this-firefox
. run the script
. @
about:debugging#/runtime/this-firefox click on
'charger un module complémentaire' (or the equivalent in your language)
. select the manifest created by the script (
A_ScriptDir . "\testahktest\manifest.json")
. open a new tab from
about:debugging#/runtime/this-firefox and navigate to
https://82187.csb.app/ but making sure you don't move the window until you are at https://82187.csb.app/
. press
ALT+D to disable firefox
. press
ALT+J to execute javascript in firefox from ahk
Code: Select all
#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance force
if not FileExist(dir:=A_ScriptDir . "\testahktest") {
FileCreateDir, % dir
manifest =
(Join`r`n
{
"manifest_version": 2,
"name": "test",
"version": "1.0",
"description": "just a test",
"content_scripts": [
{
"matches": ["https://82187.csb.app/"],
"js": ["inject.js"]
}
]
}
) ; https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension
FileAppend, % manifest, % dir . "\manifest.json", UTF-8
js =
(Join`r`n
var i = 0;
window.addEventListener("resize", function(_event) {
if (window.outerWidth == 500)
document.getElementById("OZipCode").value = ++i;
});
)
FileAppend, % js, % dir . "\inject.js", UTF-8
}
OnExit, handleExit
return
!x::
handleExit:
if WinExist("ahk_class MozillaWindowClass ahk_exe firefox.exe")
WinClose
ExitApp
#If WinExist("ahk_class MozillaWindowClass ahk_exe firefox.exe")
!d::WinSet, Disable
; !e::WinSet, Enable
!j::
WinMove, ahk_class MozillaWindowClass ahk_exe firefox.exe,,,, 500
WinMove, ahk_class MozillaWindowClass ahk_exe firefox.exe,,,, 501
return
#If
As suggested by others I would use instead chrome.ahk or COM with IE.
A_AhkUser