Skip to content

Commit

Permalink
V0.42 update
Browse files Browse the repository at this point in the history
Small updating enabling the OpenBunnyEggs macro and fixing some small bugs.

IF YOU HAVE HTML/JS/CSS/AHK EXPERIENCE PLEASE CONTACT ME! :D
  • Loading branch information
ark-automated committed Apr 8, 2021
1 parent a360094 commit 4de4c32
Show file tree
Hide file tree
Showing 13 changed files with 10,314 additions and 104 deletions.
183 changes: 94 additions & 89 deletions AA_GUI.html

Large diffs are not rendered by default.

1,160 changes: 1,160 additions & 0 deletions Ark_Automated V0.42.ahk

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,11 @@ Extended some timers to make it less likely to bug out on slower machines
+Added a donation button
+Added an instruction video
+Started with more customization options in the backend, those will be visible later.


V0.42
+Enabled bunny egg macro

Fixed: simplemacro will now only send the key, not shift+key and some other small things

Coming soon: V0.5 with lots of new features :)
92 changes: 78 additions & 14 deletions Neutron.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,19 @@ class NeutronWindow
, WM_NCHITTEST := 0x84
, WM_NCLBUTTONDOWN := 0xA1
, WM_KEYDOWN := 0x100
, WM_KEYUP := 0x101
, WM_SYSKEYDOWN := 0x104
, WM_SYSKEYUP := 0x105
, WM_MOUSEMOVE := 0x200
, WM_LBUTTONDOWN := 0x201

; Virtual-Key Codes
, VK_TAB := 0x09
, VK_SHIFT := 0x10
, VK_CONTROL := 0x11
, VK_MENU := 0x12
, VK_F5 := 0x74

; Non-client hit test values (WM_NCHITTEST)
, HT_VALUES := [[13, 12, 14], [10, 1, 11], [16, 15, 17]]

Expand All @@ -131,13 +141,39 @@ class NeutronWindow

; --- Instance Variables ---

LISTENERS := [this.WM_DESTROY, this.WM_SIZE, this.WM_NCCALCSIZE
, this.WM_KEYDOWN, this.WM_KEYUP, this.WM_SYSKEYDOWN, this.WM_SYSKEYUP
, this.WM_LBUTTONDOWN]

; Maximum pixel inset for sizing handles to appear
border_size := 6

; The window size
w := 800
h := 600

; Modifier keys as seen by neutron
MODIFIER_BITMAP := {this.VK_SHIFT: 1<<0, this.VK_CONTROL: 1<<1
, this.VK_MENU: 1<<2}
modifiers := 0

; Shortcuts to not pass on to the web control
disabled_shortcuts :=
( Join ; ahk
{
0: {
this.VK_F5: true
},
this.MODIFIER_BITMAP[this.VK_CONTROL]: {
GetKeyVK("F"): true,
GetKeyVK("L"): true,
GetKeyVK("N"): true,
GetKeyVK("O"): true,
GetKeyVK("P"): true
}
}
)


; --- Properties ---

Expand Down Expand Up @@ -165,8 +201,6 @@ class NeutronWindow
__New(html:="", css:="", js:="", title:="Neutron")
{
static wb
this.LISTENERS := [this.WM_DESTROY, this.WM_SIZE, this.WM_NCCALCSIZE
, this.WM_KEYDOWN, this.WM_LBUTTONDOWN]

; Create necessary circular references
this.bound := {}
Expand Down Expand Up @@ -296,11 +330,13 @@ class NeutronWindow
DetectHiddenWindows, On
ControlGet, hWnd, hWnd,, Internet Explorer_Server1, % "ahk_id" this.hWnd
this.hIES := hWnd
ControlGet, hWnd, hWnd,, Shell DocObject View1, % "ahk_id" this.hWnd
this.hSDOV := hWnd
DetectHiddenWindows, %dhw%

this.pWndProc := RegisterCallback(this._WindowProc, "", 4, &this)
this.pWndProcOld := DllCall("SetWindowLong" (A_PtrSize == 8 ? "Ptr" : "")
, "Ptr", hWnd ; HWND hWnd
, "Ptr", this.hIES ; HWND hWnd
, "Int", -4 ; int nIndex (GWLP_WNDPROC)
, "Ptr", this.pWndProc ; LONG_PTR dwNewLong
, "Ptr") ; LONG_PTR
Expand Down Expand Up @@ -368,31 +404,58 @@ class NeutronWindow

for i, message in this.LISTENERS
OnMessage(message, this.bound._OnMessage, 0)
ComObjConnect(this.wb)
this.bound := []
}
}
else if (hWnd == this.hIES)
else if (hWnd == this.hIES || hWnd == this.hSDOV)
{
; Handle messages for the rendered Internet Explorer_Server

if (Msg == this.WM_KEYDOWN)
pressed := (Msg == this.WM_KEYDOWN || Msg == this.WM_SYSKEYDOWN)
released := (Msg == this.WM_KEYUP || Msg == this.WM_SYSKEYUP)

if (pressed || released)
{
; Accelerator handling code from AutoHotkey Installer
; Track modifier states
if (bit := this.MODIFIER_BITMAP[wParam])
this.modifiers := (this.modifiers & ~bit) | (pressed * bit)

; Block disabled key combinations
if (this.disabled_shortcuts[this.modifiers, wParam])
return 0

if (Chr(wParam) ~= "[A-Z]" || wParam = 0x74) ; Disable Ctrl+O/L/F/N and F5.
return

; When you press tab with the last tabbable item in the
; document already selected, focus will be taken from the IES
; control and moved to the SDOV control. The accelerator code
; from the AutoHotkey installer uses a conditional loop in an
; attempt to work around this behavior, but as implemented it
; did not work correctly on my system. Instead, listen for the
; tab up event on the SDOV and swap it for a tab down before
; translating it. This should prevent the user from tabbing to
; the SDOV in most cases, though there may still be some way to
; tab to it that I am not aware of. A more elegant solution may
; be to subclass the SDOV like was done for the IES, then
; forward the WM_SETFOCUS message back to the IES control.
; However, given the relative complexity of subclassing and the
; fact that this message substution approach appears to work
; just as well, we will use the message substitution. Consider
; implementing the other approach if it turns out that the
; undesirable behavior continues to manifest under some
; circumstances.
Msg := hWnd == this.hSDOV ? this.WM_KEYDOWN : Msg

; Modified accelerator handling code from AutoHotkey Installer
Gui +OwnDialogs ; For threadless callbacks which interrupt this.
pipa := ComObjQuery(this.wb, "{00000117-0000-0000-C000-000000000046}")
VarSetCapacity(kMsg, 48), NumPut(A_GuiY, NumPut(A_GuiX
, NumPut(A_EventInfo, NumPut(lParam, NumPut(wParam
, NumPut(Msg, 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 || this.wb.document.activeElement != ""
r := DllCall(NumGet(NumGet(1*pipa)+5*A_PtrSize), "ptr", pipa, "ptr", &kMsg)
ObjRelease(pipa)
if r = 0 ; S_OK: the message was translated to an accelerator.

if (r == 0) ; S_OK: the message was translated to an accelerator.
return 0
return
}
Expand Down Expand Up @@ -430,6 +493,7 @@ class NeutronWindow
}

; Otherwise (since above didn't return), pass all unhandled events to the original WindowProc.
Critical, Off
return DllCall("CallWindowProc"
, "Ptr", this.pWndProcOld ; WNDPROC lpPrevWndFunc
, "Ptr", hWnd ; HWND hWnd
Expand Down
Loading

0 comments on commit 4de4c32

Please sign in to comment.