[GUI] Use HTML and CSS for your GUIs!
Re: [GUI] Use HTML and CSS for your GUIs!
Is it possible for AHK to see javascript events that are created by Html/CSS/JS entities on ActiveX controls and respond to them?
Re: [GUI] Use HTML and CSS for your GUIs!
Take a look at Installer.ahk in your installation directory. Lexikos makes use of something like this. I think you can make a JS function and within that, call an AHK function and pass the events to it.
Re: [GUI] Use HTML and CSS for your GUIs!
Yes, Installer.ahk is indeed a very good example.
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]
Re: [GUI] Use HTML and CSS for your GUIs!
This is very cool! If you have written a full blown class for this please let me know!
Thought I'd share this too, it registers the event for all input tags so you don't have to do it manually for each button.
Thought I'd share this too, it registers the event for all input tags so you don't have to do it manually for each button.
Code: Select all
loop % wb.document.getElementsByTagName("input").length{
;ComObjConnect needs a unique variable for each iteration for all to work
button%a_index% := wb.document.getElementsByTagName("input")[A_Index-1]
id := button%a_index%.id
ComObjConnect(button%a_index%, id . "_")
}
Re: [GUI] Use HTML and CSS for your GUIs!
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]
-
- Posts: 463
- Joined: 24 Jan 2014, 22:28
Re: [GUI] Use HTML and CSS for your GUIs!
Webkit is a bit misleading if it's using IE's Trident engine don't you think?
Oh and btw:
https://github.com/cocobelgica/AutoHotk ... ebView.ahk
Oh and btw:
https://github.com/cocobelgica/AutoHotk ... ebView.ahk
Re: [GUI] Use HTML and CSS for your GUIs!
@Bruttosozialprodukt
You're right haha
thanks for the link, I remember seeing that. seems quite complete.
I'm thinking maybe using Exo, so we would only need to edit HTML and js files.
I guess this would be more like a wrapper to simplify the work of making web+ahk apps.
You're right haha
thanks for the link, I remember seeing that. seems quite complete.
I'm thinking maybe using Exo, so we would only need to edit HTML and js files.
I guess this would be more like a wrapper to simplify the work of making web+ahk apps.
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]
Re: [GUI] Use HTML and CSS for your GUIs!
Are either of you savvy enough to figure out why CWebView.ahk doesn't let any accelerator keys through?
In my only implementation, I modified the function used in Installer.ahk to let ctrl+a, ctrl+x, ctrl+c, ctrl+v through, and Enter also seems to be recognized. But can't seem to figure out how to do the same with this class.
In my only implementation, I modified the function used in Installer.ahk to let ctrl+a, ctrl+x, ctrl+c, ctrl+v through, and Enter also seems to be recognized. But can't seem to figure out how to do the same with this class.
Code: Select all
/* Fix keyboard shortcuts in WebBrowser control.
* References:
* http://www.autohotkey.com/community/viewtopic.php?p=186254#p186254
* http://msdn.microsoft.com/en-us/library/ms693360
*/
gui_KeyDown(wParam, lParam, nMsg, hWnd) {
global wb
if (Chr(wParam) ~= "[B,D-U,W,Y-Z]" || wParam = 0x74) ; Disable Ctrl+O/L/F/N and F5.
return
pipa := ComObjQuery(wb, "{00000117-0000-0000-C000-000000000046}")
VarSetCapacity(kMsg, 48), NumPut(A_GuiY, NumPut(A_GuiX
, NumPut(A_EventInfo, NumPut(lParam, NumPut(wParam
, NumPut(nMsg, NumPut(hWnd, kMsg)))), "uint"), "int"), "int")
Loop 2
r := DllCall(NumGet(NumGet(1*pipa)+5*A_PtrSize), "ptr", pipa, "ptr", &kMsg)
; Loop to work around an odd tabbing issue (it's as if there
; is a non-existent element at the end of the tab order).
until wParam != 9 || wb.Document.activeElement != ""
ObjRelease(pipa)
if r = 0 ; S_OK: the message was translated to an accelerator.
return 0
}
Re: [GUI] Use HTML and CSS for your GUIs!
Was able to figure that part out by doing the below and passing my own function:
Now, the problem is that setting cwb.Window.AHK := Func("JS_AHK") is now not working.
Code: Select all
cwb := new CWebView(1, "x0 y20 w250 h500", html)
cwb.TranslateAccelerator := ["D", gui_KeyDown]
Re: [GUI] Use HTML and CSS for your GUIs!
CWebView.Window returns a CWebPage, not a window object. Your assignment doesn't work because CWebPrototype.__Set forwards assignments only when _IsMemberOf() returns true. I suppose it will return false for properties that haven't been defined yet, like 'AHK'.
It looks like all the wrapping is just to add a few helper functions to HTML nodes and document objects.
It looks like all the wrapping is just to add a few helper functions to HTML nodes and document objects.
Re: [GUI] Use HTML and CSS for your GUIs!
My main reason for trying this class out is because in this weather widget I've been slowly working on, it almost always shows the AutoHotkey has stopped responding window when I close it. And it wouldn't even run on my Win10 machine (untested using this class yet). Using this class, I haven't had any problems with that whatsoever.
This seems to work... whether or not its the correct way to do so.
This seems to work... whether or not its the correct way to do so.
Code: Select all
cwb := new CWebView(1, "x0 y20 w250 h500", html, Func("JS_AHK"))
cwb.TranslateAccelerator := ["D", gui_KeyDown]
w := cwb.__Ptr.document.parentWindow
w.AHK := Func("JS_AHK")
Re: [GUI] Use HTML and CSS for your GUIs!
Will be adding this to the post soon, targeting newbie/intermediate.
https://github.com/joedf/Webapp.ahk
Sadly its not a class, there's some weird stuff going on.
https://github.com/joedf/Webapp.ahk
Sadly its not a class, there's some weird stuff going on.
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]
Re: [GUI] Use HTML and CSS for your GUIs!
Joedf, could your webapp.ahk be configured to detect javascript events like when a row on a table is selected? Such as at this link https://datatables.net/extensions/selec ... vents.html
Re: [GUI] Use HTML and CSS for your GUIs!
Actually, try simply loading your webpages with the javascript. What webapp.ahk does, it allows you to access AHK scripting and wraps it into a lightweight "app" which can be compiled to an exe. Try it, maybe throw in a few messageboxes/alert() to debug it.
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]
Re: [GUI] Use HTML and CSS for your GUIs!
Newbie here...
Is there a special requirement for running webapp.ahk applications (OS/IE version/anything else...)?
It works fine in Windows 10, but when I try to run Example.ahk on Vista/IE9 it throws an error when clicking a link.
Any ideas?
Thanks
Is there a special requirement for running webapp.ahk applications (OS/IE version/anything else...)?
It works fine in Windows 10, but when I try to run Example.ahk on Vista/IE9 it throws an error when clicking a link.
Any ideas?
Thanks
Re: [GUI] Use HTML and CSS for your GUIs!
Hmm....
Try commenting-out line 38... -> ;;;;SetWBClientSite() ?
Try commenting-out line 38... -> ;;;;SetWBClientSite() ?
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]
Re: [GUI] Use HTML and CSS for your GUIs!
@xandu: Make sure AutoHotkey is up to date.
Re: [GUI] Use HTML and CSS for your GUIs!
Nope, same error after commenting that line.joedf wrote:Hmm....
Try commenting-out line 38... -> ;;;;SetWBClientSite() ?
@lexikos: I downloaded it yesterday, so it should be up-to-date...
Re: [GUI] Use HTML and CSS for your GUIs!
(I have to repost, I guess my reply was lost somehow)
@lexikos: I installed it yesterday, so it should be up-to date.
That didn't help, same error received...joedf wrote:Hmm....
Try commenting-out line 38... -> ;;;;SetWBClientSite() ?
@lexikos: I installed it yesterday, so it should be up-to date.
Re: [GUI] Use HTML and CSS for your GUIs!
Evidently your post was not lost, but probably required moderator approval because you were not logged in.
That you downloaded and installed it yesterday means very little, because you didn't say what you downloaded or from where. To actually verify that AutoHotkey is up to date, just check the version number of the program and compare it to the download link at the top of this page (currently "Download - 1.1.24.01"). The version number can be found in various places, but to be sure, the most reliable way is to run MsgBox %A_AhkVersion% within your script.
This is important because the line in question most likely requires v1.1.18+ ("Added support for creating new properties in JavaScript/IE DOM objects.")
That you downloaded and installed it yesterday means very little, because you didn't say what you downloaded or from where. To actually verify that AutoHotkey is up to date, just check the version number of the program and compare it to the download link at the top of this page (currently "Download - 1.1.24.01"). The version number can be found in various places, but to be sure, the most reliable way is to run MsgBox %A_AhkVersion% within your script.
This is important because the line in question most likely requires v1.1.18+ ("Added support for creating new properties in JavaScript/IE DOM objects.")
Return to “Tips and Tricks (v1)”
Who is online
Users browsing this forum: No registered users and 20 guests