[Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids (now for v2!)

Post your working scripts, libraries and tools for AHK v1.1 and older
jsong55
Posts: 259
Joined: 30 Mar 2021, 22:02

Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids (now for v2!)

05 Mar 2024, 07:58

Agreed. Is there a way to setValue?
jollyjoe wrote:
07 Jul 2023, 12:02
Can I update an element without triggering it in the HTML?

Example:

I want this element

Code: Select all

<div class="expiration" id="exp">INACTIVE</div>
to turn into this: (automatically after the neutron page loads)

Code: Select all

<div class="expiration" id="exp">TEST</div>
using this:

Code: Select all

neutron.doc.getElementById("exp").innerText := "test"
This is what I've tried so far (to no avail)

Code: Select all

#Persistent
#SingleInstance ignore

;some code to initially verify if my license is valid
;and store it into a var (license)

mm := new NeutronWindow()
mm.Load("html/home.html")
mm.Gui("-Resize +LabelGui")
mm.Show("w410 h483")
settimer, Link, 1000 ;tried to make it update every 1s but nothing happens automatically
return

Link()
{
	global neutron
	neutron.doc.getElementById("exp").innerText := license ;I want this to "happen" without the need for triggering it with html.
}
Any help would be greatly appreciated.

I wanna add: I also dont want to trigger it via a hotkey. I just want it to run at the beggining of the script when the page first loads, Is this possible?
zhang
Posts: 7
Joined: 29 Oct 2022, 20:08

Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids (now for v2!)

20 May 2024, 09:53

jsong55 wrote:
05 Mar 2024, 07:58
Agreed. Is there a way to setValue?
You can use JavaScript
Just like this

Code: Select all

js := "
( ; js
	function ChangeElementInnerText() {
		let test = document.getElementById('exp');
		test.innerText='TEST';
	};
)"

Clicked(neutron, event) {
	; event.target will contain the HTML Element that fired the event.
	; Show a message box with its inner text.
	MsgBox "You clicked: " event.target.innerText
	;Using AHK to execute JavaScript functions
	neutron.wnd.execScript("ChangeElementInnerText()")
}

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 61 guests