Past performance is not necessarily indicative of future results. Trading is very risky and you can lose more than you have invested. There may be errors in this code, and it must not be used for live trading. No express or implied warranties are provided. This code is provided for educational purposes on an As Is, Where Is basis. Message.Format("CTRL E ( %d ) were pressed", PressedChar) If ((PressedChar = 5)) // CTRL E = ASCII value of 5 Also note that you do not need to include sc.IsKeyPressed, only the ASCII code. When you press CTRL SHIFT E, the above if stmt triggers AND so does the one below. NOTE: The following will trigger even if you use another key in the combination. Message.Format("Control, Shift and E ( %d ) were pressed", PressedChar) If ((sc.IsKeyPressed_Control & sc.IsKeyPressed_Shift & PressedChar = 5)) Message.Format("sc.KeyboardKeyEventCode metod - Windows Virtual Key: E ( %d ) was pressed", PressedKey) If ((PressedKey = 69)) // E = Windows Virtual Key value of 69 Message.Format("sc.CharacterEventCode method - ASCII: E ( %d ) was pressed", PressedChar) If ((PressedChar = 101)) // E = ASCII value of 101 Int PressedKey = sc.KeyboardKeyEventCode SCSFExport scsf_KeyboardTest01aT4p(SCStudyInterfaceRef sc) SCDLLName("Keyboard Test v01a 03-07 2120 T4p DLL") Sc.KeyboardKeyEventCode and Windows Virtual Key Code number will NOT work.įor combinations, one must use sc.CharacterEventCode and the ASCII value. However, it appears that when trying to use a combination of keys, i.e. If a single key is pressed, it appears that one can use sc.KeyboardKeyEventCode *** Prepared for educational purposes only, see terms at end of code ***įile: Keyboard-Test-v01a-20190307-2120.cpp I hope this all helps and saves someone a lot of time. You can determine the ASCII and Window Virtual Key numbers by loading the SC provided custom study called Receive Keyboard Events Example.įinally, here is the script. See the code below for a specific example.ĥ. In other words, it appears that the SHIFT is ignored. However, CTRL E and CTRL SHIFT E will BOTH trigger if CTRL SHFIT E is pressed. For example: CTRL SHIFT E will correctly not trigger if you just use CTRL E. I found that one has to be careful with different key combinations. Then see if something appears in the Key Currently Used By box.Ĥ. In the meantime, the only way I could figure out to determine if a key combination is used, is to open up the Global Settings > Customize Keyboard Shortcuts and select a key combination. Maybe SC will consider providing this option in a future release. Ideally, it would be nice if there was a way to print out the SC Keyboard Shortcuts with assigned values. Trying to figure out which combinations are in use is a bit of a pain. CTRL S Which is assigned to File > Save, it will not work. Specifically, if the combination is already assigned i.e. CTRL E) sc.KeyboardKeyEventCode and Windows Virtual Key Code number will NOT work.įor key combinations, one must use sc.CharacterEventCode and the ASCII value.ģ. It also appears that when trying to use a combination of keys (i.e. You cannot use ASCII with sc.KeyboardKeyEventCode nor a Windows Virtual Key Code number with sc.CharacterEventCode.Ģ. You can also use sc.CharacterEventCode and an ASCII number. the letter e, it appears that you can use sc.KeyboardKeyEventCode and a Windows Virtual Key Code number. Summary of findings (see script below for actual examples):ġ. Please feel free to use parts or all of the script in the SC documentation. Accordingly, I have included a small script that I used when trying to figure out the shortcut keys. I think it will also be immensely helpful if there were some coding examples. I was able to get the shortcut keys working with ASCIL and provide some comments below to help anyone reading this.Īs an aside, I found the documentation a bit lacking on this topic and thought it might be helpful if SC included some of the following in the documentation.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |