Skip to content

Commit

Permalink
Clean up Kontakt code / Add more menu checks
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejGolian committed Oct 17, 2024
1 parent e787b6a commit b77941b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
20 changes: 8 additions & 12 deletions Includes/Overlays/Kontakt7.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ Class Kontakt7 {
Plugin.SetTimer("Kontakt 7", ObjBindMethod(Kontakt7, "CheckPluginMenu"), 200)

Plugin.Register("Kontakt 7 Content Missing Dialog", "^NIChildWindow[0-9A-F]{17}$",, False, False, True, ObjBindMethod(Kontakt7, "CheckPluginContentMissing"))
Plugin.SetHotkey("Kontakt 7 Content Missing Dialog", "!F4", ObjBindMethod(Kontakt7, "ClosePluginContentMissingDialog"))
Plugin.SetHotkey("Kontakt 7 Content Missing Dialog", "Escape", ObjBindMethod(Kontakt7, "ClosePluginContentMissingDialog"))

PluginContentMissingOverlay := AccessibilityOverlay("Content Missing")
PluginContentMissingOverlay.AddHotspotButton("Browse For Folder", 226, 372).SetHotkey("!B", "Alt+B")
Expand Down Expand Up @@ -136,16 +134,6 @@ Class Kontakt7 {
}
}

Static ClosePluginContentMissingDialog(*) {
Critical
If ReaHotkey.FoundPlugin Is Plugin And WinExist(ReaHotkey.PluginWinCriteria) And WinActive(ReaHotkey.PluginWinCriteria)
If ReaHotkey.FoundPlugin.Name = "Kontakt 7 Content Missing Dialog" And WinGetTitle("A") = "content Missing" {
ReaHotkey.FoundPlugin.Overlay.Reset()
WinClose("A")
Sleep 500
}
}

