[GUI] Use HTML and CSS for your GUIs!

Put simple Tips and Tricks that are not entire Tutorials in this forum
User avatar
joedf
Posts: 6608
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: [GUI] Use HTML and CSS for your GUIs!

11 Apr 2018, 17:44

Awesome :+1:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 3.00 GHz, 16GB DDR4 3200 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
Stavencross
Posts: 60
Joined: 24 May 2016, 16:42

Re: [GUI] Use HTML and CSS for your GUIs!

12 May 2018, 09:36

I'm curious if you've done anything else with webapp.ahk in the last 6-7 months or if there's been an update to it or anything
Stavencross
Posts: 60
Joined: 24 May 2016, 16:42

Re: [GUI] Use HTML and CSS for your GUIs!

18 May 2018, 05:47

Awesome :+1:

Some of the functions I use pop up a message box that pauses the script while a user works in PowerPoint.

However, it seems that webapp.ahk will be looping in the background, once it gets to 5 million loops, internet explorer pops a message box complaining about an unresponsive script and asking if I want to close it.

Is there anything I can do about this?

I'm trying to refractor my code to do away with these message boxes, but I wanted to see if you had any insight as a temp fix
User avatar
kczx3
Posts: 666
Joined: 06 Oct 2015, 21:39

Re: [GUI] Use HTML and CSS for your GUIs!

18 May 2018, 08:30

Awesome :+1:

Some of the functions I use pop up a message box that pauses the script while a user works in PowerPoint.

However, it seems that webapp.ahk will be looping in the background, once it gets to 5 million loops, internet explorer pops a message box complaining about an unresponsive script and asking if I want to close it.

Is there anything I can do about this?

I'm trying to refractor my code to do away with these message boxes, but I wanted to see if you had any insight as a temp fix
https://support.microsoft.com/en-us/hel ... orer-to-ru
Stavencross
Posts: 60
Joined: 24 May 2016, 16:42

Re: [GUI] Use HTML and CSS for your GUIs!

18 May 2018, 11:36

Awesome :+1:

Some of the functions I use pop up a message box that pauses the script while a user works in PowerPoint.

However, it seems that webapp.ahk will be looping in the background, once it gets to 5 million loops, internet explorer pops a message box complaining about an unresponsive script and asking if I want to close it.

Is there anything I can do about this?

I'm trying to refractor my code to do away with these message boxes, but I wanted to see if you had any insight as a temp fix
https://support.microsoft.com/en-us/hel ... orer-to-ru

Yes, that seems to be what's happening for sure. I asked in discord and I'll time out the message box to fix
User avatar
joedf
Posts: 6608
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: [GUI] Use HTML and CSS for your GUIs!

19 May 2018, 08:26

That’s weird... I don’t know of any loops on webapp.ahk ... :think:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 3.00 GHz, 16GB DDR4 3200 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
kczx3
Posts: 666
Joined: 06 Oct 2015, 21:39

Re: [GUI] Use HTML and CSS for your GUIs!

19 May 2018, 09:54

Has nothing to do with loops. He is probably calling an AHK function from JS which is opening the MsgBox. The JS is in a hold State because the MsgBox is modal and pauses JS execution. This happens with the software that I support where IE is used inside a C# application.
User avatar
joedf
Posts: 6608
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: [GUI] Use HTML and CSS for your GUIs!

19 May 2018, 11:23

ahh yes.. thanks for the clarification.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 3.00 GHz, 16GB DDR4 3200 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
Stavencross
Posts: 60
Joined: 24 May 2016, 16:42

Re: [GUI] Use HTML and CSS for your GUIs!

21 Sep 2018, 09:04

Yes Kczx3 was correct. Yesterday I redesigned the whole 1000 line function to utilize a GUI instead for control instead of messagebox. that fixed everything
User avatar
joedf
Posts: 6608
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: [GUI] Use HTML and CSS for your GUIs!

21 Sep 2018, 19:52

Good to know! :+1:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 3.00 GHz, 16GB DDR4 3200 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
DRocks
Posts: 190
Joined: 08 May 2018, 10:20

Re: [GUI] Use HTML and CSS for your GUIs!

01 Nov 2018, 22:16

Hello joedf

Thanks for showing this! I am trying to learn the topic currently and one of my question that arose by reading the first post is this:
Can we execute a print from that ActiveX control which is inside the GUI? Id like to use that to print invoices made with html template and GUI vars by a button click in ahk GUI
User avatar
joedf
Posts: 6608
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: [GUI] Use HTML and CSS for your GUIs!

01 Nov 2018, 22:52

You could try taking control of the print dialog with something like this: https://stackoverflow.com/a/8688247/883015
You can bring it up by calling window.print() in js

or use a library like http://printjs.crabbly.com/
or maybe something with phantomjs or headless chrome
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 3.00 GHz, 16GB DDR4 3200 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
DRocks
Posts: 190
Joined: 08 May 2018, 10:20

Re: [GUI] Use HTML and CSS for your GUIs!

02 Nov 2018, 07:04

thank you!! and nice to see you're from Quebec... I'm in Longueuil near montreal
User avatar
kczx3
Posts: 666
Joined: 06 Oct 2015, 21:39

Re: [GUI] Use HTML and CSS for your GUIs!

02 Nov 2018, 07:41

I think you have two options DRocks. You can try using ShellRun by Lexikos and calling it like so:

Code: Select all

ShellRun("C:\Users\<user>\Desktop\index.html", "", "", "print", 1)
I do believe that this requires that the default program for html files is Internet Explorer though.

Another option, though it seems that this is undocumented behavior, is to call the PrintHTML function from mshtml.dll. I wasn't able to figure it out using DllCall but I could get it to run via to following:

Code: Select all

Run, % "rundll32.exe " . A_WinDir . "\system32\mshtml.dll,PrintHTML "C:\Users\<user>\Desktop\index.html"""
See here for more info - https://stackoverflow.com/a/768/8820049 and https://stackoverflow.com/questions/199 ... mshtml-dll

EDIT:
And here's a sample of a HTML file with styles for printing - https://gist.github.com/crowcoder/c4ac49ba30048262db8c
This seems to have good info for CSS print stuff - https://print-css.rocks/
User avatar
joedf
Posts: 6608
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: [GUI] Use HTML and CSS for your GUIs!

02 Nov 2018, 08:18

@DRocks cool! ahaha, more AHK users out there than I realize. :+1:

+1 kczx3
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 3.00 GHz, 16GB DDR4 3200 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
DRocks
Posts: 190
Joined: 08 May 2018, 10:20

Re: [GUI] Use HTML and CSS for your GUIs!

02 Nov 2018, 09:54

I think you have two options DRocks. You can try using ShellRun by Lexikos and calling it like so:

Code: Select all

ShellRun("C:\Users\<user>\Desktop\index.html", "", "", "print", 1)
I do believe that this requires that the default program for html files is Internet Explorer though.

Another option, though it seems that this is undocumented behavior, is to call the PrintHTML function from mshtml.dll. I wasn't able to figure it out using DllCall but I could get it to run via to following:

Code: Select all

Run, % "rundll32.exe " . A_WinDir . "\system32\mshtml.dll,PrintHTML "C:\Users\<user>\Desktop\index.html"""
See here for more info - https://stackoverflow.com/a/768/8820049 and https://stackoverflow.com/questions/199 ... mshtml-dll

EDIT:
And here's a sample of a HTML file with styles for printing - https://gist.github.com/crowcoder/c4ac49ba30048262db8c
This seems to have good info for CSS print stuff - https://print-css.rocks/
wow thank you! I'll read through this tonight. Thats great news!!
DRocks
Posts: 190
Joined: 08 May 2018, 10:20

Re: [GUI] Use HTML and CSS for your GUIs!

02 Nov 2018, 17:35

ShellRun is in fact, as you said, only bringing up the print dialog when I switch from chrome to internet explorer as my default app to open .html files.

And the second part with run % " .. " is bringing the print dialog successfully no matter what!
There was a little typo that made me scratch my head a bit but this worked. Now I'll have to check for the html generating with the GUI values

Code: Select all

Run, % "rundll32.exe " . A_WinDir . "\system32\mshtml.dll,PrintHTML ""C:\Users\Alex\Desktop\index.html"
SOTE
Posts: 185
Joined: 15 Jun 2015, 06:21

Re: [GUI] Use HTML and CSS for your GUIs!

06 Nov 2018, 01:02

Code: Select all

Run, % "rundll32.exe " . A_WinDir . "\system32\mshtml.dll,PrintHTML ""C:\Users\Alex\Desktop\index.html"
Might want to use %A_UserName% as opposed to Alex or <user>... Just saying...
DRocks
Posts: 190
Joined: 08 May 2018, 10:20

Re: [GUI] Use HTML and CSS for your GUIs!

06 Nov 2018, 06:41

Code: Select all

Run, % "rundll32.exe " . A_WinDir . "\system32\mshtml.dll,PrintHTML ""C:\Users\Alex\Desktop\index.html"
Might want to use %A_UserName% as opposed to Alex or <user>... Just saying...
Right.
The only thing that bothers me is that the link to posts that Kc included mention that the mshtml.dll is not documented and might not be supported in futur Windows builds. Other than that for now.. it works fine

Return to “Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 4 guests