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

Post your working scripts, libraries and tools for AHK v1.1 and older
SundayProgrammer
Posts: 143
Joined: 25 Dec 2020, 12:26

Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids

Post by SundayProgrammer » 12 Aug 2022, 13:02

murataygun wrote:
12 Aug 2022, 05:56
Can we use real URL's instead of local html files? How?
i think if the html has something referring back to the ahk script, for instance, onclick="ahk.buttonclicked(event, something)", can more unveil the usefulness of neutron.

Yogi
Posts: 12
Joined: 06 Jul 2022, 23:03

Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids

Post by Yogi » 10 Sep 2022, 00:06

Thank you for this!

Is there by chance a way to set the height automatically depending on the contents of the html file - up to the GUI option MaxSize?

User avatar
joedf
Posts: 8953
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids

Post by joedf » 12 Sep 2022, 20:07

Well on page load you could get the body size, then use ahk to scale the window....
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

ragegraylin
Posts: 2
Joined: 14 Aug 2022, 08:03

Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids

Post by ragegraylin » 16 Sep 2022, 06:56

I wonder if someday I could make it possible to create a sub-par version of the Discord desktop version or maybe a YouTube application.

User avatar
joedf
Posts: 8953
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids

Post by joedf » 16 Sep 2022, 08:56

ragegraylin wrote:
16 Sep 2022, 06:56
I wonder if someday I could make it possible to create a sub-par version of the Discord desktop version or maybe a YouTube application.
Many have already, but using electron/node.js and other web-based frameworks. :geek:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

sashaatx
Posts: 333
Joined: 27 May 2021, 08:27
Contact:

Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids

Post by sashaatx » 18 Sep 2022, 01:25

geek
memberlist.php?mode=viewprofile&u=64445


thanks g33kdude
basically used your foundation for all my vr game mods. helped elevate my weekend-warrior coding.

(I doubt anyone wants them but for reference https://github.com/samfisherirl/Geo3D_Manager https://github.com/samfisherirl/Artum-VR_Screen_Cap-Gui )

Image

Image

Image
https://github.com/samfisherirl
? /Easy-Auto-GUI-for-AHK-v2 ? /Useful-AHK-v2-Libraries-and-Classes : /Pulovers-Macro-Creator-for-AHKv2 :

murataygun
Posts: 104
Joined: 07 Aug 2015, 15:53

Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids

Post by murataygun » 29 Sep 2022, 06:10

SundayProgrammer wrote:
12 Aug 2022, 13:02
murataygun wrote:
12 Aug 2022, 05:56
Can we use real URL's instead of local html files? How?
i think if the html has something referring back to the ahk script, for instance, onclick="ahk.buttonclicked(event, something)", can more unveil the usefulness of neutron.
I tried this.
- Modified neutron.ahk
- Created an html page on a server
- Put required tags ahk.button etc.
- opened in neutronwindow

It works.
Plus side; You dont need js, css, image files to be created.
You can save form datas directly to the server and the ahk objects.
I guess you can allso cache css's

Negative side; It loads webpage from remote server so it can lag a bit.

murataygun
Posts: 104
Joined: 07 Aug 2015, 15:53

Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids

Post by murataygun » 29 Sep 2022, 12:40

Please see the code. Button function. How can i handle that buttonClick event inside that class? Not the global scope.

Code: Select all


#Persistent

#Include, ../lib/Neutron.ahk

P := new PharmacyGui()
P.showGui()

;How can i get this function to work in PharmacyGui class as a method.
;I should handle the form data inside, not the global scope, amn't I?
Button(neutron, event) {
    MsgBox, Pushed me.
}

class PharmacyGui {

    showGui() {

    template =
    (

    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <link rel="stylesheet" href="./css/vital-ui-kit.css">
        <link rel="stylesheet" href="./css/styleguide.css">
        <script src="./js/jquery.min.js"></script>
        <script src="./js/vital-ui-kit.js"></script>
    </head>
    <body>
    <input type="button" value="Push Me" onclick="ahk.Button(event)" />
    </body>
    </html>
    )

    FileDelete, template.html
    FileAppend, % template, template.html

    neutron := new NeutronWindow()
    neutron.Load("template.html")
    neutron.Gui("+LabelNeutron")
    neutron.Show()  

    }

	;Somewhere around here. As a method.

}


User avatar
sumon
Posts: 38
Joined: 01 Oct 2013, 14:05
Location: Stockholm, Sweden

Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids

Post by sumon » 02 Nov 2022, 15:04

geek wrote:
04 Jun 2020, 00:06
Welcome to Neutron

Neutron provides a powerful set of tools for build HTML-based user interfaces with AutoHotkey. It leverages the Trident engine, known for its use in Internet Explorer, because of its deep integration with the Microsoft Windows operating system and its wide availability across systems.

(...)
:bravo:

Wow! I just have to drop by and say this is amazing. I've been keeping my eye out for AHK GUI-tools for a while (as well as some Python tools, as I've been dabbling in that), and the execution of Neutron seems very good.

