Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/17/2019 in all areas

  1. Tried to clean-up the code a little based on pixelsearch's remarks. Through the loops you created different handles for the same vars never been closed. #include <GDIPlus.au3> #include <ScreenCapture.au3> #include <File.au3> #include <Array.au3> #include <MsgBoxConstants.au3> #include <GuiConstantsEx.au3> #include <WinAPI.au3> Global $possibility1 Global $possibility2 Global $dek[3] = ["sheet1", "sheet2", "sheet3"] _GDIPlus_Startup() HotKeySet("{ESC}", "_Terminate") While 1 Sleep(1000) Local $color = PixelGetColor(1376, 653) If ($color <> "6590886") Then FileDelete(@ScriptDir & "\1.jpg") FileDelete(@ScriptDir & "\2.jpg") Sleep(1000) _ScreenCapture() Sleep(1000) $bm1 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\1.jpg") For $i = 0 To UBound($dek) - 1 $excelsheet = $dek[$i] ConsoleWrite(@ScriptDir & "/links/" & $excelsheet & ".jpg" & @CRLF) $bm2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "/links/" & $excelsheet & ".jpg") $antwoord = CompareBitmaps($bm1, $bm2) _GDIPlus_ImageDispose($bm2) If $antwoord = True Then ;MsgBox(0, "Alert", "We hebben je excelsheet gedetecteerd je excelsheet = " & $excelsheet) $possibility1 = $excelsheet ExitLoop EndIf ;;MsgBox(0, "bm1==bm2", CompareBitmaps($bm1, $bm2)) Next _GDIPlus_ImageDispose($bm1) $bm1 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\2.jpg") For $i = 0 To UBound($dek) - 1 $excelsheet = $dek[$i] ConsoleWrite(@ScriptDir & "/rechts/" & $excelsheet & ".jpg" & @CRLF) $bm2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "/rechts/" & $excelsheet & ".jpg") $antwoord = CompareBitmaps($bm1, $bm2) _GDIPlus_ImageDispose($bm2) If $antwoord = True Then ;MsgBox(0, "Alert", "We hebben je excelsheet gedetecteerd je excelsheet = " & $excelsheet) $possibility2 = $excelsheet ExitLoop EndIf ;;MsgBox(0, "bm1==bm2", CompareBitmaps($bm1, $bm2)) Next _GDIPlus_ImageDispose($bm1) ConsoleWrite($possibility1 & " - " & $possibility2 & @CRLF) Sleep(1000) ;MouseClick ($MOUSE_CLICK_LEFT, 1042, 808, 1) EndIf WEnd Func _ScreenCapture() Local $hBitmap, $hBitmap2, $hImage, $hImage2 ; Capture full screen Local $hBitmap = _ScreenCapture_Capture(False, 1454, 672, 1454 + 11, 672 + 28) Local $hBitmap2 = _ScreenCapture_Capture(False, 1477, 671, 1477 + 15, 672 + 45) Local $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) Local $hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap2) ; Save resultant image _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\1.jpg") _GDIPlus_ImageSaveToFile($hImage2, @ScriptDir & "\2.jpg") ; Clean up resources _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hImage2) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hBitmap2) EndFunc ;==>_ScreenCapture Func CompareBitmaps($bm1, $bm2) Local $Bm1W = _GDIPlus_ImageGetWidth($bm1) Local $Bm1H = _GDIPlus_ImageGetHeight($bm1) Local $BitmapData1 = _GDIPlus_BitmapLockBits($bm1, 0, 0, $Bm1W, $Bm1H, $GDIP_ILMREAD, $GDIP_PXF32RGB) Local $Stride = DllStructGetData($BitmapData1, "Stride") Local $Scan0 = DllStructGetData($BitmapData1, "Scan0") Local $ptr1 = $Scan0 Local $size1 = ($Bm1H - 1) * $Stride + ($Bm1W - 1) * 4 Local $Bm2W = _GDIPlus_ImageGetWidth($bm2) Local $Bm2H = _GDIPlus_ImageGetHeight($bm2) Local $BitmapData2 = _GDIPlus_BitmapLockBits($bm2, 0, 0, $Bm2W, $Bm2H, $GDIP_ILMREAD, $GDIP_PXF32RGB) $Stride = DllStructGetData($BitmapData2, "Stride") $Scan0 = DllStructGetData($BitmapData2, "Scan0") Local $ptr2 = $Scan0 Local $size2 = ($Bm2H - 1) * $Stride + ($Bm2W - 1) * 4 Local $smallest = $size1 If $size2 < $smallest Then $smallest = $size2 Local $call = DllCall("msvcrt.dll", "int:cdecl", "memcmp", "ptr", $ptr1, "ptr", $ptr2, "int", $smallest) _GDIPlus_BitmapUnlockBits($bm1, $BitmapData1) _GDIPlus_BitmapUnlockBits($bm2, $BitmapData2) if $call[0] = 0 Then Return True Return False EndFunc ;==>CompareBitmaps Func _Terminate() _GDIPlus_Shutdown() Exit EndFunc ;==>_Terminate
    2 points
  2. genius257

    DLL Documentation

    If you mean the actual value of SE_Privilege_Enabled, that is something i run into a lot. I use google to search for definitions for the variable. So for your example i google this: #define "SE_Privilege_Enabled" this will most likely always return some .h or .cpp file with the value you searched for. If you are unsure if the variable is the actual variable in reference to what you need, pick multiple searches and look for references in the file to MSDN, windows or other windows API related definitions. In my example my first result from the search was: http://www.rensselaer.org/dept/cis/software/g77-mingw32/include/winnt.h The file itself seems to refer to windows and a comment mentions "windows.h", so i would personally have accepted this as a good lead. In this file SE_PRIVILEGE_ENABLED is defined as 2: #define SE_PRIVILEGE_ENABLED 2 Now this may be a horrible way of doing it. And if it is, I'm sure someone will come to your rescue in this thread and tell me how big of an idiot i am Anyway, i hope some of this is of use to you
    1 point
  3. genius257

    DLL Documentation

    Google to the rescue. search string: "Kernel32 functions msdn" my 4th result: https://www.geoffchappell.com/studies/windows/win32/kernel32/api/index.htm search string: "AdvAPI functions msdn" my 2nd result: https://www.geoffchappell.com/studies/windows/win32/advapi32/api/index.htm SE_PRIVILEGE_ENABLED is "explained" here: https://docs.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-adjusttokenprivileges
    1 point
  4. jchd

    AesEncrypted shortend

    Things encrypted using a non-nonsensical encryption method will always be as random as random can be. That implies you can't compress it without loosing significant information, that in turn means what you have in mind is plain impossible.
    1 point
  5. @pintas There are a number of ways you could go about it. You could always surround your current While loop in another While loop that runs the inner loop and then sleeps for 60 seconds. A much better approach would be to use the Task Scheduler on your script as you'll have options for what to do in the case of failure.
    1 point
  6. You might put it inside a func, use AdlibRegister, and put an empty While loop at the end of the script to keep it alive
    1 point
  7. An even better way would be to assign the value to a well named variable, such as $iServersChksum or some such name, so you know what it refers to, and can be changed at the variable level rather than the condition check level. This way, if you use that value in multiple places as your checksum, then you only have to change it in one place instead of a Find/Replace throughout the script.
    1 point
  8. Hi i have found another command ShellExecuteWait and it is running successfully.
    1 point
  9. The issue seems to be the default resizing behavior of the Obj control. I added a couple of GUICtrlSetState commands in the _HideSolarData function to hide and show the $hIE Obj Control and noticed your other controls also shrink in size which I doubt you want. An easy work-around would be to set the default control resizing option to the top of the script. Beneath your Opt("TrayIconHide, 1) declaration, try adding this option. Opt("GUIResizemode", $GUI_DOCKALL)
    1 point
  10. It looks like the "Button" you're trying to click on isn't a button... it's a group. But if this were me, I wouldn't run the SysPrep GUI, I would try using the command line. Then you get all of the options of the GUI without caring about how to click them
    1 point
  11. I think @matwachich was refering to the KXF files produced by koda, not the XML files produced by Glade Glade is a GUI Designer for GTK+, and it is a lot different from WinAPI GUI (native) which is what AutoIt uses. To begin with, GTK+ doesn't use a coordinate based approach, it uses a layout based approach similar to HTML, it even has support for CSS! And also WinAPI doesn't provide all controls which GTK+ provides.
    1 point
  12. I used @boomingranny's code and corrected/added handy stuff, like: 1) The file-version would not show compiled scripts 2) Added the command line to the listview 3) Added exit to tray on using the emergency exit found in the extras tab 4) added a context menu to do more than DClick to open the folder The code is in the downloads area.
    1 point
×
×
  • Create New...