Compatible with MacroWorks 3.1.
It is possible to configure your X-Keys device to be able to check to see if a specific application is running, and do something in that application. This does require some basic programming knowledge (Visual Basic .NET).
In MacroWorks, select the key you wish to use and hover the mouse over it. A tooltip will pop up giving you the key’s ID number. Go to Window > Script Code, and scroll down until you find the ‘Case’ line with your key number in it. For example, key 58 would have the Case line ‘Case 1058’.
Each Case is split into three parts – If, Else, and End If. This works in exactly the same way to any other If statement in Visual Basic .NET. As part of the If statement, you will need to use MW3.IsActiveWindow to determine if the active process is the one you want to manipulate with your X-Keys, and you will need the command MW3.WindowToFront for the Else part of the statement.
MW3.IsActiveWindow requires a variable to make it work – the name of the process you want to use. For example, for Microsoft Outlook, the required line would read:
If MW3.IsActiveWindow(“OUTLOOK”)
This is a Boolean variable which will return wither True, if Outlook is the active window, or False if another window is active. If True, it will press on with the other commands in the If part of the statement, and if False, it will move on to the commands under Else.
MW3.WindowToFront requires a string containing the title of a window. For example, to bring an Outlook window to the front, this line would read:
MW3.WindowToFront(“Inbox – Microsoft Outlook”)
This would bring the Outlook window to the front, providing Outlook was open on the Inbox screen. Any other folder apart from Inbox would require its own WindowToFront command. If you are following this command up with another, it would be best to add a delay in between the commands, to ensure the window you want is the active one before the next command starts.
Below is a complete example created on an X-Keys Professional, for key 58. It will check to see if Outlook is the active window, and if not bring it forward. Then it launches a new email window.
Please note, this will only work if you have an active window on your system. If your Desktop is showing, it will not work.
Case 1058 ‘Button 058
If State ‘Pressed [MWTAG10]
If MW3.IsActiveWindow(“OUTLOOK”)
‘<Keys[<RCtrl>↓n↓n↑<RCtrl>↑]>
MW3.sendScanCode(“285:1,49:1,49:0,285:0″)
‘</Keys[<RCtrl>↓n↓n↑<RCtrl>↑]>
Else
MW3.WindowToFront(“Inbox – Microsoft Outlook”)
‘<Delay[1000]>
MW3.insertDelay(1000)
‘</Delay[1000]>
‘<Keys[<RCtrl>↓n↓n↑<RCtrl>↑]>
MW3.sendScanCode(“285:1,49:1,49:0,285:0″)
‘</Keys[<RCtrl>↓n↓n↑<RCtrl>↑]>
End If
Else ‘Released [MWTAG11]
End If ‘Press-Release [/MWTAG10/MWTAG11]
The post ‘If’ Statements on the X-Keys appeared first on
Steadlands.