Leaderboard
Popular Content
Showing content with the highest reputation on 02/15/2021 in all areas
-
samibb, Why on earth did you hijack a totally unrelated thread to ask this question? Short answer: No, because GOTO is evil. Longer answer: AutoIt uses functions instead, which offers more control over the flow of your script without the risk of spaghetti code. M233 points
-
This is based on this topic. With this UDF, you can define all the HotKeySet you want on any of the keyboards. The keys registered as HotKeySet are not sent to the active window. I also created a "Event-driven" mode for lengthy procedure. There is still the immediate action mode for short procedure. Note that in Event-driven mode, you will need to create an close loop to intercept the HotKey events. Events are asynchronous. In Event-driven mode only one procedure can be running at a given time. But immediate action procedure can interrupt a Event-driven procedure. All procedures are declared as actual function (without quotes). It is important that lengthy procedure should be declared as Event-driven, otherwise the system may become unstable. Version 2024-01-04 * Added support to {LEFT} and {RIGHT} keys * Added more information about keyboards in list * Added new parameter to _MKHKS_Initialize to exclude a specific keyboard from the list. To do so, you simply provide partial part (as a string) of the device name. Version 2024-01-03 * Added support to Send command, Hotkey must be set for the first keyboard. Version 2022-12-22 * Added support to register the same Hotkey on multiple keyboards (same or different functions) * Added possibility to unregister a Hotkey for a particular keyboard * Added validation on registering the same Hotkey twice It may happen that the list would provide more keyboards than they are actually connected. To exclude one particular keyboard, you could run the following example and test the hotkeys (0, 1, 2, ...) on each keyboard to see which ones are responding. Then you can provide partial string of the device to be excluded with the _MKHKS_Initialize function. #include "MKHKS-UDF.au3" Example() Func Example() HotKeySet("{END}", _Exit) Local $iNumKB = _MKHKS_Initialize() For $i = 0 To $iNumKB - 1 _MKHKS_Register_HotKey(String($i), _Test, $i, False) ; set hotkey to keyboard number (0, 1, 2,...) Next While Sleep(50) WEnd EndFunc ;==>Example Func _Exit() Exit EndFunc ;==>_Exit Func _Test() ConsoleWrite("Test succeeded - " & @HotKeyPressed & " was Key Pressed" & @CRLF) EndFunc ;==>_Test As usual if you have any suggestion, I would be very interested to hear them. MKHKS-UDF.zip2 points
-
GOTO
seadoggie01 and one other reacted to Somerset for a topic
You are trying to invite some expletives hurled your direction, friend.2 points -
Automate all windows and browser applications with one UDF function library. Based on the microsoft automation API this library high level supports Recognition of conttrols from EDGE, Chrome, FF, Opera, Safari and Windows native apps Small testing framework to split object repository from coding away Introduction Quickstart - Getting started quickly Simple scripts With this module you can automate all applications/programs that support ui automation and/or accesibility api from microsoft you can recognize more controls than AutoIT can recognize "out of the box" you can use concepts from other testing frameworks like http://download.freedesktop.org/ldtp/doc/ldtp-tutorial.pdf http://safsdev.sourceforge.net/Default.htm coded ui testing from microsoft Some of those controls / applications are chrome browser (partly mainwindow has to be done with MSAA for navigating) chrome://accessibility in the adress bar of chrome or start with "--force-renderer-accessibility" silverlight controls Ribbon control controlbars of Excel/Word IE and FF browsers Windows Media Player Windows clock AFX .. controls (partly) .... Based on the initial AIO Object I now have made the interface file to work with objCreateInterface function which is in the latest beta's automate clicking and querying basic information It gives you a lot of basic information to be able to automate clicking, querying basic information where it goes further in certain situations than AutoIt is identifying Starting threads for background on the ui automation api of microsoft (not for starters) http://en.wikipedia.org/wiki/Microsoft_UI_Automation http://msdn.microsoft.com/en-us/library/ms747327.aspx Previous threads in general help/support Interface AutoItObject IUIAutomation ObjCreateInterface and struct tagPoint in method ElementFromPoint Be aware that API is not allways installed under XP/Vista see http://support.microsoft.com/kb/971513 Within Windows 7 and Windows 8 it should be preinstalled by default. Be aware on 32 and 64 bits way of running your script #AutoIt3Wrapper_UseX64=Y or N Basic example of usage / showing and retrieving the default information, will post multiple examples later Hover your mouse to an area of interest and press ctrl+w and information will be shown in the edit box of the form Simple spy demo (see simplespy.au3 or use latest ZIP attachment for latest version) Main features Recognize windows and html controls for the major browsers Logical and physical description for controls (UI mapping, Application map) Simple repository logic to abstract logical and physical descriptions Store Runtime Type Information in RTI. variables Rubberbanding/highlighting of objects Simple spy to help in making / identifying the physical description Support of regular expression(s) in identifying objects recognize objects on multiple properties supported properties: name ,title, automationid, classname, class, iaccessiblevalue, iaccessiblechildId, controltype, processid, acceleratorkey The actions provided so far "leftclick", "left", "click", "leftdoubleclick", "leftdouble", "doubleclick", _ "rightclick", "right", "rightdoubleclick", "rightdouble", _ "middleclick", "middle", "middledoubleclick", "middledouble", "mousemove", "movemouse" "setvalue","settextvalue" "setvalue using keys" "setValue using clipboard" "getvalue" "sendkeys", "enterstring", "type", "typetext" "invoke" "focus", "setfocus", "activate" "close" "move","setposition" "resize" "minimize", "maximize", "normal", "close", "exist", "exists" "searchcontext", "context" "highlight" "getobject","object" "attach" "capture","screenshot", "takescreenshot" "dump", "dumpthemall" "propertyvalue", "property" match on multiple properties like: name:=((Zoeken.*)|(Find.*)); ControlType:=Button; acceleratorkey:=Ctrl+F Support for 117 different properties see $UIA_propertiesSupportedArray in uiawrappers like for example title, regexptitle, class, regexpclass, iaccessiblevalue, iaccessiblechildid, name, accesskey, automationid, classname IAccessible, IAccessible2, ISimpleDom interfaces debuglogging to a file log.txt (no output in scitewindow) Examples Example 1 Iterating thru the different ways of representing the objects in the tree (#comment-1105548) Example 2 Finding the taskbar and clicking on the start menu button (#comment-1105680) Example 3 Clicking a litlle more and in the end displaying all items from the clock (thats not directly possible with AU3Info) (#comment-1108849) Example 4 that demonstrates the calculator Example 5 Automating chrome Example 6 Demonstrates all stuff within chrome to navigate html pages, find hyperlink, click hyperlink, find picture, click picture, enter data in inputbox Example 7 The chrome example modified to a firefox example Example 8 The other major browser Internet Explorer automated (made on Example 6 and 7) Example 9 Windows media player Example 10 Automating mach 3 (AFX windows and other hard to get recognized by AutoIT) Lot of links are broken due to forum upgrade just search for the text like "Example 11 Demonstrate Word, Notepad and Calculator actions" Example 11 Demonstrate Word, Notepad and Calculator actions ... Example 13 Details 1 about the right pane of the windows explorer Example 14 Details 2 about the right pane of the windows explorer Example 15 Details 3 about the right pane of the windows explorer Example 16 Details 4 about the right pane of the windows explorer Example 17 Details 5 about the right pane of the windows explorer WITH CACHING Example 18 Details 6 about the right pane of the windows explorer WITH VIRTUAL ITEMS Example 19 Eventhandling examples Example 20 Eventhandling examples Example 21a Eventhandling examples Internet Explorer Example 21b Eventhandling examples Internet Explorer Example 22 Eventhandling examples Follow focus Example 23 Eventhandling examples structure changed Example 24 Eventhandling examples IUIAutomationEventHandler Example 25 SAFEARRAYS Example 26 IACCESSIBLE / MSAA Example 27 IACCESSIBLE2 / MSAA Example 28 IACCESSIBLE / MSAA events Example 29 IACCESSIBLE2 events Example 30 ISimpleDOM Example 31 Notepad window move, maximize, minimize Example 32 Three browsers doing the same stuff with small differences in scripting only .. TODO Build recorder Enhance the spy with a nicer UI UI for the repository (now in the script with dot notation) Enhance mapping / identifying on multiple properties instead of 1 combined with index If speed becomes an issue use the caching logic of the MS UIA framework Add the other patterns later Generalize the concept of System Under Test of starting the SUT (for testing framework purposes) Remote running of scripts Fix issue on finding within dynamic context ... edit august 18th 2013 initial post Only zip files are needed to download , just unzip in 1 directory edit july 2016 Made V0_63 and examples works with AutoIt v3.3.14 Windows 10 tested Simple spy gives some basic code as a present Chrome latest versions seems to be having issues with IUIAutomation on tabs/buttons of mainwindow use MSAA for accessing tabsheets / buttons more cleanup to be in UDF style More comments in the source see changelog.txt for previous changes edit september 2017 All examples fixed for the IE, Firefox and Chrome browser Some small but essential fixes in UIAWrappers edit april 2018 Enhanced logic on fallback / dynamic search, still not perfect, to slow Retested with latest Chrome, FF, Edge and IE11 and some extensions to show how to get text from the webpage (examples 5,6,7) Some small bugfixes Some comments as given in forum incorporated edit may 2019 Speed enhancements on especially fallback searching UIA.CFG works now in a better way to turn on/off debug, highlighting, debug2file More stable and consistent behavior Internal cleanup and refactoring of bigger functions Checked with W10 (not tested on W7) Added some W10 properties Run with 3.3.14.5 on W10 UIA_V0_51.zip EXAMPLES_V0_5.zip UIA_V0_63.zip EXAMPLES_V0_63.zip UIA_V0_64.zip EXAMPLES_V0_64.zip EXAMPLES_V0_66.zip UIA_V0_66.zip EXAMPLES_V0_70.zip UIA_V0_70.zip1 point
-
To make it easier to maintain the UIA code, I've decided to split the code this way: This new thread is used for the actual UIA UDFs. Ie. the files stored in Includes folders and named UIA_*.au3 or UIAEH_*.au3. The UIASpy thread contains only code that is used directly in the UIASpy GUI, but not the UIA UDFs in this new thread. Using UIA Code contains only example code, but neither UIA UDFs nor UIASpy. UIA Events contains GUI code to detect events and it contains example code, but neither UIA UDFs nor UIASpy. This means that every time the code in the UDF files in this new thread is updated (eg. because of Windows 10 feature updates twice a year), you must install the files in the Includes folders in the other threads yourself. The easiest way is simply to copy all UDF files to the Includes folders. UDF Files CUIAutomation2.au3 - UIA constants for Windows 7 used in the first examples CUIAutomation2-a.au3 - The original UIA constants for Windows 7 from junkew's thread UIA_AccVars.au3 - Used to calculate properties of type VT_UNKNOWN, copied and modified from this thread UIA_Constants.au3 - UIA constants (copied from UIA header files) up to and including Windows 10 1809 UIA_ConstNames.au3 - Contains functions for converting UIA constants from values to names UIA_Functions.au3 - A collection of small utility functions UIA_Functions-a.au3 - First version of utility functions UIA_ObjectFromTag.au3 - Creates callback objects used in event handlers, copied and modified from this post by trancexx UIA_SafeArray.au3 - Constants and functions to handle safearrays, copied from this thread UIA_Variant.au3 - Constants and functions to handle variants, copied from this thread UIAEH_AutomationEventHandler.au3 - Implements the AutomationEventHandler UIAEH_FocusChangedEventHandler.au3 - Implements the FocusChangedEventHandler UIAEH_NotificationEventHandler.au3 - Implements the NotificationEventHandler, published in Windows 10 1709 UIAEH_PropertyChangedEventHandler.au3 - Implements the PropertyChangedEventHandler UIAEH_StructureChangedEventHandler.au3 - Implements the StructureChangedEventHandler Folders The UI Automation projects can be stored in a folder structure this way: UI Automation\ Code\ - Using UIA code Events\ - UIA events Spy tool\ - UIASpy.au3 UDFs\ - UDF files The UDF files must be installed in Includes\ in the first three folders. Threads UIASpy - UI Automation Spy Tool is a GUI tool that provides information about windows and controls and their interconnection and provides functionality to generate sample code. UIASpy is essential for creating UI Automation code. In Using UI Automation Code in AutoIt you can find and download examples and read information about using UIA code. UI Automation Events is about implementing event handlers and includes GUIs to detect events. IUIAutomation MS framework automate chrome, FF, IE, .... created by junkew August 2013 is the first AutoIt thread on UIA code. Zip-file The zip contains source code for the UDF files. You need AutoIt 3.3.12 or later. Tested on Windows XP, Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. UIAIncludes.7z1 point
-
Autoit-Socket-IO - Networking in AutoIt made simple!
Zmy reacted to tarretarretarre for a topic
Version 2.x.x and 3.x.x has been moved to branch 3.x About Autoit-Socket-IO Autoit-Socket-IO is a event driven TCP/IP wrapper heavily inspired from Socket.IO with focus on user friendliness and long term sustainability. I constantly want to make this UDF faster and better, so if you have any suggestions or questions (beginner and advanced) Do not hesitate to ask them, I will gladly help! Key features Simple API 99% data-type serialization thanks to Autoit-Serialize Can easily be extended with your own functionality thanks to Autoit-Events "Educational" examples Data encryption thanks to _<Crypt.au3> Limitations Speed. This UDF will sacrifice some speed for convenience Getting started Download the script from AutoIt or pull it from the official github repo git@github.com:tarreislam/Autoit-Socket-IO.git and checkout the tag 4.0.0-beta Check out the documentaion Take a look in the examples/ folder Changelog To see changes from 3.x.x and 2.x.x please checkout the 3.x branch Version 4.0.0-beta (This update break scripts.) Code base fully rewritten with Autoit-Events and decoupled to improve code quality and reduce bloat. The new UDF is very different from 3.x.x so please checkout the UPGRADE guide to fully understand all changes Added new documentation documentaion Success stories Since December 2017-now I have used version 1.5.0 in an production environment for 150+ clients with great success, the only downtime is planned windows updates and power outages. Newest version (2020-09-15!) Older versions (Not supported anymore) Autoit-Socket-IO-1.0.0.zip Autoit-Socket-IO-1.1.0.zip Autoit-Socket-IO-1.3.0.zip Autoit-Socket-IO-1.4.0.zip Autoit-Socket-IO-1.5.0.zip Autoit-Socket-IO-2.0.0.zip1 point -
GOTO
DonChunior reacted to samibb for a topic
Dears is there any function in AutoIT works like GOTO in VBA i need it ? Thanks1 point -
I am currently working on an update, that stores and updates Source (file/folder) size (that part is done), and does a destination drive free space check and keeps tab of source size changes (that part isn't done yet). I've also added an editor to use instead of Notepad with Paths List files, which is something I should also implement in TeraCopy Timer. Stay tuned for the v1.5 update ... coming soon!1 point
-
GOTO
FrancescoDiMuro reacted to junkew for a topic
You can do something like below You can assign function to a variable like $f=consolewrite $f("hello world") Just read the call, assign, eval, exitloop keywords in the helpfile func example() $stepCount=0 ;Some restart logic if ($failed) then $stepCount = 25 endif while ($stepCount <=99) call "step" & cstr($iCount) $stepCount=$stepCount+1 wend endfunc func step1() ... endfunc func step2() ... endfunc ... func step99() ... endfunc Nice example1 point -
I'll be the devil's advocate and say that it is not... but it is pretty easy to misuse @samibb As many others have pointed out in this thread, functions are used to split tasks into separate sections of code. For other uses of GOTO, consider using loops and other various control flow statements to accomplish your task1 point
-
Majedz, If you want to store all the values then just place them in an array as you generate them: #include <Array.au3> Global $aResults[50] For $i = 1 To 50 ; get an integer between 0 and 100 $aResults[$i - 1] = Random(0, 100, 1) Next _ArrayDisplay($aResults, "", Default, 8) Now you can play with them as much as you wish. It would be helpful if you could give us some idea of why you are asking these min/max questions - if we knew just what you are trying to do we might be able to offer some more focused advice. M231 point
-
I hope soon I find time to provide new features and examples based on the knowledge which I gather thanks to this above mentioned book. btw. Today I also buy this one: I hope it will be delivered to me sometime in a month, so it is possible that after the summer vacation, sometime in about half a year, I will have the opportunity to present new curiosities.1 point
-
Majedz, Store the current min and max values to compare: #include <MsgBoxConstants.au3> ; Set placeholders $iMin = 9999 $iMax = 0 For $i = 1 To 50 ; get an integer between 0 and 100 $iResult = Random(0, 100, 1) If $iResult < $iMin Then MsgBox($MB_SYSTEMMODAL, "New Min", $iResult) $iMin = $iResult ElseIf $iResult > $iMax Then MsgBox($MB_SYSTEMMODAL, "New Max", $iResult) $iMax = $iResult EndIf Next MsgBox($MB_SYSTEMMODAL, "End:", "Max: " & $iMax & @CRLF & "Min:" & $iMin) M231 point
-
#include <Array.au3> ; Testdata : Local $L0=3120, $L1=2120, $L2=131, $L3=923, $L4=8120, $L5=520, $L6=5120, $L7=6120, $L8=3120, $L9=4120, $L10=5120 Local $aLowValues[11] = [$L0,$L1,$L2,$L3,$L4,$L5,$L6,$L7,$L8,$L9,$L10] _ArrayDisplay($aLowValues) ; *** just for display MsgBox(0, "", "minimum Value = " & _ArrayMin($aLowValues,0) & @CRLF & "minimum Index = " & _ArrayMinIndex($aLowValues,0), 5) _ArraySort($aLowValues, 0) _ArrayDisplay($aLowValues) ; *** just for display1 point
-
Emanoel, In the past we have found that failure to open an .mp3 file with _SoundOpen is usually due to a corrupt ID3 tag - it would be worth checking your files for this problem. M231 point