I have the Microsoft Ergonomic keyboard 4000, and was trying to configure AutoHotKey to use the Favorite keys 1 through 5 for simple tasks like Buy Market Order, Sell Market order etc, on TOS.. However, it doesn't recognize it at all. I have it run as Administrator. I figured out the keys for Favorites as well, for example Favorite 1 key is 0100000000050000, Favorite 2 is 0100000000090000. But somehow those keys don't work with TOS. Did anyone get this to work ?
Thanks, yes that's how I was able to find the AHK key for Favorite keys - for example Favorite 1 key is 0100000000050000, Favorite 2 is 0100000000090000. Unfortunately, that's how far I could get. I tried running it in Administrator mode as well, no success. It is almost like TOS doesn't allow AHK to work with that. I have TOS hotkeys enabled, and that works fine.. But just trying to see if I can do it via the Favorite keys, since it's not a combination key. nothing better to do!
@bmn which one do you have TOS running: Live, OnDemand, or Papertrade? I could be wrong, but I'm thinking hotkeys only work in TOS with live trading. Try swapping out the key sends from AHK with mouse clicks on the correct button.
@bmn which one do you have TOS running: Live, OnDemand, or Papertrade? I could be wrong, but I'm thinking hotkeys only work in TOS with live trading. Try swapping out the key sends from AHK with mouse clicks on the correct button.
Thanks for replying. I have tried with Live and OnDemand (haven't tried Paper Trade yet). But the layout is the same, and since AHK goes with the coordinates, it should "click" on the Buy Market button as I trace it with mouse. Maybe AHK doesn't recognize the Favorite keys on this specific keyboard - image below, note the top 5 buttons labeled 1 through 5, those are the Favorite keys. I see AHK does recognize the other keys correctly. I have run the script to see what keys get recorded in AHK when I press say Favorite key 1, and that's what gives that code "0100000000050000".. However, when I put that in the AutoHotKey.ahk file for the "Buy Market" button, nothing happens.
Not sure what you mean here, AHK can't recognize a button control just because you move your mouse pointer over it.
You have to use a line of code in your AHK script such as:
Ruby:
MouseClick, Left, 1580, 125, 1, 0
Where 2nd and 3rd parameters are coordinates on screen where the button control is located.
Not sure what you mean here, AHK can't recognize a button control just because you move your mouse pointer over it.
You have to use a line of code in your AHK script such as:
Ruby:
MouseClick, Left, 1580, 125, 1, 0
Where 2nd and 3rd parameters are coordinates on screen where the button control is located.
AHK returned the raw data when you pressed the Favorite key 1 (0100000000050000), so it does recognize the key press.
Have you tried using one of the regular keys to test that everything beyond what key you use is working?
If you want post your AHK script, I might be able to help you troubleshoot it.
Yes, it works fine if I use say "Ctrl+1" as the hotkey. The Buy Market gets triggered without problem. It's just those 5 favorite keys that don't get recognized.
Here's the code from my .ahk file - thanks for checking this for me!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ThinkorSwim hotkeys
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;
;Buy Market action - to buy 1 contract of /ES
;;;;;;;;;;;
; Favorites 1
; ^1:: works fine using Ctrl+1
0100000000050000:
IfWinNotActive, Main@thinkorswim [build 1974], , WinActivate, Main@thinkorswim [build 1974],
MouseClick, left, 2004, 149
Sleep, 100
return
From just glancing over it, you will repurpose the "example.ahk" in the link above as your "Buy Market" script.
When you run the file, it will pull from the other two scripts.
Both the example.ahk and Natural_keyboard_4000_support.ahk have #include statements where you
may have to change the file directory to match where you saved the files.
From just glancing over it, you will repurpose the "example.ahk" in the link above as your "Buy Market" script.
When you run the file, it will pull from the other two scripts.
Both the example.ahk and Natural_keyboard_4000_support.ahk have #include statements where you
may have to change the file directory to match where you saved the files.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
How do I get started?
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.