Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/07/2022 in all areas

  1. Jos

    2022 updates for Autoit

    That's fine for professionals, which for obvious reasons is not the focal group for this website. I use both the Free version of Visual Studio, for SciTE4AutoIt3 development and other projects I work on as hobbyist, and use VSCODE together with PlatformIO for development of ESP32/ESP8266 projects and must say that VSCODE is a pretty nice free editor that will do quite well for the majority of our audience. So maybe you really need to think about what you post before burping your expert opinion in these thread. ... but hey .... who am I to say all of this as I am indeed a simple hobbyist.
    2 points
  2. I've ported some of the JavaScript 140 Bytes demos from dwitter.net to FreeBasic. Download AiO with 1000 examples (7-Zip archive): The beauty - magic of math Vol. 1 - 23 build 2024-01-14.7z (5.09 mb with source code and Windows x64 compiled executables) or have a look to my 1drive folder: _dwitter.net Some screenshots: ... Autoit is too slow for almost all of these examples. Happy watching.
    1 point
  3. Trong

    Image Search UDF

    Version 2021.8.30.2

    10,231 downloads

    Use MouseClick() need: #RequireAdmin Dll is already integrated in UDF ! ; #INDEX# =============================================================== ; Title .........: ImageSearch ; AutoIt Version : 3.x ; Language ......: English ; Description ...: Check image Appears or Not and Return the position of an image on the desktop ; Author(s) .....: Dao Van Trong - TRONG.LIVE ; ======================================================================= ; #CURRENT# ============================================================= ; _ImageSearch ; _ImageSearch_Area ; _ImageSearch_Wait ; _ImageSearch_WaitArea ; ======================================================================== ;========================================================================= ; ; Author:...........: AutoIT VietNam : Dao Van Trong - TRONG.LIVE ; Description:......: Check image Appears or Not ; Find and return the position of an image on the desktop ; Syntax:........... _ImageSearch_Area, _ImageSearch ; Parameter(s):..... $_ImagePath: The image to locate on the desktop ; May be a list of image by delimited by "|" ; i.e: $_ImagePath = "image1.bmp|image2.bmp|image3.bmp" ; $P_x1 $P_y1: Position of 1st point ; $P_x2 $P_y2: Position of 2nd point - Default is last botton right of desktop ; $_Tolerance: 0 for no tolerance (0-255). Needed when colors of image differ from desktop. e.g GIF ; $_CenterPos: boolen. True will return $array[1] x $array[2] is center of image found. ; False will return top-left position ; Return Value(s):.. Return an array has 3 item ; On Success: $array[0] 1 ; On Failure: $array[0] 0 ; DLL not found or other error: $array[0] -1 ; $array[1] x $array[2]: position of image what found on desktop ; ; Note:............. Use _ImageSearch to search the entire desktop ; _ImageSearch_Area to specify a desktop region to search ; $_ImagePath with more item need more time appear on screen before function can detect. ; Decrease sleep time in the loop to detect faster. But less performance. I.e CPULoad increased ; ;======================================================================== EG 1: ;~ Opt("MustDeclareVars", 1) ;~ #AutoIt3Wrapper_UseX64=y ;~ #AutoIt3Wrapper_Change2CUI=y #RequireAdmin #include "_ImageSearch_UDF.au3" HotKeySet("{Esc}", "_Exit") ; Press ESC for exit Func _Exit() Exit 0 EndFunc ;==>_Exit Global Const $Ask_On_Found = 0 Global Const $Mouse_Move_On_Found = 1 Global Const $Mouse_Click_On_Found = 0 Global Const $iSleep_Time=500 Global $sCount = 0, $_Image_1 = @ScriptDir & "\example.bmp" ; First, use this function to create a file bmp, maybe a desktop icon for example') MsgBox(64 + 262144, 'ImageSearch', 'At first, create a file bmp,' & @CRLF & 'photos that will search on the screen!') _ImageSearch_Create_BMP($_Image_1) ConsoleWrite("! Search for images: " & $_Image_1 & @CRLF & '! Searching on the screen ...' & @CRLF) While 1 ToolTip('(Press ESC for EXIT) Searching ...', 1, 1) Sleep($iSleep_Time) $sCount += 1 Local $return = _ImageSearch($_Image_1) If $return[0] = 1 Then ConsoleWrite('- [' & $sCount & '] Image found:' & " X=" & $return[1] & " Y=" & $return[2] & @CRLF) If $Mouse_Move_On_Found Then MouseMove($return[1], $return[2]) Sleep($iSleep_Time) EndIf If $Mouse_Click_On_Found Then MouseClick("left", $return[1], $return[2]) ToolTip('(Press ESC for EXIT) - [' & $sCount & "] Image found:" & " X=" & $return[1] & " Y=" & $return[2], 1, 1) If $Ask_On_Found Then Local $ask = MsgBox(6 + 262144, 'Success [' & $sCount & ']', 'Image found:' & " X=" & $return[1] & " Y=" & $return[2]) If $ask = 2 Or $ask = 3 Or $ask = 5 Or $ask = 7 Then Exit ;No, Abort, Cancel, and Ignore If $ask = 10 Then _ImageSearch_Create_BMP($_Image_1) ; Continue ;Try Again EndIf EndIf Sleep(200) WEnd Video demo: [+] When any problem or error occurs, please make sure that:- Downloaded and used the latest version.- Set screen Screen Scale and layout = 100%- Installed display driver.- Tried turning off the antivirus- Full installation: Microsoft Visual C++ Redistributable 2005->2022 [+] You can download the AIO version of the Visual C++ Redistributable here: -> https://www.mediafire.com/file/0ak8dcj9mdn7nyq/VisualCppRedist_AIO_2005-2022_x86_x64_%5Btrong.live%5D.zip/file -> FOR Windows XP: https://www.mediafire.com/file/5m5lnr1kfg73tc9/VisualCppRedist_AIO_2005-2019_x86_XP_%5Btrong.live%5D.zip/file <!> Password for Extract: trong.live [+] The last full version of SCITE4AutoIT supports windows XP: https://www.autoitscript.com/autoit3/scite/download/archive/v19.1127.1402.0-SciTE4AutoIt3.exe
    1 point
  4. Thanks for that you back with answer which capability setting solves your issue.
    1 point
  5. @mLipok This one below fixed the problem. I was adding them one at a time and removing the others. I will keep this list for future use as I write a lot of other scripts. Thanks VERY much for the quick response. @Danp2, thanks for your help as well. You guys are awesome. _WD_CapabilitiesAdd('args', '--disable-web-security')
    1 point
  6. it looks nice. That said: the paths are hard coded full path and what I do is run any version of AutoIt in portable SciTE(s). Just decompress anywhere and run the environment. So if running say, production and beta with relative paths then VSCode could be something interesting to look at for me. Also, the checker and tidy are from the SciTE distribution, so is not a replacement for SciTE distribution. On the other hand, maintaining utilities, is less than utilities and the editor too. My 2 cents. I don't wanna start a tug war.
    1 point
  7. Thank you Junkew It worked with the controltype criteria ! $oDocument = _UIA_getFirstObjectOfElement($oChrome, "controltype:=" & $UIA_DocumentControlTypeId, $treescope_subtree) If Not IsObj($oDocument) Then _UIA_DumpThemAll($oChrome, $treescope_subtree) Else $t = StringSplit(_UIA_getPropertyValue($oDocument, $UIA_BoundingRectanglePropertyId), ";") _UIA_DrawRect($t[1], $t[3] + $t[1], $t[2], $t[4] + $t[2]) EndIf Sleep(500) $oSavePlease = _UIA_getObjectByFindAll($oDocument, "name:=SAUVEGARDER;controltype:="& $UIA_HyperlinkControlTypeId, $treescope_subtree) If Not IsObj($oSavePlease) Then _UIA_DumpThemAll($oDocument, $treescope_subtree) ConsoleWrite("Test") Else _UIA_action($oSavePlease, "invoke") EndIf So the summary : The problem was due to two occurences of the same name in the treescope. It was discovered thanks to the "FindThemAll" function. The script was always calling the first one, which was the wrong one. By using the Spytool, the difference between the two objects became apparent. The two object had for example a different controltype. Adding the controltype criteria has thus allowed to target the right object. "name:=SAUVEGARDER;controltype:="& $UIA_HyperlinkControlTypeId The button is now correctly targeted and can be invoked. Thank you very much Junkew !
    1 point
  8. Sorry syntax is with a semicolon ;~ _UIA_setVar("MACH3.mnuFile","name:=((File)|(Bestand));index:=2") First get it debugged with findthemall modification's like if _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId)="SAUVEGARDER" then consolewrite(_UIA_getAllPropertyValues($UIA_oUIElement) & @CRLF) endif Integrated like below Func findThemAll($oElementStart, $TreeScope) Local $hTimer = TimerInit() ;~ Get result with findall function alternative could be the treewalker Dim $pCondition, $pTrueCondition Dim $pElements, $iLength $UIA_oUIAutomation.CreateTrueCondition($pTrueCondition) $oCondition = ObjCreateInterface($pTrueCondition, $sIID_IUIAutomationCondition, $dtagIUIAutomationCondition) ;~ $oCondition1 = _AutoItObject_WrapperCreate($aCall[1], $dtagIUIAutomationCondition) ;~ Tricky to search all descendants on html objects or from desktop/root element $oElementStart.FindAll($TreeScope, $oCondition, $pElements) $oAutomationElementArray = ObjCreateInterface($pElements, $sIID_IUIAutomationElementArray, $dtagIUIAutomationElementArray) $oAutomationElementArray.Length($iLength) For $i = 0 To $iLength - 1; it's zero based $oAutomationElementArray.GetElement($i, $UIA_pUIElement) $oUIElement = ObjCreateInterface($UIA_pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement) ConsoleWrite("Title is: " & _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId) & @TAB & "Class=" & _UIA_getPropertyValue($oUIElement, $uia_classnamepropertyid) & @CRLF) if _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId)="SAUVEGARDER" then $t = StringSplit(_UIA_getPropertyValue($oUIElement, $UIA_BoundingRectanglePropertyId), ";") _UIA_DrawRect($t[1], $t[3] + $t[1], $t[2], $t[4] + $t[2]) consolewrite(_UIA_getAllPropertyValues($UIA_oUIElement) & @CRLF) endif Next Local $fDiff = TimerDiff($hTimer) Consolewrite("Findthemall took: " & $fDiff & " milliseconds" & @CRLF & @CRLF) EndFunc ;==>findThemAll
    1 point
  9. Please put the code in coding tags to keep it readable Just run a lengthy dump first from your whole page and then see if the name is not there multiple times findThemAll($oChrome, $treescope_subtree) findThemAll is just a function helpfull for debugging so you have to extend/customize to your own need. It looks like it finds the element so you could add in the for/next loop if _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId)= "SAUVEGARDER" then $t = StringSplit(_UIA_getPropertyValue($oUIElement, $UIA_BoundingRectanglePropertyId), ";") _UIA_DrawRect($t[1], $t[3] + $t[1], $t[2], $t[4] + $t[2]) endif Is there any way to directly get the coordinates from an object created with _UIA_getObjectByFindAll ? yes, see above how to get the bounding rectangle so it becomes something like below $oUIElement=_UIA_getObjectByFindAll(..... $t = StringSplit(_UIA_getPropertyValue($oUIElement, $UIA_BoundingRectanglePropertyId), ";") _UIA_DrawRect($t[1], $t[3] + $t[1], $t[2], $t[4] + $t[2])
    1 point
  10. I went the extra mile last year; it was a challenge in the beginning, but - for me - absolutely worth it. Once a script is saved, AU3Check is run automatically and shown in the problems tab.
    1 point
  11. Jos

    2022 updates for Autoit

    I honestly do not care about how you interpret my posts and for sure are't trying to get into a pissing contest with you. My posts are simply an other opinion to counter your strong opinion ,which in my humble view are pretty "colored". I leave it to the readers to filter the information that they are interested in. over and out
    1 point
  12. have the user supply it beforehand, something like: $sName = inputbox('put yer name here'......... $CMD = 'New-psDrive ' & $sName
    1 point
×
×
  • Create New...