6 ms·
Somewhat timely. AHK is one of those utilities I absolutely cannot go without. I've been running it on all my Windows machines for 15 years now. Just a few day
by function_seven 4y ago
Somewhat timely. AHK is one of those utilities I absolutely cannot go without. I've been running it on all my Windows machines for 15 years now.
Just a few days ago I was complaining¹ about how Excel handles formula input. After some back and forth on my yak-shaving attempt, I realized I could shave it myself with AHK.
With this little bit of code, my [Enter] and [Tab] keys work the way I want them to in Excel. This is still version 1.1, not 2.0:
; Try to "fix" Excel formula bar
; ==============================
IsExcelFormulaBox()
{
ControlGetFocus, F, A
return (F="EXCEL<1")
}
#if IsExcelFormulaBox()
Tab::
; Look for the little function list that pops up when suggestions are available.
ControlGet, X, Visible,, SysListView321, ahk_class __XLACOOUTER
; If list is visible, then pass [Tab] through. If not, insert 4 spaces
if (X) {
Send {Tab}
} else {
Send {Space}{Space}{Space}{Space}
}
return
; Swap [Enter] and [Alt]+[Enter]
$!Enter::Send {Enter}
$Enter::Send !{Enter}
#if
[1] https://news.ycombinator.com/item?id=34176791 https://news.ycombinator.com/item?id=34176791
- cfiggers 4y ago...holy crap. You just blew my mind. I have HUNDREDS of little AHK hotkeys. I use some of them dozens of times a day. I've been wanting some way to directly target Excel like this for literal years. Thank you!!!
- function_seven 4y ago:) I’m kinda both proud and ashamed. I’ve also hated the ergonomics of the formula bar for years, but never tried to do anything about it. I’ll bet I find more weird corner cases with this hot key. My first attempt didn’t handle the autocomplete, and that was a big letdown until I found the workaround. I’m sure I’ll run into something else as well.
- snthpy 4y agoSorry I'm on my phone right now so can't test this out so what does this do exactly? I just have my formula bar set at 3 lines and F2 edits in the formula box always. I find that works well for me. What frustrations do you have with the default setup?
- function_seven 4y agoI like to do multi-line formulas and use indentation as well. To insert a newline you have to press [Alt]+[Enter]. To indent you can’t use [Tab], so you have to manually space it out. My script swaps the [Enter] key behavior so regular pressing inserts the newline and Alt+Enter commits the formula. It also converts a Tab press to 4 spaces (rather than focusing away from the bar)
- snthpy 4y agoAlso, are you aware of the new Advanced Formula Environment? https://youtu.be/yIAl1XbuVzU https://youtu.be/yIAl1XbuVzU
- function_seven 4y agoI wasn’t until last week. Pony_Sheared linked me to it https://news.ycombinator.com/item?id=34178234 https://news.ycombinator.com/item?id=34178234 I downloaded it but haven’t had a chance to tinker.
- cfiggers 4y agoIn return, as a token of my gratitude, I give you a script that allows horizontal scrolling in Excel with Shift + Mousewheel (bafflingly not a default in Excel, even though that's becoming standard almost everywhere else): ; Excel horizontal scroll with Shift + Mousewheel #IfWinActive, ahk_exe EXCEL.EXE +WheelUp:: SetScrollLockState, On SendInput {Left} SetScrollLockState, Off Return +WheelDown:: SetScrollLockState, On SendInput {Right} SetScrollLockState, Off Return #if
- function_seven 4y agoI just added it. Yes, thank you, this works great.
- sieabahlpark 4y ago[dead]
- animal531 4y agoMy favourite script was from when I was playing Diablo 3 heavily (around 2015), but for a while I had been pressing my mouse hand too hard into my mouse pad which were causing some RSI issues. I found a +-300 line script which allowed me to play with a controller (made by zarzare), I modified it for the different classes and it worked ridiculously well. It used basic trig to create a circle around the player's position and cast abilities in that direction. You could specify a short/long range so abilities could be cast either short or far, depending on the range of the ability.