Static CloseStandaloneBrowser() {
UIAElement := GetUIAElement("1,14,3")
If Not UIAElement = False And RegExMatch(UIAElement.ClassName, "^LumenButton_QMLTYPE_[0-9]+$") {
Expand Down Expand Up @@ -174,6 +162,7 @@ Class Kontakt7 {

Class ActivatePluginHeaderButton {
Static Call(HeaderButton) {
Critical
UIAElement := False
Switch HeaderButton.Label {
Case "FILE menu":
Expand All @@ -191,10 +180,12 @@ Class Kontakt7 {
Switch HeaderButton.Label {
Case "FILE menu":
UIAElement.Click("Left")
Kontakt7.CheckPluginMenu()
Case "LIBRARY On/Off":
UIAElement.Click("Left")
Case "VIEW menu":
UIAElement.Click("Left")
Kontakt7.CheckPluginMenu()
Case "SHOP (Opens in default web browser)":
UIAElement.Click("Left")
}
Expand All @@ -205,6 +196,7 @@ Class Kontakt7 {

Class ActivatePluginSnapshotButton {
Static Call(SnapshotButton) {
Critical
UIAElement := GetUIAElement("15,1,5")
If Not UIAElement = False And UIAElement.Name = "SHOP" {
Try
Expand All @@ -218,6 +210,7 @@ Class Kontakt7 {
If InStr(SnapshotButton.Label, "Snapshot", True) {
Kontakt7.MoveToPluginSnapshotButton(SnapshotButton)
Click
Kontakt7.CheckPluginMenu()
Return
}
Else {
Expand All @@ -238,6 +231,7 @@ Class Kontakt7 {

Class ActivateStandaloneHeaderButton {
Static Call(HeaderButton) {
Critical
UIAElement := False
Switch HeaderButton.Label {
Case "FILE menu":
Expand All @@ -255,10 +249,12 @@ Class Kontakt7 {
Switch HeaderButton.Label {
Case "FILE menu":
UIAElement.Click("Left")
Kontakt7.CheckStandaloneMenu()
Case "LIBRARY On/Off":
UIAElement.Click("Left")
Case "VIEW menu":
UIAElement.Click("Left")
Kontakt7.CheckStandaloneMenu()
Case "SHOP (Opens in default web browser)":
UIAElement.Click("Left")
}
Expand Down
20 changes: 8 additions & 12 deletions Includes/Overlays/Kontakt8.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ Class Kontakt8 {
Plugin.SetTimer("Kontakt 8", ObjBindMethod(Kontakt8, "CheckPluginMenu"), 200)

Plugin.Register("Kontakt 8 Content Missing Dialog", "^NIChildWindow[0-9A-F]{17}$",, False, False, True, ObjBindMethod(Kontakt8, "CheckPluginContentMissing"))
Plugin.SetHotkey("Kontakt 8 Content Missing Dialog", "!F4", ObjBindMethod(Kontakt8, "ClosePluginContentMissingDialog"))
Plugin.SetHotkey("Kontakt 8 Content Missing Dialog", "Escape", ObjBindMethod(Kontakt8, "ClosePluginContentMissingDialog"))

PluginContentMissingOverlay := AccessibilityOverlay("Content Missing")
PluginContentMissingOverlay.AddHotspotButton("Browse For Folder", 226, 372).SetHotkey("!B", "Alt+B")
Expand Down Expand Up @@ -136,16 +134,6 @@ Class Kontakt8 {
}
}

Static ClosePluginContentMissingDialog(*) {
Critical
If ReaHotkey.FoundPlugin Is Plugin And WinExist(ReaHotkey.PluginWinCriteria) And WinActive(ReaHotkey.PluginWinCriteria)
If ReaHotkey.FoundPlugin.Name = "Kontakt 8 Content Missing Dialog" And WinGetTitle("A") = "content Missing" {
ReaHotkey.FoundPlugin.Overlay.Reset()
WinClose("A")
Sleep 500
}
}

Static CloseStandaloneBrowser() {
UIAElement := GetUIAElement("1,14,3")
If Not UIAElement = False And RegExMatch(UIAElement.ClassName, "^LumenButton_QMLTYPE_[0-9]+$") {
Expand Down Expand Up @@ -174,6 +162,7 @@ Class Kontakt8 {

Class ActivatePluginHeaderButton {
Static Call(HeaderButton) {
Critical
UIAElement := False
Switch HeaderButton.Label {
Case "FILE menu":
Expand All @@ -191,10 +180,12 @@ Class Kontakt8 {
Switch HeaderButton.Label {
Case "FILE menu":
UIAElement.Click("Left")
Kontakt8.CheckPluginMenu()
Case "LIBRARY On/Off":
UIAElement.Click("Left")
Case "VIEW menu":
UIAElement.Click("Left")
Kontakt8.CheckPluginMenu()
Case "SHOP (Opens in default web browser)":
UIAElement.Click("Left")
}
Expand All @@ -205,6 +196,7 @@ Class Kontakt8 {

Class ActivatePluginSnapshotButton {
Static Call(SnapshotButton) {
Critical
UIAElement := GetUIAElement("15,1,5")
If Not UIAElement = False And UIAElement.Name = "SHOP" {
Try
Expand All @@ -218,6 +210,7 @@ Class Kontakt8 {
If InStr(SnapshotButton.Label, "Snapshot", True) {
Kontakt8.MoveToPluginSnapshotButton(SnapshotButton)
Click
Kontakt8.CheckPluginMenu()
Return
}
Else {
Expand All @@ -238,6 +231,7 @@ Class Kontakt8 {

Class ActivateStandaloneHeaderButton {
Static Call(HeaderButton) {
Critical
UIAElement := False
Switch HeaderButton.Label {
Case "FILE menu":
Expand All @@ -255,10 +249,12 @@ Class Kontakt8 {
Switch HeaderButton.Label {
Case "FILE menu":
UIAElement.Click("Left")
Kontakt8.CheckStandaloneMenu()
Case "LIBRARY On/Off":
UIAElement.Click("Left")
Case "VIEW menu":
UIAElement.Click("Left")
Kontakt8.CheckStandaloneMenu()
Case "SHOP (Opens in default web browser)":
UIAElement.Click("Left")
}
Expand Down

0 comments on commit b77941b

Please sign in to comment.