function init_window(win_name) local l_win = findWindow(win_name) --win = 852182 print("Shaiya Window process ID: " .. l_win) assert((l_win ~= 0), error_init) return l_win end function init_process(win) --debug_message("Hook init()") --local l_proc = openProcess( findProcessByExe(g_game_exe) ) local l_proc = openProcess(findProcessByWindow(win)) assert((l_proc ~= 0), error_init) return l_proc end -- game executable g_game_path = "C://Program Files (x86)//AG&E//Shaiya//" g_game_exe = "Bomber.exe" g_game_args = "start game" g_game_win = "Shaiya" local l_cmd = "start \"\" /D \""..g_game_path.."\" \"".. g_game_path .. g_game_exe .. "\"" os.execute(l_cmd) --startWithDll(getPath() .. "/data/hook_GetAsyncKeyState.dll", g_game_path .. g_game_exe, g_game_exe .. " " .. g_game_args) rest(5000) local l_win = init_window(g_game_win) init_process(l_win)