Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/19/2022 in all areas

  1. smbape

    OpenCV v4 UDF

    I wanted to use OpenCV v4+ in AutoIt. I found Opencv UDF on the forum, but there was no support for OpenCV v4+ This UDF provides support for OpenCV v4+ Update There is a new implementation using COM. It is almost as easy as python to use It is also possible to interact with GDI+ Download and extract opencv-4.10.0-windows.exe into a folder Download and extract autoit-opencv-4.10.0-com-v2.6.2.7z into a folder Sources Here Documentation A generated documentation for functions is available here Examples More samples can be found here To run them, please follow these instructions Showing an image #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "autoit-opencv-com\udf\opencv_udf_utils.au3" _OpenCV_Open("opencv-4.7.0-windows\opencv\build\x64\vc16\bin\opencv_world470.dll", "autoit-opencv-com\autoit_opencv_com470.dll") OnAutoItExitRegister("_OnAutoItExit") Example() Func Example() Local $cv = _OpenCV_get() If Not IsObj($cv) Then Return Local $img = _OpenCV_imread_and_check(_OpenCV_FindFile("samples\data\lena.jpg")) $cv.imshow("Image", $img) $cv.waitKey() $cv.destroyAllWindows() EndFunc ;==>Example Func _OnAutoItExit() _OpenCV_Close() EndFunc ;==>_OnAutoItExit Drawing contours #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "autoit-opencv-com\udf\opencv_udf_utils.au3" _OpenCV_Open("opencv-4.7.0-windows\opencv\build\x64\vc16\bin\opencv_world470.dll", "autoit-opencv-com\autoit_opencv_com470.dll") OnAutoItExitRegister("_OnAutoItExit") Example() Func Example() Local $cv = _OpenCV_get() If Not IsObj($cv) Then Return Local $img = _OpenCV_imread_and_check("samples\data\pic1.png") Local $img_grey = $cv.cvtColor($img, $CV_COLOR_BGR2GRAY) $cv.threshold($img_grey, 100, 255, $CV_THRESH_BINARY) Local $thresh = $cv.extended[1] Local $contours = $cv.findContours($thresh, $CV_RETR_TREE, $CV_CHAIN_APPROX_SIMPLE) ConsoleWrite("Found " & UBound($contours) & " contours" & @CRLF & @CRLF) $cv.drawContours($img, $contours, -1, _OpenCV_Scalar(0, 0, 255), 2) $cv.imshow("Image", $img) $cv.waitKey() $cv.destroyAllWindows() EndFunc ;==>Example Func _OnAutoItExit() _OpenCV_Close() EndFunc ;==>_OnAutoItExit Showing an image in autoit GUI #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "autoit-opencv-com\udf\opencv_udf_utils.au3" #include <GUIConstantsEx.au3> _OpenCV_Open("opencv-4.7.0-windows\opencv\build\x64\vc16\bin\opencv_world470.dll", "autoit-opencv-com\autoit_opencv_com470.dll") OnAutoItExitRegister("_OnAutoItExit") Example() Func Example() Local $cv = _OpenCV_get() If Not IsObj($cv) Then Return #Region ### START Koda GUI section ### Form= Local $FormGUI = GUICreate("show image in autoit gui", 400, 400, 200, 200) Local $Pic = GUICtrlCreatePic("", 0, 0, 400, 400) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Local $img = _OpenCV_imread_and_check(_OpenCV_FindFile("samples\data\lena.jpg")) _OpenCV_imshow_ControlPic($img, $FormGUI, $Pic) Local $nMsg While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd $cv.destroyAllWindows() EndFunc ;==>Example Func _OnAutoItExit() _OpenCV_Close() EndFunc ;==>_OnAutoItExit Showing an image in an autosized autoit GUI #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "autoit-opencv-com\udf\opencv_udf_utils.au3" #include <GUIConstantsEx.au3> _OpenCV_Open("opencv-4.7.0-windows\opencv\build\x64\vc16\bin\opencv_world470.dll", "autoit-opencv-com\autoit_opencv_com470.dll") OnAutoItExitRegister("_OnAutoItExit") Example() Func Example() Local $cv = _OpenCV_get() If Not IsObj($cv) Then Return #Region ### START Koda GUI section ### Form= Local $FormGUI = GUICreate("show image in autoit gui [WINDOW_AUTOSIZE]", 400, 400, 200, 200) Local $Pic = GUICtrlCreatePic("", 0, 0, 400, 400) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Local $img = _OpenCV_imread_and_check(_OpenCV_FindFile("samples\data\lena.jpg")) ; get the image size and resize the GUI and the PIC control WinMove($FormGUI, "", Default, Default, $img.width, $img.height) GUICtrlSetPos($Pic, Default, Default, $img.width, $img.height) _OpenCV_imshow_ControlPic($img, $FormGUI, $Pic) Local $nMsg While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd $cv.destroyAllWindows() EndFunc ;==>Example Func _OnAutoItExit() _OpenCV_Close() EndFunc ;==>_OnAutoItExit Screen capture #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "autoit-opencv-com\udf\opencv_udf_utils.au3" _OpenCV_Open("opencv-4.7.0-windows\opencv\build\x64\vc16\bin\opencv_world470.dll", "autoit-opencv-com\autoit_opencv_com470.dll") OnAutoItExitRegister("_OnAutoItExit") Example() Func Example() Local $cv = _OpenCV_get() If Not IsObj($cv) Then Return Local $iLeft = 200 Local $iTop = 200 Local $iWidth = 400 Local $iHeight = 400 Local $aRect[4] = [$iLeft, $iTop, $iWidth, $iHeight] Local $img = _OpenCV_GetDesktopScreenMat($aRect) $cv.imshow("Screen capture", $img) $cv.waitKey() $cv.destroyAllWindows() EndFunc ;==>Example Func _OnAutoItExit() _OpenCV_Close() EndFunc ;==>_OnAutoItExit Find template #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "autoit-opencv-com\udf\opencv_udf_utils.au3" _OpenCV_Open("opencv-4.7.0-windows\opencv\build\x64\vc16\bin\opencv_world470.dll", "autoit-opencv-com\autoit_opencv_com470.dll") OnAutoItExitRegister("_OnAutoItExit") Example() Func Example() Local $cv = _OpenCV_get() If Not IsObj($cv) Then Return Local $img = _OpenCV_imread_and_check(_OpenCV_FindFile("samples\data\mario.png")) Local $tmpl = _OpenCV_imread_and_check(_OpenCV_FindFile("samples\data\mario_coin.png")) ; The higher the value, the higher the match is exact Local $threshold = 0.8 Local $aMatches = _OpenCV_FindTemplate($img, $tmpl, $threshold) Local $aRedColor = _OpenCV_RGB(255, 0, 0) Local $aMatchRect[4] = [0, 0, $tmpl.width, $tmpl.height] For $i = 0 To UBound($aMatches) - 1 $aMatchRect[0] = $aMatches[$i][0] $aMatchRect[1] = $aMatches[$i][1] ; Draw a red rectangle around the matched position $cv.rectangle($img, $aMatchRect, $aRedColor) Next $cv.imshow("Find template example", $img) $cv.waitKey() $cv.destroyAllWindows() EndFunc ;==>Example Func _OnAutoItExit() _OpenCV_Close() EndFunc ;==>_OnAutoItExit Video capture file #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "autoit-opencv-com\udf\opencv_udf_utils.au3" #include <Misc.au3> _OpenCV_Open("opencv-4.7.0-windows\opencv\build\x64\vc16\bin\opencv_world470.dll", "autoit-opencv-com\autoit_opencv_com470.dll") OnAutoItExitRegister("_OnAutoItExit") Example() Func Example() Local $cv = _OpenCV_get() If Not IsObj($cv) Then Return Local $cap = _OpenCV_ObjCreate("cv.VideoCapture").create(_OpenCV_FindFile("samples\data\vtest.avi")) If Not $cap.isOpened() Then ConsoleWriteError("!>Error: cannot open the video file." & @CRLF) Exit EndIf Local $frame = _OpenCV_ObjCreate("cv.Mat") While 1 If _IsPressed("1B") Or _IsPressed(Hex(Asc("Q"))) Then ExitLoop EndIf If Not $cap.read($frame) Then ConsoleWriteError("!>Error: cannot read the video or end of the video." & @CRLF) ExitLoop EndIf $cv.imshow("capture video file", $frame) Sleep(30) WEnd $cv.destroyAllWindows() EndFunc ;==>Example Func _OnAutoItExit() _OpenCV_Close() EndFunc ;==>_OnAutoItExit Video capture camera #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "autoit-opencv-com\udf\opencv_udf_utils.au3" #include <Misc.au3> _OpenCV_Open("opencv-4.7.0-windows\opencv\build\x64\vc16\bin\opencv_world470.dll", "autoit-opencv-com\autoit_opencv_com470.dll") OnAutoItExitRegister("_OnAutoItExit") Example() Func Example() Local $cv = _OpenCV_get() If Not IsObj($cv) Then Return Local $iCamId = 0 Local $cap = _OpenCV_ObjCreate("cv.VideoCapture").create($iCamId) If Not $cap.isOpened() Then ConsoleWriteError("!>Error: cannot open the camera." & @CRLF) Exit EndIf Local $frame = _OpenCV_ObjCreate("cv.Mat") While 1 If _IsPressed("1B") Or _IsPressed(Hex(Asc("Q"))) Then ExitLoop EndIf If $cap.read($frame) Then ;; Flip the image horizontally to give the mirror impression $frame = $cv.flip($frame, 1) $cv.imshow("capture camera", $frame) Else ConsoleWriteError("!>Error: cannot read the camera." & @CRLF) EndIf Sleep(30) WEnd $cv.destroyAllWindows() EndFunc ;==>Example Func _OnAutoItExit() _OpenCV_Close() EndFunc ;==>_OnAutoItExit Resize an image with GDI+ #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include "autoit-opencv-com\udf\opencv_udf_utils.au3" _OpenCV_Open("opencv-4.7.0-windows\opencv\build\x64\vc16\bin\opencv_world470.dll", "autoit-opencv-com\autoit_opencv_com470.dll") _GDIPlus_Startup() OnAutoItExitRegister("_OnAutoItExit") Example() Func Example() Local $cv = _OpenCV_get() If Not IsObj($cv) Then Return Local $bMethod = 1 Local $img = _OpenCV_imread_and_check(_OpenCV_FindFile("samples\tutorial_code\yolo\scooter-5180947_1920.jpg")) Local $resized If $bMethod Then $resized = $img.GdiplusResize(600, 400) Else Local $hImage = $img.convertToBitmap() Local $hResizedImage = _GDIPlus_ImageResize($hImage, 600, 400) _GDIPlus_BitmapDispose($hImage) $resized = $cv.createMatFromBitmap($hResizedImage) _GDIPlus_BitmapDispose($hResizedImage) EndIf $cv.imshow("Resized with GDI+", $resized) $cv.waitKey() $cv.destroyAllWindows() EndFunc ;==>Example Func _OnAutoItExit() _GDIPlus_Shutdown() _OpenCV_Close() EndFunc ;==>_OnAutoItExit
    1 point
  2. Hi guys, here is a small dll wrapper I made geared at making YOLOv3 (Joseph Redmon, Ali Farhadi) more accessible to AutoIt users. Homepage of YOLO: https://pjreddie.com/darknet/yolo/ Technical overview: You only look once (YOLO) is a state-of-the-art, real-time object detection system. On a Pascal Titan X it processes images at 30 FPS and has a mAP of 57.9% on COCO test-dev. (from https://pjreddie.com/darknet/yolo/) Screenshots: Features: This UDF currently supports recognizing objects in images passed in as a HBITMAP Below is a complete list of the functions currently available in this library: ; #CURRENT# ===================================================================================================================== ;_AutoYolo3_GetLastError ;_AutoYolo3_GetObjInHBitmap ;_AutoYolo3_GetVersion ;_AutoYolo3_SetConfig ;_AutoYolo3_YoloTest ; =============================================================================================================================== The _AutoYolo3_GetObjInHBitmap function returns a 2D Array of detected objects as illustrated below: Examples: Example1: basic_example.au3 #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <AutoYOLO3.au3> #include <GDIPlus.au3> ConsoleWrite("Using autoyolo version:" & _AutoYolo3_GetVersion() & @CRLF) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir&"\people-2557408_1920.jpg") Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage, 0x00000000) Local $aRes = _AutoYolo3_GetObjInHBitmap($hHBITMAP) _ArrayDisplay($aRes) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Example 2: gui_example.au3 #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 5 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <AutoYOLO3.au3> #include <GDIPlus.au3> ConsoleWrite("Using autoyolo version:" & _AutoYolo3_GetVersion() & @CRLF) _GUIExample1() Func _GUIExample1()     _GDIPlus_Startup()     Local $iPicW=609     Local $iPicH=385     #Region ### START Koda GUI section ### Form=     GUICreate(@ScriptName&" - Object Detection with AutoIt!", 625, 506)     GUISetFont(14, 400, 0, "Calibri")     Local $Button1 = GUICtrlCreateButton("browse", 472, 8, 145, 33)     Local $Input1 = GUICtrlCreateInput(@ScriptDir & "\scooter-5180947_1920.jpg", 8, 8, 457, 31)     Local $Button2 = GUICtrlCreateButton("detect objects!", 228, 448, 169, 49)     Local $Pic1 = GUICtrlCreatePic("", 8, 48, $iPicW, $iPicH, $SS_BITMAP)     GUISetState(@SW_SHOW)     #EndRegion ### END Koda GUI section ###     Local $hImage = _LoadImage($Input1, $Pic1, 0, $iPicW,$iPicH)     While 1         $nMsg = GUIGetMsg()         Switch $nMsg             Case $GUI_EVENT_CLOSE                 Exit             Case $Button1                 GUICtrlSetData($Input1, FileOpenDialog("Please select image", @ScriptDir, "All (*.*)"))                 $hImage = _LoadImage($Input1, $Pic1, $hImage, $iPicW,$iPicH)             Case $Button2                 GUICtrlSetState($Button2, $GUI_DISABLE)                 GUICtrlSetData($Button2, "working..")                 Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage, 0x00000000)                 Local $aRes = _AutoYolo3_GetObjInHBitmap($hHBITMAP)                 ;_ArrayDisplay($aRes)                 If @error Then                     Local $iErr = @error                     Local $asDllErrors[6] = ["No error", "unable to use the DLL file", "unknown ""return type""", """function"" not found in the DLL file", "bad number of parameters", "bad parameter"]                     If $iErr < 6 Then                         MsgBox(32, @ScriptName, "DLL Error, " & $asDllErrors[$iErr])                     Else                         MsgBox(32, @ScriptName, "DLL Error, " & _AutoYolo3_GetLastError())                     EndIf                 ElseIf _AutoYolo3_GetLastError() <> "" Then                     MsgBox(32, @ScriptName, _AutoYolo3_GetLastError())                 Else                     ;nice thick green boxes                     Local $hPen = _GDIPlus_PenCreate(0xFF00FF00, 2, 2)                     Local $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000)                     Local $hFormat = _GDIPlus_StringFormatCreate()                     Local $hFamily = _GDIPlus_FontFamilyCreate("Calibri")                     Local $hFont = _GDIPlus_FontCreate($hFamily, 12, 0)                     Local $tLayout = _GDIPlus_RectFCreate(140, 110, 100, 20)                     Local $hBrushBack = _GDIPlus_BrushCreateSolid(0x7FFFFFFF) ;color format AARRGGBB (hex)                     $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)                     _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;sets the graphics object rendering quality (antialiasing)                     For $i = 1 To $aRes[0][0]                         ; Draw a frame around the object                         _GDIPlus_GraphicsDrawRect($hGraphics, $aRes[$i][2], $aRes[$i][3] , ($aRes[$i][4] - $aRes[$i][2]) , ($aRes[$i][5] - $aRes[$i][3]) , $hPen)                         ; Label it                         $sLabel = $aRes[$i][0] & " " & StringLeft($aRes[$i][1], 6)                         $tLayout = _GDIPlus_RectFCreate($aRes[$i][2] , $aRes[$i][3] , 200, 20)                         $iBackLen = 0                         If (StringLen($sLabel) * 8) > $iBackLen Then                             $iBackLen = StringLen($sLabel) * 8                         EndIf                         _GDIPlus_GraphicsFillRect($hGraphics, $aRes[$i][2] , $aRes[$i][3], $iBackLen, 20, $hBrushBack)                         _GDIPlus_GraphicsDrawStringEx($hGraphics, $sLabel, $hFont, $tLayout, $hFormat, $hBrush)                     Next                     $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage, 0x00000000)                     GUICtrlSendMsg($Pic1, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBITMAP)                     _GDIPlus_PenDispose($hPen)                     _GDIPlus_FontDispose($hFont)                     _GDIPlus_FontFamilyDispose($hFamily)                     _GDIPlus_StringFormatDispose($hFormat)                     _GDIPlus_BrushDispose($hBrush)                     _GDIPlus_BrushDispose($hBrushBack)                     _GDIPlus_GraphicsDispose($hGraphics)                 EndIf                 GUICtrlSetData($Button2, "detect objects!")                 GUICtrlSetState($Button2, $GUI_ENABLE)         EndSwitch     WEnd     If $hImage <> 0 Then         _GDIPlus_ImageDispose($hImage)     EndIf     _GDIPlus_Shutdown() EndFunc   ;==>_GUIExample1 Func _LoadImage($Input1, $Pic1, $hImage, $iPicW, $iPicH)     If $hImage <> 0 Then         _GDIPlus_ImageDispose($hImage)     EndIf     Local $sImagePath = GUICtrlRead($Input1)     $hImage = _GDIPlus_ImageLoadFromFile($sImagePath)     Local $iWidth = _GDIPlus_ImageGetWidth($hImage)     Local $iHeight = _GDIPlus_ImageGetHeight($hImage)     Local $sFactor = 1     If $iWidth > $iPicW Then         $sFactor = $iPicW / $iWidth     EndIf     If $iHeight > $iPicH And ($iHeight * $sFactor) > $iPicH Then         $sFactor = $iPicH / $iHeight     EndIf     $iHeight = $iHeight * $sFactor     $iWidth = $iWidth * $sFactor     $hResizedImage = _GDIPlus_ImageResize($hImage, $iWidth, $iHeight)     _GDIPlus_BitmapDispose($hImage)     Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hResizedImage, 0x00000000)     GUICtrlSendMsg($Pic1, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBITMAP)     Return $hResizedImage EndFunc   ;==>_LoadImage Requirements: Windows x64, AutoIt x64 Microsoft Visual C++ 2015-2019 Redistributable (x64) - https://aka.ms/vs/16/release/vc_redist.x64.exe OpenCV binaries - https://sourceforge.net/projects/opencvlibrary/files/4.3.0/opencv-4.3.0-vc14_vc15.exe/download Quickstart: Ensure you are running Windows x64, AutoIt x64 Install Microsoft Visual C++ 2015-2019 Redistributable (x64) if not already installed - https://aka.ms/vs/16/release/vc_redist.x64.exe Create your project directory anywhere, for this example we use C:\projectdir\ Download OpenCV - https://sourceforge.net/projects/opencvlibrary/files/4.3.0/opencv-4.3.0-vc14_vc15.exe/download Unpack OpenCV anywhere and copy opencv_videoio_ffmpeg430_64.dll, opencv_world430.dll to C:\projectdir\ Download trained weights, classes, config files Weights file: Save as C:\projectdir\yolo\yolov3.weights - https://pjreddie.com/media/files/yolov3.weights Classes file: Save as C:\projectdir\yolo\yolov3.txt - https://github.com/pjreddie/darknet/blob/master/data/coco.names https://raw.githubusercontent.com/zishor/yolo-python-rtsp/master/cfg/yolov3.txt NEW Config file: Save as C:\projectdir\yolo\yolov3.cfg - https://github.com/pjreddie/darknet/blob/master/cfg/yolov3.cfg https://raw.githubusercontent.com/zishor/yolo-python-rtsp/master/cfg/yolov3.cfg NEW Unpack autoyolo1.1.zip from downloads below to your project dir So your project directory should look like: C:\projectdir\ │   autoyolo.dll │   AutoYOLO3.au3 │   basic_example.au3 │   gui_example.au3 │   opencv_videoio_ffmpeg430_64.dll │   opencv_world430.dll │   people-2557408_1920.jpg │   scooter-5180947_1920.jpg │ └───yolo         yolov3.cfg         yolov3.txt         yolov3.weights You are done! Try running one of the examples! Download: LAST UPDATED: 06-JUN-2020 autoyolo1.1.zip 785 KB Credits: YOLOv3: An Incremental Improvement - Joseph Redmon, Ali Farhad https://pjreddie.com/yolo/ https://www.learnopencv.com/deep-learning-based-object-detection-using-yolov3-with-opencv-python-c/ zishor for alternative config and classes (https://github.com/zishor/yolo-python-rtsp) MIT License FAQ: I get error "Cannot use dll" Ensure that you are running script as x64, that you have Microsoft Visual C++ 2015-2019 Redistributable (x64) installed, and that the following files are in the @ScriptDir: autoyolo.dll, opencv_videoio_ffmpeg430_64.dll, opencv_world430.dll I get a crash when clicking detect Try using the NEW config and classes links above All feedback is welcome -smartee
    1 point
  3. Nine

    Click a Link In Chrome?

    Try first download latest WinHTTP version of the UDF as mentioned in the console...
    1 point
  4. OJBakker

    Copy Struct to 2D Array

    The problem is using _arrayadd() with the delimited-string option. Your object gets converted to string and is no longer an object when extracted. Do not use delimited-string for complex datatypes. Use the array-option to avoid undesired conversions. #include <array.au3> Local Const $tagObj = "hwnd hwnd;" & _ "byte ctrlID;" & _ "wchar dir[6];" & _ "byte idBKG;" Local $oObj = DllStructCreate($tagObj) $oObj.hwnd = 0x1230 $oObj.ctrlID = 2 $oObj.dir = "left" local $aArray1[0] _arrayadd($aArray1, $oObj) MsgBox(Default, "vartype", VarGetType($aArray1[0])) Msgbox(64,"$aArray1[0].dir", $aArray1[0].dir) local $aArray2[0][3] local $aAddArray[1][3] = [["main1", $oObj.hwnd, $oObj]] _arrayadd($aArray2, $aAddArray) MsgBox(Default, "vartype", VarGetType($aArray2[0][2])) Msgbox(64,"$aArray2[0][2].dir", $aArray2[0][2].dir) Exit
    1 point
  5. water

    Example OF dates

    You are lucky that Musashi provided code for all of your questions 🙂 Usually we do not spoon feed users with solutions. We help users to find solutions themselfes.
    1 point
  6. Musashi

    Example OF dates

    #include <Date.au3> Local $sCurrentDate, $sNewDate $sCurrentDate = _NowCalcDate() ; current date in format YYYY/MM/DD $sNewDate = _DateAdd('d', 2, $sCurrentDate) ; current date + 2 days MsgBox(4096, "Show Dates : ", "Current "& @TAB & "= " & $sCurrentDate & @CRLF & _ "NewDate "& @TAB & "= " & $sNewDate & @CRLF)
    1 point
  7. @hudsonhock StringRegExpReplace acts differently from StringRegExp. When you specify surrounding characters, they are also replaced, but only the captured part can be back-referenced. So in order to make it work, you will need to repeat the surroundings in the replacement string. For example : FileWrite("NewConEmu.xml", StringRegExpReplace(FileRead("ConEmu.xml"), '(name="AnsiLogPath" type="string" data=)".*"', '$1"NewValueHere"')) But you could also use the XMLDOM object, which give you more control over an xml file : Local $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.load("ConEmu.xml") Local $oNode = $oXML.SelectSingleNode("//value[@name='AnsiLogPath']") ConsoleWrite($oNode.xml & @CRLF) $oNode.setAttribute("data", "testpath") ConsoleWrite($oNode.xml & @CRLF) $oXml.save("NewConEmu.xml")
    1 point
  8. This doesn't work. Do Sleep(100) Until WinActive( "TheNuggetQueen - Discord" ) Everyone here is going "well duh ", but I mean, why can't that work? Is there any other type of loop that I could use in one line that would work here? Btw, I want to replace sleep with "WinActivate" to loop until window is at forefront.(EDIT: I'm not automating anything other than Discord! Goodness that came out wrong the first time lmao. I'm writing a love message sender)
    0 points
  9. Here is a well commented and simple example that beginners should be able to follow. It deals with a lot of beginner consepts, a ton of them being consepts I started with. You must have discord running, and you will have to modify the Window title names, but it should otherwise work right out of the box for you. ;This will help us keep a running tally of how often we've thought about our S.O. ;We could do this totally in ram, but we would lose our count any time the program crashes or restarts. ;This allows us to reset our count according to our wishes. If Not FileExists( "count" ) Then ;If file doesn't exist, FileWriteLine( "count", "0" ) ;create the file with the number 0 EndIf ;This sets * on the numberpad as our hotkey to launch the main function. ;The loop just gives us a reason to be running in the background. Script can't end until we want it to or our hotkey isn't being watched for. HotKeySet("{NUMPADMULT}", "KissAndTell"); * on the numberpad. While 1 Sleep( 10000 ) WEnd Func KissAndTell() ;Create Function KissAndTell $count = FileReadLine( "count" ); Get number of times executed. $count = $count + 1; Account for this time by adding one. FileDelete("count"); Delete our file to ensure blank slate. FileWriteLine( "count", $count );write current count to file, recreating it. Do;Keep... WinActivate( "TheNuggetQueen - Discord");... activating this window until... Until WinActive( "TheNuggetQueen - Discord" );... we see that it's active. Send("My program is recording how much I think about you. I've thought about you " & $count & " times today! I love you!",1) Send("{ENTER}") EndFunc ;EndFunction
    0 points
×
×
  • Create New...