by numeromancer on 1/4/23, 5:06 PM with 120 comments
by function_seven on 1/4/23, 8:10 PM
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=34176791by infogulch on 1/4/23, 11:10 PM
I learned programming with AHK back before data structures like maps and arrays even existed (!), and I'm happy to see it's still getting better. I still use a few utilities that I built on a daily basis.
by url00 on 1/4/23, 7:19 PM
So many great quality of life improvements and overall the documentation is top notch. I cobbled together a launcher app and modal-hotkey system from scratch in a couple of afternoons of enjoyable work.
If you're looking to try stuff out, having an autoreload function is a very nice addition to your script while developing.
A very pragmatic and productive experience.
by otterpro on 1/4/23, 10:11 PM
by bsnnkv on 1/4/23, 8:36 PM
I'm taking a month off from development while I'm traveling, maybe I'll feel less salty about this when I get back.
The biggest issue right now is that the Run and RunWait commands require strings for the commands to be executed, and AHK v2 has absolutely garbage support for string interpolation.
Honestly I'm not sure if I'll continue supporting AHK or just develop my own sxhkd (swhkd?) and recommend that for users going forward.
[1]: https://github.com/LGUG2Z/komorebi
[2]: https://github.com/LGUG2Z/komorebi/blob/master/komorebic.lib...
by bluedino on 1/5/23, 1:40 AM
We had an old Tadiran phone system, and it was losing time. Randomly through the day it would lose anywhere from five minutes to two hours.
Of course, the system wasn't under maintenance any longer, and the phone place wanted $4,000 for a new motherboard (the crystal was bad so the clock was wrong, or so they said). Considering everything else worked fine, we just manually set the clock here and there.
And then I found AHK, and wrote a quick script that logged into the phone software, entered the correct time, and saved it to the system. Set that to run every hour and ever heard anyone complain about it again.
by rektide on 1/4/23, 5:21 PM
I do wish programmers had more options in general for this kind of thing. I ran into https://github.com/autopilot-rs/autopilot-rs lately but it is extremely simple. On Windows there s UI Automation, which can help script many conventional apps. https://learn.microsoft.com/en-us/dotnet/framework/ui-automa...
by mrandish on 1/4/23, 7:57 PM
by nikanj on 1/4/23, 8:13 PM
The latest was Crowdstrike Falcon (AI POWERED!!1) flagging signtool.exe as malware. The one from the Windows SDK. By Microsoft. Signed with Microsoft keys.
by swader999 on 1/5/23, 4:56 AM
by BrandoElFollito on 1/4/23, 9:34 PM
The most complicated pay for me are braces and delimiters: I never know when to use a brace, when to use style #-delimiters (#HotIf for instance), when a mineral is enough, etc.
It would be much better if there was a decision to be homogenous and always require braces, or newlines or whatever - but always the same thing.
by JohnBerea on 1/5/23, 1:04 AM
by NelsonMinar on 1/5/23, 2:10 AM
by slig on 1/4/23, 7:45 PM
by keybored on 1/4/23, 7:24 PM
> One function may be defined inside another. A nested function may automatically "capture" non-static local variables from the enclosing function (under the right conditions), allowing them to be used after the enclosing function returns.
That sounds like a closure. I expected “nested” to mean that the function is defined inside another function but doesn’t capture anything, like what you can do in Rust. (It’s IMO a “why not?” feature—why don’t more languages allow it? It’s certainly useful for helper functions which are only consumed by one other function.)
by FloatArtifact on 1/4/23, 11:29 PM
by LoveMortuus on 1/7/23, 1:03 PM
I have a ~5000loc script that I've been planning to rewrite, but there was never much reason except stability. But I guess now is the right time!
I am still looking for some modern AI OCR for AHK, because the solutions that I've found this far hasn't really worked well.
I must say, working with AHK is always fun, even though not implementing press ESC to exit the script can be quite fun.
by wolpoli on 1/5/23, 5:54 AM
by puffybuf on 1/4/23, 9:03 PM
It is great for automating things.
by tadamm on 1/10/23, 6:52 PM
by csdvrx on 1/4/23, 8:14 PM
by trts on 1/5/23, 5:34 AM
Text Shortcuts on Mac is limited and unreliable, and I haven’t found a good 3rd party replacement yet.
by maximus-decimus on 1/5/23, 7:39 PM
by brrizna on 1/5/23, 5:42 PM
by Kab1r on 1/5/23, 6:41 AM
by LoveMortuus on 1/7/23, 1:06 PM
by just-tom on 1/5/23, 9:06 AM
by bryanrasmussen on 1/4/23, 8:47 PM
by cool-RR on 1/4/23, 8:57 PM
I hope that this upgrade will fix some of these problems. I'll probably take a few years before I upgrade my AHK scripts.
by numeromancer on 1/4/23, 5:06 PM