14 posts in this topic
This topic is now closed to further replies.
If possible please add or edit the comments to explain how this works.
;includes functions from other things
Global $win_title ;name of the window
Global $area_x ;
Global $area_y ;
Global $area_w ;
Global $area_h ;
Global $cursor ;
Global $rect_file ;
Global $hbmpscreen ;
Global $i= 1043 ;moves the rect
Global $ii= 378 ;moves the rect
Global $x=1044 ;inner rect offset
Global $y=501 ;inner rect offset
Global $hbmprect ;image inside rect
Global $hscreen ;image whole screen
;display hotkeys on screen
ToolTip("Press F1 to scan | Press ESC to Exit",0,0)
;infinite loop to keep prog running
;~ reads your screen area:
;~ converts screen captured into bmp
;~ . Loads converted bmp to be read
;~ compares the bmp of your scanned screen to the actual screen that is being displayed
$hscreen = _ScreenCapture_CaptureWnd("", WinGetHandle($win_title), $area_x, $area_y, $area_x + $area_w, $area_y + $area_h, $cursor)
;converts screen into bmp
;loads converted screen
;compares savedBMP to current screen
;If( below code ) = ( below code ) Then
If _GDIPlus_BitmapGetPixel($hbmpscreen, ($i + $x) - $area_x, ($ii + $y) - $area_y) = _GDIPlus_BitmapGetPixel($hbmprect, $x, $y) Then
;display message box titled found with a message of found
;if above is not correct then
Good morning everyone
I worked a bit on a little project of mine, and I managed to do what I was trying to do, or, automate a quiz in AutoIt.
Now, everything works fine but, in order to achieve what I'm trying to achive, I'd like to make this script run faster.
I'll attach a portion of the code in order to let you understand what my script does.
$objIE_h1 = _IETagNameGetCollection($objIE, "h1") ; Take the text of the answer If @error Then ConsoleWrite("Errore durante la lettura degli h1 nella pagina. - Errore: " & @error & @CRLF) Else For $objElement In $objIE_h1 $strInnerText = $objElement.innerText Next Select Case StringInStr($strInnerText, "QUESTION") ; Here is the question ; PS4 PRO $objSpans = _IETagNameGetCollection($objIE, "span") ; Answers are stored here For $objElement In $objSpans If $i >= 4 Then $strAnswer = $objElement.innerText ; Take the text of the answer n° 0, 1, 2, 3 If StringInStr($strAnswer, "CORRECT ANSWER") Then ; If I match the correct answer, then, I have to click on the input with answer id = answer_i $j = $i - 4 $objInput = _IEGetObjById($objIE, "answer_" & $j) If @error Then ConsoleWrite("Errore durante la lettura della risposta #" & $i & " - Errore: " & @error & @CRLF) Else _IEAction($objInput, "click") If @error Then ConsoleWrite("Errore durante il click sull'elemento. - Errore: " & @error) Else ConsoleWrite($j & ") Risposta: " & $strAnswer & @CRLF) ExitLoop EndIf EndIf EndIf $i+=1 Else $i+=1 EndIf Next $i = 0 $j = 0 This is what my script does.
Questions are 20, in which I have 15 multiple choice question, 2 images ( on which I use _IEImgClick() ), and 3 text inputs ( a simple send with the text I have to enter ).
How can I make all of these, faster?
If I reach this goal, I've probably done one of my best goals in life, and I'd like to share my happiness with you, giving a huge donation to this fantastic community!
Thanks for your help
I tryed to manipulate a game called "Assault Cube" which is a easy beginning in coding. I run the code but the wished value doesn't change, i don't understand why.
The Pointers are fine, I checked that the pointers don't change every time while restart the game.
The Offsets are 18C & 4
In Cheat Engine: ("ac_client.exe"+0010F418) <- Pointer
4 Bytes = 'dword'
Hi, having an issue with an application i did, seems to crash randomly, and can take hours to do so.
Simply says in the error msgbox:
Line 16392 (whatevermyapppath.exe)
Error: The requested action with this object has failed.
Recent changes to the script include this:
ObjGet("winmgmts:\\localhost\root\CIMV2") $oSelect_active_network_cards = $objWMIService.ExecQuery('SELECT ProductName FROM Win32_NetworkAdapter WHERE NetConnectionStatus = 2 OR NetConnectionStatus = 9', "WQL") For $oSelect_active_network_card In $oSelect_active_network_cards $Adapter = $oSelect_active_network_card.ProductName Next Is the only thing i can see that can be related to an "object"
This lines run only once at the top of the script.
When i run the script itself and wait for a crash, it doesn't, or at least yet i didn't.
What do you think this error could be?
UPDATE: Runing the script eventually output this:
"C:\script.au3" (894) : ==> The requested action with this object has failed.:
$oNetwork_cards = $objWMIService.ExecQuery('SELECT BytesReceivedPerSec, BytesSentPerSec FROM Win32_PerfFormattedData_Tcpip_NetworkInterface WHERE name LIKE "' & $Adapter & '"', "WQL")
$oNetwork_cards = $objWMIService^ ERROR
UDF to intercept the error window of AutoIt, showing more details about the error, including ability to save and send by email!