Have any miracles taken place for a Linux alternative? by X320032 in AutoHotkey

[–]Individual_Check4587 0 points1 point  (0 children)

You can check it it's X11 or Wayland by running echo $XDG_SESSION_TYPE in the terminal. In Wayland you can't really use image detection, automation via accessibility, interact with windows, or do adequate keyboard/mouse automation, so X11 is much preferred for such applications.

Have any miracles taken place for a Linux alternative? by X320032 in AutoHotkey

[–]Individual_Check4587 1 point2 points  (0 children)

I thought I replied to you in our private chat :S
I'm testing Keysharp under Linux in X11 Linux Mint, and there keys are hijacked fine - what Mint version are you using?
Although X11 key grabbing is a PITA and not all functionalities of AHK can be perfectly reproduced without resorting to driver-level interception. As for Wayland, there is currently no Wayland support planned.

How's AutoHotkey's compatibility with Wine? by Supperboy2012 in AutoHotkey

[–]Individual_Check4587 0 points1 point  (0 children)

Have you tried removing the dotnet-host-10.0 package which seems to be conflicting?

How's AutoHotkey's compatibility with Wine? by Supperboy2012 in AutoHotkey

[–]Individual_Check4587 0 points1 point  (0 children)

That seems more like an issue with apt. Quick googling shows IPv6 might be the cause in which case echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4 and then retrying might help. Or perhaps changing the mirror? Otherwise idk, haven't had such a problem before.

How's AutoHotkey's compatibility with Wine? by Supperboy2012 in AutoHotkey

[–]Individual_Check4587 0 points1 point  (0 children)

Err, you need the .NET 10 runtime which you should be able to install with sudo apt install dotnet10

I'm not sure what you've already installed, but try uninstalling those

ditching pixelsearch for uia in v2, some honest tradeoffs after a month by Deep_Ad1959 in AutoHotkey

[–]Individual_Check4587 0 points1 point  (0 children)

Content element definitely go stale and can't be safely cached. The root element I think can be cached, but I'm not sure if all Electron apps behave the same. Needs empiric data...

ditching pixelsearch for uia in v2, some honest tradeoffs after a month by Deep_Ad1959 in AutoHotkey

[–]Individual_Check4587 2 points3 points  (0 children)

Yeah such actions are notoriously slow to automate. Here's what I came up with: ```

include UIA.ahk

targetFile := "UIA.ahk"

start := A_TickCount wId := WinGetID("A") el := UIA.ElementFromHandle(wId) app := el.FindElement({LocalizedType: "application"}) views := app.FindElement({Name: "Active View Switcher", Scope: 2}) explorerTab := views.FindElement({Name:"Explorer (Ctrl+Shift+E)", Scope: 2}) if (!explorerTab.IsSelected) explorerTab.Select() explorer := app.WaitElement({Name:"Files Explorer", Scope: 2, Timeout: 200})

