Last active
February 7, 2021 08:35
-
-
Save dfch/e6e2b235c2a2dde52c6555236b96f78e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'=↓=↓=↓= MW3 Header Start =↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=[MWTAG1] | |
' Script Type: MacroWorks 3 Device Script | |
' Device Name: X-keys XK-24 | |
' Device Description: 24 Button HID Controller | |
' Script Name: XK-24 | |
' Script Description: Macros for XK-24 [MWTAG19] | |
' PID: 1029 | |
' Firmware: π3 V 28 | |
' MW3 Version: 15 | |
' Script Language: Visual Basic | |
' Script Template: Beta 1.0 | |
' Format: Unicode 8 | |
' P.I. Engineering, Inc. | |
' "The No Slogan Company" | |
' Williamston, Michigan, USA | |
' www.xkeys.com | |
' Start Date: 07/02/2021 09:20:17 [MWTAG20] | |
' Last Update: 07/02/2021 09:20:37 [MWTAG21] | |
' Default Mode: Hardware | |
' Show Select Mode: True | |
' Image Rotation: 0 | |
' Config Path: XK-24\ReportConfig_XK24.xml [MWTAG18] | |
'=↑=↑=↑= MW3 Header End =↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=[/MWTAG1] | |
'=↓=↓=↓= Notes Start =↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=[MWTAG2] | |
' User comment notes can go here. | |
' CAUTION: | |
' DO NOT MODIFY COMMENT LINES OR TAGS | |
' | |
' This file can contain both true VB script code, and special hardware codes to program | |
' the X-keys device's internal memory. These hardware codes are auto-generated by the | |
' MW3.1 GUI and are indicated by commented lines ending or bracketed with [HWTAG1]. | |
' DO NOT MODIFY THESE LINES! | |
' This can lead to corrupt data written to the device. | |
' Additionally other commented lines with [MWTAGx] or other formatting information | |
' for the GUI can be found through out this file. Modifying these comments can cause | |
' problems in the GUI. Always make back-ups before making any modifications to this file. | |
' | |
' ADDTIONAL NOTES: | |
' User comment notes can go here. This area is safe. | |
'=↑=↑=↑= Notes End =↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=[MWTAG2] | |
Imports Microsoft.VisualBasic | |
Imports System | |
Imports System.Collections.Generic | |
Public Class Script | |
Implements Interfaces.IScript '[MWTAG12] | |
'=↓=↓=↓= Initialize Variables Start =↓=↓=↓=↓=↓=↓=↓=↓=[MWTAG3] | |
Dim MW3 As Interfaces.MW3 | |
Dim MyDevice As Integer() = {1029, -1, 1} 'Device Descriptor [MWTAG8] | |
Dim AppName As String = "" 'Active application name | |
Dim AppTitle As String = "" 'Active application title | |
Dim Layer_Red As Integer = 0 'Red,3 | |
'=↑=↑=↑= Initialize Varibles End =↑=↑=↑=↑=↑=↑=↑=↑=↑=[/MWTAG3] | |
Public Sub Initialize(MW3 As Interfaces.MW3) Implements Interfaces.IScript.Initialize | |
Me.MW3 = MW3 | |
End Sub | |
Public Sub ScriptLoad() Implements Interfaces.IScript.ScriptLoad | |
LEDset() | |
MW3.SetAllBacklightLED(MyDevice,1,0) ' Turn red off | |
MW3.SetAllBacklightLED(MyDevice,0,1) ' Turn blue on | |
MW3.SetBacklightIntensity(MyDevice,255,255) 'blue and red max intensity | |
End Sub | |
Public Function ScriptUnload() As Boolean Implements Interfaces.IScript.ScriptUnload | |
End Function | |
Public Sub SysPowerChange(PowerState As Byte) Implements Interfaces.IScript.SysPowerChange | |
End Sub | |
Public Sub ActiveAppChange(ActiveAppTitle As String, ActiveAppName As String) Implements Interfaces.IScript.ActiveAppChange | |
AppName= ActiveAppName | |
AppTitle= ActiveAppTitle | |
End Sub | |
Public Sub DeviceChange(DevInfo As Integer(), plugged As Boolean) Implements Interfaces.IScript.DeviceChange | |
End Sub | |
Public Sub Initializing() Implements Interfaces.IScript.Initializing | |
End Sub | |
'=↓=↓=↓= Digital State Change Event Start =↓=↓=↓=↓=↓=↓=↓=[MWTAG4] | |
Public Sub XKEvent(CID As Integer, State As Boolean, Repeat As Integer, TimeStamp as Long, MessageData As Integer) Implements Interfaces.IScript.XKEvent | |
Select Case CID 'Button Check Start [MWTAG9] | |
Case 1001 'Button 001 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[F12↓F12↑]> | |
'HW.sendScanCode("88:1,88:0") | |
'</Keys[F12↓F12↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1002 'Button 002 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[Escape↓Escape↑]> | |
'HW.sendScanCode("1:1,1:0") | |
'</Keys[Escape↓Escape↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1003 'Button 003 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[1↓1↑]> | |
'HW.sendScanCode("2:1,2:0") | |
'</Keys[1↓1↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1004 'Button 004 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[LCtrl↓r↓r↑LCtrl↑]> | |
'HW.sendScanCode("29:1,19:1,19:0,29:0") | |
'</Keys[LCtrl↓r↓r↑LCtrl↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1005 'Button 005 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[LCtrl↓m↓m↑LCtrl↑]> | |
'HW.sendScanCode("29:1,50:1,50:0,29:0") | |
'</Keys[LCtrl↓m↓m↑LCtrl↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1006 'Button 006 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[F12↓F12↑F1↓F1↑s↓s↑a↓a↑]> | |
'HW.sendScanCode("88:1,88:0,59:1,59:0,31:1,31:0,30:1,30:0") | |
'</Keys[F12↓F12↑F1↓F1↑s↓s↑a↓a↑]> | |
'<Delay[50]> | |
'HW.insertDelay(50) | |
'</Delay[50]> | |
'<Keys[Down↓Down↑Down↓Down↑Down↓Down↑Down↓Down↑Down↓Down↑Down↓Down↑Down↓Down↑Down↓Down↑]> | |
'HW.sendScanCode("336:1,336:0,336:1,336:0,336:1,336:0,336:1,336:0,336:1,336:0,336:1,336:0,336:1,336:0,336:1,336:0") | |
'</Keys[Down↓Down↑Down↓Down↑Down↓Down↑Down↓Down↑Down↓Down↑Down↓Down↑Down↓Down↑Down↓Down↑]> | |
'<Delay[50]> | |
'HW.insertDelay(50) | |
'</Delay[50]> | |
'<Keys[Up↓Up↑Up↓Up↑Up↓Up↑Up↓Up↑Enter↓Enter↑]> | |
'HW.sendScanCode("328:1,328:0,328:1,328:0,328:1,328:0,328:1,328:0,28:1,28:0") | |
'</Keys[Up↓Up↑Up↓Up↑Up↓Up↑Up↓Up↑Enter↓Enter↑]> | |
'<Delay[50]> | |
'HW.insertDelay(50) | |
'</Delay[50]> | |
'<Keys[Enter↓Enter↑]> | |
'HW.sendScanCode("28:1,28:0") | |
'</Keys[Enter↓Enter↑]> | |
'<Delay[50]> | |
'HW.insertDelay(50) | |
'</Delay[50]> | |
'<Keys[Escape↓Escape↑s↓s↑]> | |
'HW.sendScanCode("1:1,1:0,31:1,31:0") | |
'</Keys[Escape↓Escape↑s↓s↑]> | |
'<Delay[50]> | |
'HW.insertDelay(50) | |
'</Delay[50]> | |
'<Keys[Enter↓Enter↑]> | |
'HW.sendScanCode("28:1,28:0") | |
'</Keys[Enter↓Enter↑]> | |
'<Delay[50]> | |
'HW.insertDelay(50) | |
'</Delay[50]> | |
'<Keys[Enter↓Enter↑LCtrl↓m↓m↑LCtrl↑]> | |
'HW.sendScanCode("28:1,28:0,29:1,50:1,50:0,29:0") | |
'</Keys[Enter↓Enter↑LCtrl↓m↓m↑LCtrl↑]> | |
'Release [HWTAG3] | |
'<Keys[Enter↓Enter↑Escape↓Escape↑a↓a↑]> | |
'HW.sendScanCode("28:1,28:0,1:1,1:0,30:1,30:0") | |
'</Keys[Enter↓Enter↑Escape↓Escape↑a↓a↑]> | |
'<Delay[50]> | |
'HW.insertDelay(50) | |
'</Delay[50]> | |
'<Keys[Enter↓Enter↑]> | |
'HW.sendScanCode("28:1,28:0") | |
'</Keys[Enter↓Enter↑]> | |
'<Delay[50]> | |
'HW.insertDelay(50) | |
'</Delay[50]> | |
'<Keys[F12↓F12↑]> | |
'HW.sendScanCode("88:1,88:0") | |
'</Keys[F12↓F12↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1007 'Button 007 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[F1↓F1↑]> | |
'HW.sendScanCode("59:1,59:0") | |
'</Keys[F1↓F1↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1008 'Button 008 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[Enter↓Enter↑]> | |
'HW.sendScanCode("28:1,28:0") | |
'</Keys[Enter↓Enter↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1009 'Button 009 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[F12↓F12↑F1↓F1↑s↓s↑]> | |
'HW.sendScanCode("88:1,88:0,59:1,59:0,31:1,31:0") | |
'</Keys[F12↓F12↑F1↓F1↑s↓s↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1010 'Button 010 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[F12↓F12↑LCtrl↓]> | |
'HW.sendScanCode("88:1,88:0,29:1") | |
'</Keys[F12↓F12↑LCtrl↓]> | |
'<Delay[500]> | |
'HW.insertDelay(500) | |
'</Delay[500]> | |
'<Keys[s↓]> | |
'HW.sendScanCode("31:1") | |
'</Keys[s↓]> | |
'<Delay[500]> | |
'HW.insertDelay(500) | |
'</Delay[500]> | |
'<Keys[s↑LCtrl↑]> | |
'HW.sendScanCode("31:0,29:0") | |
'</Keys[s↑LCtrl↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1011 'Button 011 | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1012 'Button 012 | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1013 'Button 013 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[F2↓F2↑]> | |
'HW.sendScanCode("60:1,60:0") | |
'</Keys[F2↓F2↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1014 'Button 014 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[LCtrl↓LAlt↓3↓3↑LAlt↑LCtrl↑]> | |
'HW.sendScanCode("29:1,56:1,4:1,4:0,56:0,29:0") | |
'</Keys[LCtrl↓LAlt↓3↓3↑LAlt↑LCtrl↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1015 'Button 015 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[F12↓F12↑F1↓F1↑s↓s↑a↓a↑]> | |
'HW.sendScanCode("88:1,88:0,59:1,59:0,31:1,31:0,30:1,30:0") | |
'</Keys[F12↓F12↑F1↓F1↑s↓s↑a↓a↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1016 'Button 016 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[F12↓F12↑F2↓F2↑Down↓Down↑Enter↓Enter↑q↓q↑]> | |
'HW.sendScanCode("88:1,88:0,60:1,60:0,336:1,336:0,28:1,28:0,16:1,16:0") | |
'</Keys[F12↓F12↑F2↓F2↑Down↓Down↑Enter↓Enter↑q↓q↑]> | |
'<Delay[500]> | |
'HW.insertDelay(500) | |
'</Delay[500]> | |
'<Keys[Enter↓Enter↑]> | |
'HW.sendScanCode("28:1,28:0") | |
'</Keys[Enter↓Enter↑]> | |
'<Delay[1000]> | |
'HW.insertDelay(1000) | |
'</Delay[1000]> | |
'<Keys[F12↓F12↑]> | |
'HW.sendScanCode("88:1,88:0") | |
'</Keys[F12↓F12↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1017 'Button 017 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[F12↓F12↑F1↓F1↑s↓s↑q↓q↑LAlt↓1↓1↑LAlt↑]> | |
'HW.sendScanCode("88:1,88:0,59:1,59:0,31:1,31:0,16:1,16:0,56:1,2:1,2:0,56:0") | |
'</Keys[F12↓F12↑F1↓F1↑s↓s↑q↓q↑LAlt↓1↓1↑LAlt↑]> | |
'Release [HWTAG3] | |
'<Delay[500]> | |
'HW.insertDelay(500) | |
'</Delay[500]> | |
'<Keys[F12↓F12↑]> | |
'HW.sendScanCode("88:1,88:0") | |
'</Keys[F12↓F12↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1018 'Button 018 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[F12↓F12↑F1↓F1↑s↓s↑q↓q↑LAlt↓1↓1↑LAlt↑]> | |
'HW.sendScanCode("88:1,88:0,59:1,59:0,31:1,31:0,16:1,16:0,56:1,2:1,2:0,56:0") | |
'</Keys[F12↓F12↑F1↓F1↑s↓s↑q↓q↑LAlt↓1↓1↑LAlt↑]> | |
'Release [HWTAG3] | |
'<Delay[100]> | |
'HW.insertDelay(100) | |
'</Delay[100]> | |
'<Keys[q↓q↑LAlt↓1↓1↑LAlt↑]> | |
'HW.sendScanCode("16:1,16:0,56:1,2:1,2:0,56:0") | |
'</Keys[q↓q↑LAlt↓1↓1↑LAlt↑]> | |
'<Delay[500]> | |
'HW.insertDelay(500) | |
'</Delay[500]> | |
'<Keys[F12↓F12↑]> | |
'HW.sendScanCode("88:1,88:0") | |
'</Keys[F12↓F12↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1019 'Button 019 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[F3↓F3↑]> | |
'HW.sendScanCode("61:1,61:0") | |
'</Keys[F3↓F3↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1020 'Button 020 | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1021 'Button 021 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[F12↓F12↑F1↓F1↑s↓s↑s↓s↑]> | |
'HW.sendScanCode("88:1,88:0,59:1,59:0,31:1,31:0,31:1,31:0") | |
'</Keys[F12↓F12↑F1↓F1↑s↓s↑s↓s↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1022 'Button 022 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[Up↓Up↑]> | |
'HW.sendScanCode("328:1,328:0") | |
'</Keys[Up↓Up↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1023 'Button 023 | |
'Layer_1 [HWTAG1] | |
'Press [HWTAG2] | |
'<Keys[Down↓Down↑]> | |
'HW.sendScanCode("336:1,336:0") | |
'</Keys[Down↓Down↑]> | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1024 'Button 024 | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1026 'ProgSwitch -restricted- | |
If State 'Pressed [MWTAG10] | |
'<Open-Close GUI> | |
If MW3.IsGUIOpen(MyDevice) | |
MW3.SetGUI(MyDevice,0,false) | |
Else | |
MW3.SetGUI(MyDevice,0,true) | |
End If | |
'</Open-Close GUI> | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1027 'Virtual ProgSwitch -restricted- | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
Case 1028 'Virtual On Boot -restricted- | |
If State 'Pressed [MWTAG10] | |
Else 'Released [MWTAG11] | |
End If 'Press-Release [/MWTAG10/MWTAG11] | |
End Select 'Button Check End [/MWTAG9] | |
If Repeat = 0 | |
LEDset() ' Set the Indicator LEDs | |
End If | |
End Sub | |
'=↑=↑=↑= Digital State Change Event End ↑=↑=↑=↑=↑=↑=↑=↑=↑=[/MWTAG4] | |
'=↓=↓=↓=Indicator LEDs Start =↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=↓=[MWTAG5] | |
Public Sub LEDset() | |
If Layer_Red = 1 | |
MW3.SetLED(MyDevice,3001,0) | |
MW3.SetLED(MyDevice,3002,1) 'Turn on the Red Indicator LED | |
Else | |
MW3.SetLED(MyDevice,3002,0)'Turn off the Red Indicator LED | |
MW3.SetLED(MyDevice,3001,1) | |
End if | |
End Sub | |
'=↑=↑=↑= Indicator LEDs End ↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=↑=[/MWTAG5] | |
'=↓=↓=↓=String Data Received Event Start =↓=↓=↓=↓=↓=↓=↓=↓=[MWTAG6] | |
Public Sub XKStringEvent(CID As Integer, StringData As String, Repeat As Integer, TimeStamp as Long, MessageData As Integer) Implements Interfaces.IScript.XKStringEvent | |
'String data is sent to this routine, this device does not send string data but this is required for MW3 compatibility. | |
End Sub | |
'=↑=↑=↑= String Data Received Event End ↑=↑=↑=↑=↑=↑=↑=↑=↑=[/MWTAG6] | |
'=↓=↓=↓= Analog Data Received Event Start =↓=↓=↓=↓=↓=↓=↓=↓[MWTAG7] | |
Public Sub XKAnalogEvent(CID As Integer, AnalogValue As Integer(), Repeat As Integer, TimeStamp as Long, MessageData As Integer) Implements Interfaces.IScript.XKAnalogEvent | |
'Analog data is sent to this routine, this device does not send analog data but this is required for MW3 compatibility. | |
End Sub | |
'=↑=↑=↑= Analog Data Received Event End ↑=↑=↑=↑=↑=↑=↑=↑=↑=[/MWTAG7] | |
End Class '[/MWTAG12] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment