Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/03/2021 in all areas

  1. UI Automation is amazing, what bothered me immediately though, was the lack of functions in LarsJ's approach. This is UDF tries to wrap up his approach into functions. LarsJ put a ton of work into making simple examples and I was eventually able to follow along. I highly suggest reading through at least some of those examples before starting here. When I was writing all of the functions, I started to notice more repetition and it started to remind me of the AutoIt window format of "TITLE:Window Name;CLASS:Window Class". I abstracted the functions one step further by parsing the simpler conditions from text, resulting in two methods to create them. See the examples file for more details. I've been working on this for a few years and finally decided that it was good enough that it might be helpful for someone. There won't likely be too many more updates from me as I don't use it much anymore, but I'll be happy to accept pull-requests or suggestions The UDF is hosted on GitHub: https://github.com/seadoggie01/UI-SimpleWrappers
    4 points
  2. Haha.... I and @Danyfirex we did something similar.... WIP. I post it here tomorrow.
    2 points
  3. junkew

    UI-SimpleWrappers UDF

    Nice to see more examples of using UIA. We should merge it at a certain time ๐Ÿ˜‰ Some of the stuff you wrote is also in the UIAWrappers and simplespy tried to give simple code but you have to read the code so lack of documentation makes it hard although all is in the examples written around and in the lenghty thread. I never came further then V0.70 and after that I have seen @LarsJ giving excelent examples and continued with the latest definitions for W8 and W10 with an excellent spying tool that gives bits and pieces of code generation. As you said UIA automation is amazing but a challenging framework (just as webdriver or playwright or ....)
    2 points
  4. Great work, I was doing this myself when I was working on an automation project for work, I didn't get very far and basically only did what I needed with no documentation aside from the code itself. Kudos for doing all the dirty work and making it a neat little package, I am sure a lot of people would find it very useful, maybe @LarsJ and @junkew could drop a mention of your UDF in their respective topics By the way, you should consider applying a proper license to your code. By default copyright applies to anything you make, especially if it is a major part of something, I'd recommend something like the MIT license which requires credit but aside from that the end-user can do whatever they want.
    2 points
  5. Not really sure ๐Ÿ˜‰. Using a Timer, it works #include <MsgBoxConstants.au3> #include <Timers.au3> Local $iDuration = 10 Local $iTimerProgress = _Timer_SetTimer(0, 1000, "_CountDown") ; create timer Local $sMsgboxTitle = "My MsgBox" Local $sMsgboxText = "The text of the MsgBox" MsgBox($MB_YESNO, $sMsgboxTitle, $sMsgboxText) Func _CountDown($hWnd, $iMsg, $iIDTimer, $iTime) Local Static $iCountDown = 10 Local Static $hMsgBox = WinGetHandle($sMsgboxTitle, $sMsgboxText) $iCountDown -= 1 ControlSetText($hMsgBox, "", "[CLASS:Button; INSTANCE:2]", "Close in " & $iCountDown & " s") If $iCountDown = 0 Then ControlClick($hMsgBox, "", "[CLASS:Button; INSTANCE:1]") EndFunc
    2 points
  6. Logoff is something different than Workstation Lock. !
    1 point
  7. @AFrenchCroissant : The thread where this topic is mainly discussed : are-my-autoit-exes-really-infected Maybe the solution using .a3x would be suitable for you, see e.g. : https://www.autoitscript.com/forum/topic/34658-are-my-autoit-exes-really-infected/?do=findComment&comment=1472906 You may also want to look at the solution from @Exit , see : au3tocmd-avoid-false-positives
    1 point
  8. #include <MsgBoxConstants.au3> MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after 10 seconds or select the OK button.", 10) https://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm
    1 point
  9. Hey guys, the code that I've written/borrowed below is mostly an example of using the commUDF listed at the bottom, just applied to an Arduino with accompanying Arduino code. Uses Serial communication to turn on a LED, then reads a response from the arduino and prints it in the console. I hope it helps Autoit Code: #include <CommMG.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $CMPort = 3 Global $CmBoBaud = 9600 Global $sportSetError = '' Global $CmboDataBits = 8 Global $CmBoParity = "none" Global $CmBoStop = 1 Global $setflow = 2 _CommSetPort($CMPort, $sportSetError, $CmBoBaud, $CmboDataBits, $CmBoParity, $CmBoStop, $setflow) If @error Then MsgBox(16, "Error!", "Can't connect to Arduino on port - " & $CMPort) Exit EndIf _CommSetRTS(0) _CommSetDTR(0) While 1 ; Just use to call function, doesn't need to be a loop. LED_ON() Sleep(100) LED_OFF() Sleep(100) WEnd Func LED_ON() _CommSendString("1") ;Sends the Arduino a string of "1" to turn on LED Local $ret = _CommGetLine(@CR, 100, 100) ; Waits for up to 100 for a carriage return response from Arduino. ConsoleWrite($ret & @CRLF) ;Print to Console. EndFunc ;==>LED_ON_OFF Func LED_OFF() _CommSendString("0") ;Sends Arduino string of "0" to turn off the LED Local $ret = _CommGetLine(@CR, 100, 100) ; Waits for up to 100 for a carriage return response from Arduino. ConsoleWrite($ret & @CRLF) ;Print to Console. EndFunc ;==>LED_BLINK_10 Arduino Code: int led = 12; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(led, OUTPUT); } void loop() { // put your main code here, to run repeatedly: if (Serial.available()) { int data = Serial.read(); if (data == '1') //On { digitalWrite(led, HIGH); //writeslow(); Serial.print("The LED is on!"); } if (data == '0') //Off { digitalWrite(led, LOW); Serial.print("The LED is OFF!"); } } } Serial/Com port UDF this is all based on
    1 point
×
×
  • Create New...