Since the GetUIElementByHash function doesn't use thread local storage you can call it from your own thread. You will need to allocate memory to store the hash that you are looking up since the parameter it takes is a pointer to the hash. Some functions that you might need
VirtualAllocEx
VirtualAllocEx function
and
CreateRemoteThread
CreateRemoteThread function
I don't use AutoIt, but here is a Cheat Engine Auto Assemble implementation. It is pretty straightforward store the hash, push the pointer, call the function, then store the result and exit.
alloc(CodeCave, 1024)
CREATETHREAD(CodeCave)
CodeCave:
mov [CodeCave+0x100], 0x8A1C1CBA
mov [CodeCave+104], 0xA53AF138
push CodeCave+0x100
call 0x0093F470
mov [CodeCave+0x108],eax
call ExitThread
This example will leak memory every time you use it so you will want to either dealloc after you have read the value or change it to global alloc so it reuses uses the same code cave.