I got an .html file saved in my pc where I (or users) can check or uncheck CheckBoxes.
Those give possibility to use a "filter" in a SQLite query. This .html file is something like a Settings file or a .ini file for my script.
Using search here or in Google don't seem show me nothing to resolve my question. For example, searching for "ComObject" in subsection "AutoHotkey v2" show me more than 30 pages, and "ComObject("HTMLfile")" don't retrieve any results!
Html file contain rows like this:
Code: Select all
<div class="div-versione">
<input type="checkbox" id="VLSG" value="VLSG" name="chk-versione" checked="True">
<label for="VLSG">Vulgata latina di san Girolamo</label>
</div>
<div class="div-versione">
<input type="checkbox" id="NV" value="NV" name="chk-versione" checked="True">
<label for="NV">Nova Vulgata</label>
</div>
My intention is not only "read" ChkBoxes status but change them ad "re-save" the .html file.
Well. To do that I need before to read html content, change checked value and then re-write html.
Unfortunately read html seems not simple. I start with:
Code: Select all
#Requires AutoHotkey v2.0
#Warn ; Enable warnings to assist with detecting common errors.
#SingleInstance Force ; This suppresses the warning dialogue that a newly launched script is already running.
SetHtml(FileFoundedWithCompletePath) ; Call Func
SetHtml(html) {
htmlObj := ComObject("HTMLfile")
htmlObj.open()
test1 := htmlObj.getElementsByTagName("input[type=checkbox]")(0)
; Error: This value of type "String" has no property named "value".
test2 := htmlObj.getElementsByTagName("input[type=checkbox]")(0).value
; Error: This value of type "String" has no property named "innerHTML". CONTINUE -->
test3 := htmlObj.getElementsByTagName("input[type=checkbox]")(0).innerHTML
HtmlIds := htmlObj.getElementById("VLSG")
; Error: This value of type "String" has no property named "Length".
Qta := HtmlIds.Length
; Error: This value of type "String" has no property named "value". CONTINUE -->
Chk_value := htmlObj.getElementById("VLSG").value
; Error: This value of type "String" has no property named "innerHTML". CONTINUE -->
Chk_innerHTML := htmlObj.getElementById("VLSG").innerHTML
HtmlNames := htmlObj.getElementsByName("Versioni")
Qta1 := HtmlNames.Length
HtmlTagName := htmlObj.getElementsByTagName("Input")
Qta2 := HtmlTagName.Length
htmlObj.close
htmlObj := ""
}
I must stop at this point, from develop my script, waiting for some experts here. Maybe a week since I discover AutoHotkey, download and install it is few time, but I'm happy in what I could do till now.
What I looking for is a way to retrieve all 13 (in the piece of html are shown only 2) checkboxes actual status, change its (based on user choices) and then save the new html.
All html file is long 133 lines, so I dont' think should be a problem to elaborate it in memory.
But the way to access to the html source remain.
In the pic You can see what I can examine during Debug operation in VSCode My develop station:
AutoHotkey v2.0.10
Editor and Debugger: Visual Studio Code v1.84.2
Sys Op: Windows_NT x64 10.0.22621 (Windows 10 upgraded to 11)
Predator Helios 300 i7 32Gb + 2SSD(1Tb+4Tb)
Thanxs.