#샘플 코드
; The contents of this file can be copied directly into your script. Alternately, you can copy the classMemory.ahk file into your library folder, ; in which case you will need to use the #include directive in your script i.e. #Include <classMemory> ; You can use this code to check if you have installed the class correctly. if (_ClassMemory.__Class != "_ClassMemory") { msgbox class memory not correctly installed. Or the (global class) variable "_ClassMemory" has been overwritten ExitApp } f1:: ; Open a process with sufficient access to read and write memory addresses (this is required before you can use the other functions) ; You only need to do this once. But if the process closes/restarts, then you will need to perform this step again. ; .isHandleValid() can be used to check if program has restarted. ; Note: The program identifier can be any AHK windowTitle i.e.ahk_exe, ahk_class, ahk_pid, or simply the window title. ; Unlike AHK this defaults to an exact match, but this can be changed via the passed parameter. ; hProcessCopy is an optional variable in which the opened handled is stored. ; ***** change FTLGAME.exe to your process name ****** mem := new _ClassMemory("ahk_exe FTLGAME.exe", "", hProcessCopy) ; ***** ; Check if the above method was successful. if !isObject(mem) { msgbox failed to open a handle if (hProcessCopy = 0) msgbox The program isn't running (not found) or you passed an incorrect program identifier parameter. else if (hProcessCopy = "") msgbox OpenProcess failed. If the target process has admin rights, then the script also needs to be ran as admin. Consult A_LastError for more information. ExitApp } ; read a pointer - mem.BaseAddress is automatically set to the base address. value := mem.read(mem.BaseAddress + 0x00B8C83C, "UInt", 0x0, 0xA8, 0x3FC) msgbox val = %value% return
- PS. classMemory.ahk 파일은 내문서\[사용자명]\doucuments\autohotkey\lib 폴더? 에 첨부
- PS2. 실행중 오류발생시 관리자권한으로 실행
# 본문 코드 출처: https://www.autohotkey.com/boards/viewtopic.php?t=44241
# 다운로드 링크: classMemory-master.zip - 자료 출처: https://github.com/Kalamity/classMemory