P.I. Engineering User Forum

Product Support, Technical Questions and Answers, and Examples for P.I. Engineering Products

You are not logged in.

#1 2016-07-09 15:39:20

dan2004
Member
Registered: 2016-07-09
Posts: 2

Trying to get keystroke combination to work

Hi,

Using:
X-keys® XK-3 Foot Pedal - Rear Hinged
Windows 7 (64 bit)


I am having some problems writing some scripting code. To test the keystroke combinations that I am trying to execute, I first went into the Keystrokes tab of the first foot pedal. Here I would enter a keystroke combination and not touch the script code. I would then go into Pro Tools, a recording studio software, make sure the focus was on Pro Tools, and try the foot pedal to execute the keystroke combination. Here are two examples of the keystroke combinations that I tested. The first example works, the second one does not and I am trying to figure out why the second example does not work.

Example 1:

One of the things I am trying to do is delete a track while the software is still recording. If you delete the track while the track is still recording Pro Tools will delete it entirely from your session and from the hard drive. This Pro Tools feature enables you not to clutter up your session with a bunch of tracks that you do not want. To do this, you would enter the keystroke combination: CTRL + "." (period) This is illustrated in example 1 which works with no problem.

Case 1001 'Button 001
    If State 'Pressed          [MWTAG10]
        '<Keys[<LCtrl>↓.↓.↑<LCtrl>↑]>
        MW3.sendScanCode("29:1,52:1,52:0,29:0")
        '</Keys[<LCtrl>↓.↓.↑<LCtrl>↑]>
    Else 'Released             [MWTAG11]
    End If 'Press-Release      [/MWTAG10/MWTAG11]

Example 2:

Another feature of Pro Tools is to select a track to record. There are four parts. First, you would press CTRL + ALT + F and a dialog would open asking for the track number. Second, you would enter a number. Third, you would press ENTER. Fourth, you would press SHIFT + R to record enable the selected track. Example 2 shows the first of the four parts (CTRL + ALT + F). It will not work and I am unable to determine why.

Case 1001 'Button 001
    If State 'Pressed          [MWTAG10]
        '<Keys[<LCtrl>↓<LAlt>↓f↓f↑<LCtrl>↑<LAlt>↑]>
        MW3.sendScanCode("29:1,56:1,33:1,33:0,29:0,56:0")
        '</Keys[<LCtrl>↓<LAlt>↓f↓f↑<LCtrl>↑<LAlt>↑]>
    Else 'Released             [MWTAG11]
    End If 'Press-Release      [/MWTAG10/MWTAG11]

The following is a listing of all the code to select and record enable 4 tracks. Note that on the first selection for track one, when entering CTRL + ALT + F to open the track selection dialog box, the dialog box automatically populates with a "1". I do not enter a track number as is done for tracks 2, 3 and 4. I just hit ENTER

All Code:

Track 1

                     1.  Open Track Selection Dialog Box:

                '<Keys[<LCtrl>↓<LAlt>↓f↓f↑<LCtrl>↑<LAlt>↑]>
                MW3.sendScanCode("29:1,56:1,33:1,33:0,29:0,56:0")
                '</Keys[<LCtrl>↓<LAlt>↓f↓f↑<LCtrl>↑<LAlt>↑]>

                      2. The track selection dialog box is already populated with a "1" so no number is entered. I just select ENTER

                      3. Press ENTER

                '<Keys[<Enter>↓<Enter>↑]>
                MW3.sendScanCode("28:1,28:0")
                '</Keys[<Enter>↓<Enter>↑]>

                      4. Press SHIFT + R to record enable track

                '<Keys[<LShift>↓r↓r↑<LShift>↑]>
                MW3.sendScanCode("42:1,19:1,19:0,42:0")
                '</Keys[<LShift>↓r↓r↑<LShift>↑]>

____________________________________________________________________________________________________

Track 2
                        1. Open Track Selection Dialog Box:

                '<Keys[<LCtrl>↓<LAlt>↓f↓f↑<LCtrl>↑<LAlt>↑]>
                MW3.sendScanCode("29:1,56:1,33:1,33:0,29:0,56:0")
                '</Keys[<LCtrl>↓<LAlt>↓f↓f↑<LCtrl>↑<LAlt>↑]>
           
                         2. Enter Track Number:

                '<Keys[2↓2↑]>
                MW3.sendScanCode("3:1,3:0")
                '</Keys[2↓2↑]>

                         3. Press ENTER

                '<Keys[<Enter>↓<Enter>↑]>
                MW3.sendScanCode("28:1,28:0")
                '</Keys[<Enter>↓<Enter>↑]>

                         4. Press SHIFT + R to record enable track

                '<Keys[<LShift>↓r↓r↑<LShift>↑]>
                MW3.sendScanCode("42:1,19:1,19:0,42:0")
                '</Keys[<LShift>↓r↓r↑<LShift>↑]>

__________________________________________________________________________________________________


Track 3


                '<Keys[<LCtrl>↓<LAlt>↓f↓f↑<LCtrl>↑<LAlt>↑]>
                MW3.sendScanCode("29:1,56:1,33:1,33:0,29:0,56:0")
                '</Keys[<LCtrl>↓<LAlt>↓f↓f↑<LCtrl>↑<LAlt>↑]>

                '<Keys[3↓3↑]>
                MW3.sendScanCode("4:1,4:0")
                '</Keys[3↓3↑]>

                '<Keys[<Enter>↓<Enter>↑]>
                MW3.sendScanCode("28:1,28:0")
                '</Keys[<Enter>↓<Enter>↑]>

                '<Keys[<LShift>↓r↓r↑<LShift>↑]>
                MW3.sendScanCode("42:1,19:1,19:0,42:0")
                '</Keys[<LShift>↓r↓r↑<LShift>↑]>

___________________________________________________________________________________________________


Track 4



                '<Keys[<LCtrl>↓<LAlt>↓f↓f↑<LCtrl>↑<LAlt>↑]>
                MW3.sendScanCode("29:1,56:1,33:1,33:0,29:0,56:0")
                '</Keys[<LCtrl>↓<LAlt>↓f↓f↑<LCtrl>↑<LAlt>↑]>

                '<Keys[4↓4↑]>
                MW3.sendScanCode("5:1,5:0")
                '</Keys[4↓4↑]>

                '<Keys[<Enter>↓<Enter>↑]>
                MW3.sendScanCode("28:1,28:0")
                '</Keys[<Enter>↓<Enter>↑]>

                '<Keys[<LShift>↓r↓r↑<LShift>↑]>
                MW3.sendScanCode("42:1,19:1,19:0,42:0")
                '</Keys[<LShift>↓r↓r↑<LShift>↑]>

Last edited by dan2004 (2016-07-10 09:12:32)

Offline

#2 2016-07-11 08:18:55

PIE Amber
Technical Software Developer
From: Williamston, MI
Registered: 2016-01-21
Posts: 196
Website

Re: Trying to get keystroke combination to work

Hi Dan, we are closed on the weekend which is why you are not getting a response until now.

This sounds like it could be a timing issue. If the macro is intended to ONLY  be Ctrl+Alt+F you can check the "Separate up and down keystrokes" box on the recording window; then record your macro.

If you intend to later add the rest of the sequence in, try something like this:

1) Program your keystroke combination as normal
2) "Pause" recording on the recording window
3) Double-click in your keystroke line to insert a cursor
4) Split the keystrokes between the "downs" and "ups" by hitting Enter on your keyboard (you will end up with two lines -- one with Ctrl down, Alt down, F down, and the other with the respective "ups")
5) Program a delay into your macro by going to the Function tab, clicking show Functions, then near the bottle of the list double-clicking Delay
6) Adjust the delay time; you probably do not need the full 500ms -- I'd start with 50ms
7) Delay was probably inserted at the bottom of your macro; move it to where it needs to be by selecting the "Delay" line where it says 'func' and drag it to the spot in between your two keystroke lines


Amber from P.I. Engineering

Offline

#3 2017-01-04 09:57:57

Alvinadam
Member
From: Uk
Registered: 2017-01-04
Posts: 1
Website

Re: Trying to get keystroke combination to work

There are a few changes in the way the newest versions of FoxPro and FoxPro 2.6 define certain of their steering key mixtures. Below are a insufficient of the greatest appreciated steering key instructions that are novel or different.

Offline

Board footer

Powered by FluxBB