
FreeFry
Active Members-
Posts
947 -
Joined
-
Last visited
About FreeFry
- Birthday 08/31/1987
Profile Information
-
Location
Sweden
-
WWW
http://www.coderon.tk/
-
Interests
Pretty much anything concerning computers.
Other stuff like meeting friends/drinking, and what not is just amusement. :)
Recent Profile Visitors
496 profile views
FreeFry's Achievements

Universalist (7/7)
2
Reputation
-
JoshuaBarnette reacted to a post in a topic: Hide Autoit GUI from taskbar
-
Abryce reacted to a post in a topic: Hide Autoit GUI from taskbar
-
#include <ie.au3> Dim $oIE = _IECreate("www.34jk5h4j3k5hj3453.com") ;~ Dim $oIE = _IECreate("www.google.com") ConsoleWrite("Paged loaded successfully: " & Not _IEPageHasLocalResources($oIE) & @LF) Func _IEPageHasLocalResources(ByRef $ovIE) Local $ovElements = _IETagNameGetCollection($ovIE, "img") Local $svElementSrc For $ovElement In $ovElements ;~ $svElementSrc = $ovElement.src If StringLeft($ovElement.src, 6) = "res://" Then Return 1 Next Return 0 EndFuncNot the most reliable(I believe), but it seems to work. Edit: Searched the forums and found a post by /dev/null which can properly see page-loading errors. Modified code: #include <ie.au3> Dim $oIE = _IECreate("about:blank") ObjEvent($oIE,"IEEvent_","DWebBrowserEvents2") _IENavigate($oIE, "www.34jk5h4j3k5hj3453.com") _IENavigate($oIE, "www.google.com") Func IEEvent_NavigateError($pdisp, $url, $tf, $status,$cancel) $msg = "Problems loading page: " & $url & @CRLF $msg = $msg & "Status: " & $status & @CRLF MsgBox(0,"PROBLEMS",$msg) EndFunc
-
What he wants to do, is to check if the load succeeded in loading, not if it has loaded. I've pointed him towards the ie.au3 UDF file, to look at the code for the _IELoadWait function, but he doesn't seem to understand what to do with it. Guess I'll have to show him an example... Seems that approach is not possible, I was thinking it showed a different state for a 404 error or similar, but that doesn't seem to be the case. :/
-
can i send file(s) through UDP socket?
FreeFry replied to soulhealer's topic in AutoIt General Help and Support
It's fully possible to send files through the UDP protocol, but it's not reliable nor advisable; UDP shouldn't be used for file transferring, as there's no guarantee that the data sent will be transferred completely(or at all), as UDP is a fire-and-forget protocol, in the sense that it does no error checking, or 'follow-ups' to make sure data sent was not corrupted/etc. during transfer. For sending files you should use TCP because it does actually check if the data sent was transferred successfully. -
Dim $var1 = "var1" Dim $var2 = "var2" Dim $var3 = "var3" For $i = 1 To 3 MsgBox(0, "Var" & $i, Execute("$var" & $i)) Next Should work I think. Edit: or with an array: Dim $varArray[3] $varArray[0] = "var1" $varArray[1] = "var2" $varArray[2] = "var3" For $i = 0 To UBound($varArray)-1 MsgBox(0, "Var" & $i+1, $varArray[$i]) Next
-
Double Click at the current pos
FreeFry replied to KillingEye's topic in AutoIt General Help and Support
Wrong. either he could just repeat the function call: MouseClick("left") MouseClick("left") or he could get the x and y coordinates of the mouse, and click there: $aMousePos = MouseGetPos() MouseClick("left", $aMousePos[0], $aMousePos[1], 2) or in one line(less efficient, but no array usage, and in one line): MouseClick("left", MouseGetPos(0), MouseGetPos(1), 2) Edit: argh plato -
Cannot download more than one file smoothly
FreeFry replied to cwem's topic in AutoIt General Help and Support
If you're using IE, you could use the _IE UDF to automate it, you could most likely collect the links of the webpage that way, and do direct downloads - unless there's like cookies n crap involved... -
Cannot download more than one file smoothly
FreeFry replied to cwem's topic in AutoIt General Help and Support
I see.. Are you using internet explorer for this? -
Cannot download more than one file smoothly
FreeFry replied to cwem's topic in AutoIt General Help and Support
So you have a program, that collects the links to the files? If that's the case, why not just use InetGet ? -
You guys sure that you're using static addresses? Otherwise read up on DMA, and find some tuts on how to 'counter' it. Otherwise, if you're using static - ie. 'green', addresses then make sure that you're using module-relative addresses rather than absolute addresses and offsets. In other words, make sure that you're taking the allocation base of the modules into account: Find what module the address you want to read from is located inside(such as game.exe+123), then use this function to resolve the allocation base of the module into an address: Dim $SomeAddress = _ProcessGetModuleBase("calc.exe", "calc.exe")+123; Get the address calc.exe is allocated at and add the offset to the returned address. ; Read from $SomeAddress or something below - as long as the address you first of all specified Func _ProcessGetModuleBase($ivPID, $svModuleName) $ivPID = ProcessExists($ivPID) If Not $ivPID Then Return(SetError(1, 0, 0)); Process does not exist Local Const $TH32CS_SNAPMODULE = 0x00000008 Local Const $sMODULEENTRY32Struct = "dword Size;" & _ "dword 32ModuleID;" & _ "dword 32ProcessID;" & _ "dword GlblcntUsage;" & _ "dword ProccntUsage;" & _ "ptr modBaseAddr;" & _; <---- hmm ? "dword modBaseSize;" & _ "hwnd hModule;" & _ "char Module[255];" & _ "char ExePath[260]" Local $hvSnapShot = DllCall("Kernel32.dll", "hwnd", "CreateToolhelp32Snapshot", "dword", $TH32CS_SNAPMODULE, "dword", $ivPID) If Not $hvSnapShot[0] Then Return(SetError(2, 0, 0)); Could not create snapshot? Local $stMODULEENTRY32 = DllStructCreate($sMODULEENTRY32Struct) DllStructSetData($stMODULEENTRY32, "Size", DllStructGetSize($stMODULEENTRY32)) Local $ivState = DllCall("Kernel32.dll", "int", "Module32First", "hwnd", $hvSnapShot[0], "long_ptr", DllStructGetPtr($stMODULEENTRY32)) If Not $ivState[0] Then Return(SetError(3, _WinAPI_CloseHandle($hvSnapShot[0]), 0)); Could not enumerate first module in list? Local $ivRet = 0 Local $svModule Do $ivRet = DllStructGetData($stMODULEENTRY32, "modBaseAddr") $svModule = DllStructGetData($stMODULEENTRY32, "Module") If $svModule = $svModuleName Then ExitLoop $ivState = DllCall("Kernel32.dll", "int", "Module32Next", "hwnd", $hvSnapShot[0], "long_ptr", DllStructGetPtr($stMODULEENTRY32)) Sleep(1) Until Not $ivState[0] DllCall("Kernel32.dll", "int", "CloseHandle", "int", $hvSnapShot[0]) Return $ivRet EndFunc I hope that made sense.
-
That's exactly what my _ReadProcessPointers function is doing... If it's giving you a value, then you where using it wrong(the last offset is perhaps the offset to the DMA address, not an offset to a pointer). If you want, you could try this and see if it works expectedly: #include <WinAPI.au3>; Required for _WinAPI_OpenProcess #include <Constants.au3>; Required for $PROCESS_ALL_ACCESS Dim $iProcess = WinGetProcess("[CLASS:Knight OnLine Client]"); Should maybe use ProcessExists to get the ProcessID instead, as the .exe name is probably a little more reliable If Not ProcessExists($iProcess) Then Exit(MsgBox(0, "Error", "Please launch the game first")); Make sure it's running before starting the script(you could wait for it to start up if you wanted however) Dim $hProcess = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, $iProcess, False); Get the required handle to the process with access rights to be able to read/write, etc. from the process Dim $HealthBasePointer = 0x008189a0 Dim $HealthBasePointerOffset = 0xCC $PlayerHPAddress = _ReadProcessPointers($hProcess, $HealthBasePointer, $HealthBasePointerOffset)+0xA0; Read from the pointer+offset, then add the last offset which should point to the correct address $PlayerHP = _ReadProcessMemory($hProcess, $PlayerHPAddress, "dword") MsgBox(0, "HP", $PlayerHP) Func _ReadProcessPointers(ByRef $hvProcess, $ivBaseAddress, $avOffsets) If Not IsArray($avOffsets) Then Return _ReadProcessMemory($hvProcess, $ivBaseAddress+$avOffsets, "ptr") $ivBaseAddress = _ReadProcessMemory($hvProcess, $ivBaseAddress, "ptr") For $i = 0 To UBound($avOffsets)-1 $ivBaseAddress = _ReadProcessMemory($hvProcess, $ivBaseAddress+$avOffsets[$i], "ptr") Next Return $ivBaseAddress EndFunc Func _WriteProcessMemory(ByRef $hvProcess, $ivAddress, $bvData, $svDataType = "byte") Local $stvWritten = DllStructCreate("int Written") Local $stvData = DllStructCreate($svDataType) DllStructSetData($stvData, 1, $bvData) Local $avResult = DllCall("Kernel32.dll", "int", "WriteProcessMemory", "int", $hvProcess, "int", $ivAddress, "ptr", DllStructGetPtr($stvData), "int", DllStructGetSize($stvData), "int", DllStructGetPtr($stvWritten)) Return(SetError($avResult[0], 0, DllStructGetData($stvWritten, "Written"))) EndFunc Func _ReadProcessMemory(ByRef $hvProcess, $ivAddress, $svDataType = "byte") Local $stvRead = DllStructCreate("int Read") Local $stvData = DllStructCreate($svDataType) Local $avResult = DllCall("Kernel32.dll", "int", "ReadProcessMemory", "int", $hvProcess, "int", $ivAddress, "ptr", DllStructGetPtr($stvData), "int", DllStructGetSize($stvData), "ptr", DllStructGetPtr($stvRead)) Return(SetError(Not $avResult[0], DllStructGetData($stvRead, "Read"), DllStructGetData($stvData, 1))) EndFunc This is a snippet out of a bot I've made, which uses my function to get the pointer address that points to the position of my character in the game: Dim $aPlayerPosAddr[4] = [0x0481922c, 0x88, 0x8c, 0x90]; First element is the address of my pointer, the rest are offsets to the values Func _GetPlayerPosition() Local $avRet[3] Local $ivBaseAddress = _ReadProcessPointers($hProcess, $aPlayerPosAddr[0], 0); Gets the address the pointer is pointing to(0 as offset as i want the address not the 'value' i'm looking for) $avRet[0] = _ReadProcessMemory($hProcess, $ivBaseAddress+$aPlayerPosAddr[1], "float"); Read from that pointer+first offset(which points to the X position in the world) $avRet[1] = _ReadProcessMemory($hProcess, $ivBaseAddress+$aPlayerPosAddr[2], "float"); Read from that pointer+second offset(which points to the Y position in the world) $avRet[2] = _ReadProcessMemory($hProcess, $ivBaseAddress+$aPlayerPosAddr[3], "float"); Read from that pointer+third offset(which points to the Z position in the world) Return $avRet EndFunc
-
_ReadProcessPointers returns the "DMA" address, so to get the value from it you need to use _ReadProcessMemory on the address that _ReadProcessPointers returns. Also why have you changed the parameters of the read and write functions? They need not to be modified at all. As long as the pointer you have is correct, and the offsets you gave in the first post is correct, this should work: #include <WinAPI.au3>; Required for _WinAPI_OpenProcess #include <Constants.au3>; Required for $PROCESS_ALL_ACCESS Dim $iProcess = WinGetProcess("[CLASS:Knight OnLine Client]"); Should maybe use ProcessExists to get the ProcessID instead, as the .exe name is probably a little more reliable If Not ProcessExists($iProcess) Then Exit(MsgBox(0, "Error", "Please launch the game first")); Make sure it's running before starting the script(you could wait for it to start up if you wanted however) Dim $hProcess = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, $iProcess, False); Get the required handle to the process with access rights to be able to read/write, etc. from the process Dim $HealthBasePointer = 0x008189a0 Dim $HealthBasePointerOffsets[2] = [0xCC, 0xA0] $PlayerHPAddress = _ReadProcessPointers($hProcess, $HealthBasePointer, $HealthBasePointerOffsets); This gets the address where your health is stored - in other words not your health $PlayerHP = _ReadProcessMemory($hProcess, $PlayerHPAddress, "dword") MsgBox(0, "HP", $PlayerHP) Func _ReadProcessPointers(ByRef $hvProcess, $ivBaseAddress, $avOffsets) If Not IsArray($avOffsets) Then Return _ReadProcessMemory($hvProcess, $ivBaseAddress, "ptr")+$avOffsets $ivBaseAddress = _ReadProcessMemory($hvProcess, $ivBaseAddress, "ptr") For $i = 0 To UBound($avOffsets)-1 $ivBaseAddress = _ReadProcessMemory($hvProcess, $ivBaseAddress+$avOffsets[$i], "ptr") Next Return $ivBaseAddress EndFunc Func _WriteProcessMemory(ByRef $hvProcess, $ivAddress, $bvData, $svDataType = "byte") Local $stvWritten = DllStructCreate("int Written") Local $stvData = DllStructCreate($svDataType) DllStructSetData($stvData, 1, $bvData) Local $avResult = DllCall("Kernel32.dll", "int", "WriteProcessMemory", "int", $hvProcess, "int", $ivAddress, "ptr", DllStructGetPtr($stvData), "int", DllStructGetSize($stvData), "int", DllStructGetPtr($stvWritten)) Return(SetError($avResult[0], 0, DllStructGetData($stvWritten, "Written"))) EndFunc Func _ReadProcessMemory(ByRef $hvProcess, $ivAddress, $svDataType = "byte") Local $stvRead = DllStructCreate("int Read") Local $stvData = DllStructCreate($svDataType) Local $avResult = DllCall("Kernel32.dll", "int", "ReadProcessMemory", "int", $hvProcess, "int", $ivAddress, "ptr", DllStructGetPtr($stvData), "int", DllStructGetSize($stvData), "ptr", DllStructGetPtr($stvRead)) Return(SetError(Not $avResult[0], DllStructGetData($stvRead, "Read"), DllStructGetData($stvData, 1))) EndFunc
-
Bug in advanced title matching(using instance) ?
FreeFry replied to FreeFry's topic in AutoIt General Help and Support
Yes, but that's in a controlled environment, ie. you're controlling when to launch the process that creates the other window, and getting the handle of the most recent one. But what if a program launches(either by user or by script), then the program creates three identical windows in all ways(except that their handles will be different of course)? Unless I've missed something one cannot tell which window was created first in this case? -
hexdecimal or not it does not matter, they're in real the same value(but if you insist, you can use Decimal on the hex). Mind showing the code you're having problem with?
-
Bug in advanced title matching(using instance) ?
FreeFry replied to FreeFry's topic in AutoIt General Help and Support
I see.. So INSTANCE refers to the order in which the windows was activated? In such case, if there are three windows, that gets created by some application, if i wanted to identify the second window that was created, this would not be possible with the instance property - as you cannot know which one of them was the last active one, right? So... in such case, assuming the above is true, it'd probably be more reliable to use WinList, and assume that the first window that matches the class/title/etc. is the first created window, second match is second created window, and so on? Edit: Scratch that, the same problem occurs there. How unfortunate. Now I wonder, is there any other way to determine which window was created first if there exists more than one window of the same class, title, etc(nothing that tells them appart)?