It's really pushing me to get back into coding for AutoHotkey again. Will give it a shot, but first just compliments on doing this. (I watched most of the video)

User avatar
tank
Posts: 3122
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids

Post by tank » 04 Nov 2022, 10:54

@sumon Long time no see.. glad you still around
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter

User avatar
sumon
Posts: 38
Joined: 01 Oct 2013, 14:05
Location: Stockholm, Sweden

Re: [Library] Neutron.ahk - AutoHotkey Web GUIs on Steroids

Post by sumon » 04 Nov 2022, 15:22

tank wrote:
04 Nov 2022, 10:54
@sumon Long time no see.. glad you still around
Always :lol: Thanks!

geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

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

Post by geek » 23 Dec 2022, 18:23

Neutron has now been fully ported to AHKv2! See here: https://github.com/G33kDude/Neutron.ahk/tree/v2 or the link at the top of the original post

neogna2
Posts: 590
Joined: 15 Sep 2016, 15:44

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

Post by neogna2 » 25 Dec 2022, 18:01

geek wrote:
23 Dec 2022, 18:23
Neutron has now been fully ported to AHKv2! See here: https://github.com/G33kDude/Neutron.ahk/tree/v2 or the link at the top of the original post
Great!
In the template.ahk example script the form part appears to have some kind of issue, the form data values are always blank
MsgBox "Hello " formData.firstName " " formData.lastName "!"

User avatar
oldbrother
Posts: 273
Joined: 23 Oct 2013, 05:08

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

Post by oldbrother » 27 Dec 2022, 13:36

Thank you.

The 2.0 example of "HTML Generation" doesn't work properly.

geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

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

Post by geek » 27 Dec 2022, 21:25

Both of those problems were related. I had a > where I should have had a < and so the form data submissions were never getting loaded into AHK. Not sure how I missed that :oops: thanks for the bug reports!


Grasshopper
Posts: 4
Joined: 31 Oct 2020, 08:47

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

Post by Grasshopper » 11 May 2023, 18:17

Loving the look of the GUI with Neutron!

Has anyone figured out a way to cut/copy/paste in the Neutron GUI using keyboard shortcuts?

Right-clicking and selecting cut/copy/paste works but I have not been able to use the keyboard shortcuts on input fields (textarea) or text fields. When I use Edge in IE compatibility mode the keyboard shortcuts work.

Is there a way to figure out what is blocking them or to redefine ^x ^c and ^v to restore the normal function?

enrique
Posts: 1
Joined: 11 Mar 2023, 22:40

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

Post by enrique » 24 May 2023, 00:59

I’m using a modified version of bootstrap. When compiling, if compression is enable the GUI gets corrupted. Is it expected ? If no compression is enabled, GUI is normal.

jollyjoe
Posts: 42
Joined: 13 Feb 2021, 18:51

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

Post by jollyjoe » 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?

User avatar
elModo7
Posts: 217
Joined: 01 Sep 2017, 02:38
Location: Spain
Contact:

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

Post by elModo7 » 18 Jan 2024, 13:58

I used neutron for a script I released for creating SSH tunnels, check it out here viewtopic.php?f=6&t=125013.

Image

Post Reply

Return to “Scripts and Functions (v1)”