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

Post your working scripts, libraries and tools for AHK v1.1 and older
erohtar
Posts: 20
Joined: 24 Jun 2021, 10:53

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

Post by erohtar » 13 Jul 2021, 02:19

@Tre4shunter
Ah! Actually I vaguely remembered seeing some code in Chrome.ahk that looked for a free port number - that must've been the commented out example you just mentioned! Thank you for pointing it out!

Based on latest testing, I see that two separate NeutronC windows work as expected as long as:
1) They run on separate ports (this should've been obvious to me, but I wrongly presumed it was already happening)
2) They run from separate profile folders (otherwise I get glitches and errors)

User avatar
Thoughtfu1Tux
Posts: 125
Joined: 31 May 2018, 23:26

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

Post by Thoughtfu1Tux » 17 Jul 2021, 00:52

Newbie question, but how do i go about appending a checkbox item to the bottom of a checklist with the DOM generation method?
I've been playing around with it for about an hour now, have not been able to figure it out.


I'm using the SIMPLE example.With no changes. When i click the "Submit" button under DOM generation, i want the Item that i input to get appended to the bottom of the "favorite foods" checklist section instead of the DOM generation section.


Very Newbie code:
HTML change to simple.html: (Added an id for the table)

Code: Select all

     <form onsubmit="ahk.Submit2(event)" id="favoritefoodstable">

Code: Select all

AHK Code change:
Ex4_Submit2(neutron, event)
{
	event.preventDefault()
	formData := neutron.GetFormData(event.target)
	
	; Create the row element to add cells to
	checkbox := neutron.doc.createElement("Checkbox")
	
	; Create the first column cell and add it to the row
	; td := neutron.doc.createElement("td")
	checkbox.innerText := formData.ex4_item2
	; tr.appendChild(td)
	
	; Create the second column cell and add it to the row
	; td := neutron.doc.createElement("td")
	; td.innerText := formData.ex4_cost2
	; tr.appendChild(td)
	
	; Add the row to the table
	neutron.qs("favoritefoodstable").append(checkbox)
}
I would happily accept/appreciate if anyone pointed me at any documentation that might help me figure this out if you don't have to time to write out the code yourself.
Thanks for the help!

DRocks
Posts: 565
Joined: 08 May 2018, 10:20

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

Post by DRocks » 21 Jul 2021, 20:42

Nice Work!! I actually have written an application with Electron for Javascript and this Neutron library feels like a similar tool but using AHK instead of NodeJs as a "Back-End". HTML / CSS / JS is great for user interfaces and AHK is good for Windows automation so it's a really nice combo.

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

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

Post by geek » 28 Aug 2021, 09:54

Thank you to Discord @ELMA for bringing this to my attention:


Along with traditional methods of debugging AutoHotkey scripts, you can access
the IE developer tools by invoking the Microsoft utility IEChooser.exe. This
tool, located at %SystemRoot%\System32\F12\IEChooser.exe allows you to choose
an IE frame embedded into any application and attach the regular web debugger to
it.

This tool is part of the Windows 10 suite of debugging utilities introduced with
Legacy Edge, and designed for debugging applications such as IE-based Office
Add-ins. It also works pretty well for AHK scripts with embedded browser
controls.

jsong55
Posts: 219
Joined: 30 Mar 2021, 22:02

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

Post by jsong55 » 14 Sep 2021, 05:57

Anyone has suggestions on good WYSIWYG editors for css and html 5 that we can use to build our neutron GUI

I find that just copy pasting bootstrap into a code editor doesn't cut it.

jsong55
Posts: 219
Joined: 30 Mar 2021, 22:02

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

Post by jsong55 » 14 Sep 2021, 21:35

Hopefully @GeekDude will be able to create neutron that integrates with Chrome instead of IE.

