Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/09/2020 in all areas

  1. 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
  2. i am developing an App of Desktop activity logging and I must detect the incognito tabs and avoid to log them at the same time I must log the normal tabs. I've detected that there is a property for every Incognito tab Process Id which is True and for normal chrome tabs is False and that is "Disable Databases" which can be extracted from command line of every process. And with PID of every Tab it is solved.
    1 point
  3. You can make it all work fine without the _UrlDecode when you apply the following changes: Telegram.au3: Func _SendDocument($ChatID, $Document, $Caption = '', $ReplyMarkup = Default, $ReplyToMessage = '', $DisableNotification = False) Local $Query = $URL & '/sendDocument?chat_id=' & $ChatID & '&parse_mode=markdown&caption=' & $Caption If $ReplyMarkup <> Default Then $Query &= "&reply_markup=" & $ReplyMarkup If $ReplyToMessage <> '' Then $Query &= "&reply_to_message_id=" & $ReplyToMessage If $DisableNotification Then $Query &= "&disable_notification=" & $DisableNotification Local $hOpen = _WinHttpOpen() Local $Form = '<form action="' & $Query & '" method="post" enctype="multipart/form-data"><input type="file" name="document"/>' $Form &= '</form>' Local $Response = _WinHttpSimpleFormFill($Form, $hOpen, Default, _ "name:document", $Document) _WinHttpCloseHandle($hOpen) Local $json = Json_Decode($Response) If Not (Json_IsObject($json)) Then Return SetError($INVALID_JSON_RESPONSE, 0, False) ; JSON Check Return __GetFileID($json, 'document') EndFunc ;==>_SendDocument winhttp:au3: Func __WinHttpNormalizeActionURL($sActionPage, ByRef $sAction, ByRef $iScheme, ByRef $sNewURL, ByRef $sEnctype, ByRef $sMethod, $sURL = "") ;~ Local $aCrackURL = _WinHttpCrackUrl($sAction) Local $aCrackURL = _WinHttpCrackUrl($sAction, $ICU_DECODE) This issue is that the latter UDF call to _WinHttpCrackUrl($sAction) will perform a urlencode by default which is changed by adding the second parameter to make it do the reverse. Don't make this change a permanent one in the standard winhttp.au3, but for me now all works fine... both the emoji's and %0a for a newline. Jos
    1 point
  4. Try these https://www.autoitscript.com/forum/topic/196761-how-to-activate-specific-tabs-in-google-chrome/ https://www.autoitscript.com/forum/topic/179015-chrome-switch-multiple-tab/ https://www.google.com/search?q=site%3Awww.autoitscript.com+get+tab+from+chrome ..maybe there are clues there. Post the solution if it helped, for the next guy.
    1 point
  5. Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Moderation Team
    1 point
  6. @nooneclose Glad you got it working, even if it's only intermittently. FWIW, I don't recall having this fail, so it's likely something on your end. 😛 I don't think geckodriver supports multiple sessions, so maybe it's failing because you haven't completed the prior session. No way for me to know for sure without more details.
    1 point
  7. #include <ScreenCapture.au3> Func _testscreencapture() Local $a=83 Local $b=579 Local $c=422 Local $d=667 ; 467 <<<<<<<<<<<< _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image76.jpg",83, 579, 422, 667) if @error Then ConsoleWrite(@error & @CRLF) ShellExecute(@MyDocumentsDir & "\GDIPlus_Image76.jpg") Sleep(2000) _ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image77.jpg",$a, $b, $c, $d) ShellExecute(@MyDocumentsDir & "\GDIPlus_Image77.jpg") if @error Then ConsoleWrite(@error & @CRLF) EndFunc _testscreencapture()
    1 point
  8. I've just found a way with a Chrome's GPO for Windows by using URLWhitelist option. Registry tweak is: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\URLWhitelist] "1"="vmware-plugin://*" Anyway, thank again for you help Danp2 !
    1 point
  9. @Math43 Unsure if you can bypass that prompt, but you may want to do some research on that. Maybe this will help -- https://communities.vmware.com/thread/620083
    1 point
  10. @Math43 That function is designed to handle simple user prompts, which I'm guessing that doesn't apply to your situation. A detailed description of this webdriver functionality can be found here. There's likely a way to handle this with other WD UDF functions. Try examining this popup in the browser's Developer Tools. What does the associated HTML look like? Does it used frames? Etc.
    1 point
  11. DutchCoder

    AutoIt Snippets

    Wait for Mouse to move (two ways) Normally when you have a GUI you can use this: Func _MouseWaitMove() Do Sleep(100) Until GuiGetMsg() = -11 EndFunc But sometimes you don't have a GUI. This one always works: Func _MouseWaitMove() $_old = MouseGetPos() Do Sleep(100) $_new = MouseGetPos() Until ($_new[0] - $_old[0]) Or ($_new[1] - $_old[1]) EndFunc
    1 point
  12. Melba23

    how to screen capture?

    Dan_555, I suggest upgrading to 3.3.14.5: As you can see ScreenCapture was one of the affected functions. M23
    1 point
  13. Like this ? : #include <Array.au3> #include <String.au3> $one = _StrToArr(FileRead("1.txt")) $two = _StrToArr(FileRead("2.txt")) $tre = _StrToArr(FileRead("3.txt")) $end = False $max1 = UBound($one) / 2 $max2 = UBound($two) / 2 $max3 = UBound($tre) / 2 $max = $max1 If $max2 > $max Then $max = $max2 If $max2 > $max Then $max = $max3 cw("==") For $x = 0 To $max If $x < $max1 Then cw($one[($x * 2)]) cw($one[($x * 2) + 1]) cw("==") EndIf If $x < $max2 Then cw($two[($x * 2)]) cw($two[($x * 2) + 1]) cw("==") EndIf If $x < $max3 Then cw($tre[($x * 2)]) cw($tre[($x * 2) + 1]) cw("==") EndIf Next Func cw($txt) ConsoleWrite($txt & @CRLF) EndFunc ;==>cw Func _StrToArr($s) Local $a = _StringBetween($s, @CRLF, @CRLF) For $x = UBound($a) - 1 To 0 Step -1 If $a[$x] = "==" Then _ArrayDelete($a, $x) Next Return $a EndFunc ;==>_StrToArr
    1 point
  14. Hi TheXman, Thank you for the pointers I hope to find out and make a step 6 and replace the embedded manifest just to have it all in a single exe. But small steps .. 💪 Edit: I used resource hacker to replace the manifest worked @TheXman Thank you very much! I'll report this an hope to get this moved to the Autoit side.. 🙈
    1 point
  15. NOTE: This assumes that you are using a compiled AutoIt script (.exe), not AutoItX DLL. I mention this because you posted your topic to AutoItX Help & Support forum not AutoIt General Help & Support. The most likely reason that an executable is not recognizing external manifest information is because it probably has a manifest embedded in the executable. Compiled AutoIt executables have an embedded manifest. If an executable has an embedded manifest, it will not look for a Side-by-Side (SxS)/external manifest. So you can do one of 2 things, you can add the additional manifest information into the embedded manifest or you can remove the embedded manifest and create an external one. A long time ago, I created a script that automatically does this modification of a compiled AutoIt executable. I created it because I was playing with Chilkat Software's utilities. Chilkat also offers a COM/ActiveX version that can be run registration-free. My SxS Manifest Tool, as I called it, was created as a console app so that I could run it standalone or by using the #AutoIt3Wrapper_Run_After directive during the compile process of the script that used the COM DLL. Below is a summary of what it did or what needs to be done to create an external SxS/Registration-Free version of your app: My tool required 2 parameters as input, the executable's path and the COM's manifest file. Using that info, it would extract the embedded manifest from the executable file. I would then read the COM's manifest file and add the COM's manifest information to extracted manifest. I would then write the new external manifest file -- naming it the exe's file name with ".manifest" appended to it. Lastly, I would remove the reference to the embedded manifest file from the original executable. That's it. For the record, it was all done using pure AutoIt without any need for external utilities like ResourceHacker. Although, if I were going to do the process manually, I would definitely have used either ResourceHacker or a tool like it. Once you've create a SxS version of an app a few times, its quite simple and intuitive. Hopefully that points you in the right direction and gives you enough information for you to work with in order to make your own SxS version of an AutoIt EASendMail app.
    1 point
  16. https://web.archive.org/web/20110424092144/http://progandy.de/component/jdownloads/finish/3/2/0
    1 point
  17. I'm pretty sure that _GDIPlus_ImageLoadFromFile keeps the file open until the image is released with _GDIPlus_ImageDispose. That's the reason for the error.
    1 point
  18. Ascend4nt

    RegEx

    This would replace all unprintable characters: $sData=StringRegExpReplace($sData,'[^[:print:]]','') For keeping alphanumerics theres the '[:alnum:]' class as well. What you really want is to put everything you want to exclude into the [^..] part of the pattern. In other words, no '|' is needed ('[^ast\?]' will look for anything thats not a,s,t, or '?'). You could also do ranges. For example, if you want to include a range of ASCII characters, you could use something like '[^\x20-\x7e]'. Etc etc
    1 point
×
×
  • Create New...