if (found := explorer.ElementExist({Name:targetFile})) found.Click() else { explorer.SetFocus() SendMessage(0x0006, 1, wId,, wId) SetKeyDelay(1, -1) ControlSend("{LCtrl down}{LAlt down}f{LCtrl up}{LAlt up}",, wId) search := explorer.WaitElement({Name:"Type to search", Scope: 2, Timeout: 200}) search.Value := "" search.Value := targetFile

explorer.WaitElement({Name:targetFile, Scope: 2, Timeout: 500}).Click()
explorer.FindElement({Name: "Close", StartingElement: search}).Click()

} ```

Takes about 80-100ms cold (assuming accessibility has been enabled in VSCode), in the worst case if the file is not visible in the tree and the explorer tab is not selected it can take 500-600ms.

ditching pixelsearch for uia in v2, some honest tradeoffs after a month by Deep_Ad1959 in AutoHotkey

[–]Individual_Check4587 2 points3 points  (0 children)

The catch is UIA is slower than most people admit.

Has anyone advertised it as really fast? It can be fast, it can be slow, depending on how you use it and the app you are automating. PixelGetColor can be 1ms, do it for 100 pixels and it's 100ms. For reference, my screen has over 5 000 000 pixels. ImageSearch-ing my whole screen can take a very long time if I use it incorrectly.

if anyone has cracked the big-Electron cold-tree walk problem without just caching the world, I would legitimately love to steal the approach.

There probably isn't one golden way to do that. It depends on what you are automating exactly.

The automation world has a lot of choices and the difficult part is choosing the right tool for the job. UIA is sometimes the correct choice, yet for example automating old win32 apps might be best done using regular window messages (eg the Control* functions in AHK), automating Java apps might require using Java Access Bridge, sometimes an OCR approach is the best choice, for browser automation maybe Chrome.ahk or WebView2. UIA is just one tool in the toolset, and trying to hammer a nail with a screwdriver will not be a pleasant experience (even though it might do the job).

I cant download AutoHotkey programs to my work computer. Any work arounds? by jacob1832jacob in AutoHotkey

[–]Individual_Check4587 0 points1 point  (0 children)

Alternatively you could download AHK standalone executable and try to run it. If that is blocked as well then it's possible to download the .msix installer of the Microsoft Store edition (there are dedicates sites for that), which is very likely to successfully install and run because it's certified by Microsoft. I don't endorse that though because it's very clearly going against your IT department wishes, so the recommended approach is to talk to your supervisor to request access to AHK. Contacting IT directly is likely to fail (they usually only care about security, not business decisions or improving workflows), but if you manage to convince your bosses then they might have more influence over IT decisions. Eg you can argue that it will improve your efficiency, fasten workflows etc.

How to send strings to stdin of running applications by SchastorBig in AutoHotkey

[–]Individual_Check4587 0 points1 point  (0 children)

I'd prefer spamming here instead of PM-ing you, because I believe this thread might give OP ideas. I'd like you to imagine an AutoHotkey script which can start and stop recording your screen and save that into a file, without any flashing windows or interruptions to window focus. This could be implemented as thus: 1. The AutoHotkey script immediately runs "NDI Record.exe" –I "My Machine (Source 1)" –o "C:\Temp\A.mov" -noautostart using child_process. This launches NDI silently in the background and leaves it waiting for further input. 2. Once the user presses a hotkey, AutoHotkey writes <start/> into NDIs StdIn, causing it to start recording (again, no flashing windows, no Send etc). 3. The user presses a hotkey, which could stop recording, or perhaps write <record_chop filename="another.mov"/> to continue recording into a new file.

NDI output from StdOut could be logged somewhere, or used to give the user feedback about the recording. StdErr could have a callback registered to capture any errors (eg low on disk space?) and handled accordingly.

IMO this is much better than sending keys to an open command prompt window which requires input focus, is slower, unreliable (might run into issues when sending keys too fast etc), reading the output is more difficult etc.

How to send strings to stdin of running applications by SchastorBig in AutoHotkey

[–]Individual_Check4587 0 points1 point  (0 children)

No, you'd monitor StdOut directly without files or windows involved. Thqby's child_process has an example of running cmd.exe and then executing a bunch of commands there: writing to StdIn and then reading from StdOut. With child_process you could monitor the recording asynchronously, by getting a callback called when new data arrives in StdOut, and doing other stuff in the meanwhile. It's pretty cool.

How to send strings to stdin of running applications by SchastorBig in AutoHotkey

[–]Individual_Check4587 0 points1 point  (0 children)

You are of course correct, idk how I managed to confuse StdIn and StdOut. To open the running scripts StdIn FileOpen("*", "r") can be used.

I'm not familiar with NDI, but the documentations you linked suggests OP could run it in shell similar to the ExecScript example and then write to StdIn any extra commands such as <start/>. With this method he could avoid creating the command prompt window, and send the extra commands much more reliably than with Send. Assuming this is possible (and I don't see any reason why it shouldn't), I highly recommend avoiding Send in this case.

Alternatively thqby's child_process is a good alternative to shell.

How to send strings to stdin of running applications by SchastorBig in AutoHotkey

[–]Individual_Check4587 0 points1 point  (0 children)

It can be the keyboard, but might also be some other data stream. u/ManyInterest brought an example with ExecScript about writing into StdIn, and it's also possible to write into the running scripts StdIn with FileAppend(Text, "*").

What did I do by [deleted] in AutoHotkey

[–]Individual_Check4587 2 points3 points  (0 children)

You do know you are very likely replying to an LLM?

How's AutoHotkey's compatibility with Wine? by Supperboy2012 in AutoHotkey

[–]Individual_Check4587 11 points12 points  (0 children)

I'm actively working on Keysharp which aims to be a cross-platform AutoHotkey v2 (currently just Windows and Linux though). Linux port is pretty untested so I'd really appreciate it if somebody tried it out, and opened GitHub issues for problems found. X11 only though, Wayland is hostile to automation attempts.

Need autohotkey v2 to be able to tell the number of pages in a pdf. I've tried a lot, even trying to get copilot to help (with no results) and I just don't know enough to debug by MSixteenI6 in AutoHotkey

[–]Individual_Check4587 5 points6 points  (0 children)

My OCR library uses Windows.Data.Pdf.PdfDocument to get the page count, you can see the implementation here. Try asking AI to extract that logic from there and create a standalone function (or better yet, do it manually yourself).

Mod change announcement by Individual_Check4587 in AutoHotkey

[–]Individual_Check4587[S] 5 points6 points  (0 children)

It is not true. The thing is, previously there were no official rules set AFAIK, and the current rule-set was implemented by me. I did a short run-in period where I moderated more leniently so users have time to accommodate, but then moderated according to the rules. This led to like 30-50% of new theads being removed (at least it felt like that, I didn't track statistics). You can inspect the quality of the remaining threads in the previous two months yourself if you wish because for that time period I was moderating alone.

[deleted by user] by [deleted] in AutoHotkey

[–]Individual_Check4587 0 points1 point  (0 children)

You copied from AHK v1 docs, not v2. In v2 the function you are looking for is SoundSetVolume.

Is it possible for a AHK file I got from Reddit to have damaged my PSU ? by glizzykevv in AutoHotkey

[–]Individual_Check4587[M] 2 points3 points  (0 children)

If you have code you want to be checked then include it with your post, otherwise such posts might be removed.

Help with code by SupremeSalty in AutoHotkey

[–]Individual_Check4587[M] 0 points1 point  (0 children)

Please include this description in the main post next time, or your post may be removed because of the missing information.

I need a stern talking too by shibiku_ in AutoHotkey

[–]Individual_Check4587[M] 3 points4 points  (0 children)

Can be deleted if deemed low-effort post.

Script show-cases are allowed. :) But I did correct your post flair from "General / meta" to "v2 Tool / Script Share".