Else my question on stackexchange will get booted :( - https://stackoverflow.com/questions/69186078/rewrite-arrow-function-with-arrays-for-use-in-ie?noredirect=1#comment122282809_69186078

Tre4shunter
Posts: 139
Joined: 26 Jan 2016, 16:05

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

Post by Tre4shunter » 15 Sep 2021, 07:20

While IE may no longer be supported by MS, im pretty certain that the underlying engine which Neutron utilizes will not go away. Your question is still valid - and there are plenty of reasons not to want to use arrow functions. I'm sure someone can help you out - or you can convert it yourself im sure! :)

Or...just use Chrome, and then use the Chrome.ahk library.

-Tre4

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

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

Post by geek » 16 Sep 2021, 15:22

For what it's worth, I am "working" on Positron, like Neutron but built against Chromium Edge.

I put working in quotes because my time is very limited from my full time job and hour commute both ways. I don't plan to have it to release by the removal of IE11, but I also don't anticipate IE11's removal to break Neutron. Maybe I'll eat my words, but that's a die I'm forced to roll even if just for schedule reasons.

As part of Positrons development I've gone back to build better dependencies for JSON and Websockets as those are fundamental to the model of how Chromium communicates, and current libraries aren't cutting it. You can follow the development of cJson, the new Websocket library, Chrome.ahk, and Positron, from my Discord server.

https://geekdude.io/discord

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 » 16 Sep 2021, 16:07

it is unlikely that the trident engine will be removed anytime in the near future as so much else within the windows dev cycle depends 8n it and no suitible replacement yet exists
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

gregster
Posts: 8886
Joined: 30 Sep 2013, 06:48

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

Post by gregster » 16 Sep 2021, 17:31

What??? "GeekDude" is now renamed to "Geek" ?!?
I am shocked :shock: :lolno: , but I'll allow it :D , and also hope to see many great contributions like in the past!
Chrome.ahk, CodeQuickTester, Neutron.ahk, cJosn.ahk ... - it's like christmas (or whatever you fancy) when GeekDude posts a new project :bravo:


tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

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

Post by tuzi » 18 Oct 2021, 08:37

I created this BeautifulMessageBox.

Image

Image

Does anyone know how to make webview control have rounded corner? Because the webview control is a rectangle and the content inside is a rounded rectangle, so it doesn't look perfect. :cry:

@GeekDude
Last edited by tuzi on 20 Oct 2021, 01:28, edited 2 times in total.

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

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

Post by joedf » 18 Oct 2021, 09:14

Very neat!
To do round corners, I believe you can use Winset, Region or something like that.
Edit: see this https://www.autohotkey.com/docs/commands/WinSet.htm#ExRegion
But I am sure if it will work out-of-the-box, you might have do some other window tweaks
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]

tuzi
Posts: 223
Joined: 27 Apr 2016, 23:40

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

Post by tuzi » 18 Oct 2021, 19:45

joedf wrote:
18 Oct 2021, 09:14
Very neat!
To do round corners, I believe you can use Winset, Region or something like that.
Edit: see this https://www.autohotkey.com/docs/commands/WinSet.htm#ExRegion
But I am sure if it will work out-of-the-box, you might have do some other window tweaks
Thank you! i tried this, not work.

Another problem is that Winset, Region causes jagged edges. :cry:

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

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

Post by joedf » 18 Oct 2021, 23:15

Yeah... Maybe try something with GDI+... I don't know, I have touched that for quite some time... :+1:
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]

User avatar
SirSocks
Posts: 360
Joined: 26 Oct 2018, 08:14

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

Post by SirSocks » 10 Mar 2022, 12:47

Is it possible to open a local file with Neutron? For security reasons, Web Browsers won't open local files. But there must be a way to allow Neutron to run/open a local file.
For example: The following code will not open the document on a standard web browser. <a href="file:///C:\Users\Admin\Temp\My_Document.docx"> Document Link </a>
What method can be used to run/open a local file using Neutron?

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

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

Post by joedf » 10 Mar 2022, 13:26

Why not tie it with a onclick event and open it with ahk? :think:

Just modifying an example shown here: https://github.com/G33kDude/Neutron.ahk

Code: Select all

neutron := new NeutronWindow("<button onclick='ahk.Clicked(event)'>Hi</button>")
neutron.Show()
return

Clicked(neutron, event)
{
    MsgBox, % "You clicked: " event.target.innerText
    Run, C:\Users\Admin\Temp\My_Document.docx ; or get the filepath from an attribute on the element?
}
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]

User avatar
SirSocks
Posts: 360
Joined: 26 Oct 2018, 08:14

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

Post by SirSocks » 10 Mar 2022, 14:46

@joedf Thank you for pointing the OneClick method. That's very helpful! :thumbup:

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

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

Post by joedf » 10 Mar 2022, 16:05

SirSocks wrote:
10 Mar 2022, 14:46
@joedf Thank you for pointing the OneClick method. That's very helpful! :thumbup:
Glad I could help! :thumbup:
and @geek for fantastic work.
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]

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

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

Post by murataygun » 12 Aug 2022, 05:56

Can we use real URL's instead of local html files? How?

Post Reply

Return to “Scripts and Functions (v1)”