AutoIt Scripting Language and SDK - Part Two

Understanding – SciTE Editor
  •  SciTE is a cross-platform text editor. Lightweight and built for speed, it is designed mainly for source editing, and performs syntax highlighting and inline function reference for many different languages.
  • The editor comes with the package with the AutoIt command auto complete feature. Which makes scripting easy.
  • It can compile, build and run the scripts.
Understanding – Scripting Style
  • C like import facility. –
    • #include "[path\]filename“, #include , #include-once
  • Variables starts with ‘$’ sign –
    • $Mid="M1009944“
  • Commenting – ‘;’
    • ;This is a comment
  • Looping
  • Regular Expressions
Understanding – Scripting Style -GUI
  •  Any GUI script will need to #include for basic GUI related constants. For advanced controls we need to add additional files.
  • Lets create a window :-
    • We can call it “Hello World”. It will be a window of 200 by 100 pixels in size.
    • Remember : When a new window is created it is hidden - so we must "show" it.
  • Code : -
    • #include
    • GUICreate("Hello World", 200, 100)
    • GUISetState(@SW_SHOW)
    • Sleep(2000) ; and we are ready to execute
  • There are two basic GUI modes: MessageLoop mode and OnEvent mode. The modes are simply two different ways of reacting to GUI events.
    • MessageLoop mode :
      • This mode is best for GUIs where the GUI is "king" and all you care about is waiting for user events.
      • Tight Loop.
      • When an event has occurred the return value of the GUIGetMsg function will show the details.
      • E.g. a button is clicked, the GUI has been closed, etc.
      • In this mode you will only receive events while you are actively polling the GUIGetMsg function so you must ensure that you call it many times a second otherwise your GUI will be unresponsive.
      • By default this mode is active.
    • OnEvent Mode :
      • This mode is best for GUIs where the GUI is of secondary importance and your script has other tasks to perform in addition to looking after the GUI.
      • This mode is similar to the Visual Basic forms method.
      • Halt – execute
      • Instead of constantly polling the GUI to find out if anything has happened we make the GUI temporarily pause the main script and call a pre-defined function to handle the event.
      • E.g. If the user clicks Button1 the GUI halts your main script and calls a previously defined user function that deals with Button1. When the function call is completed the main script is resumed.
      • To switch to this mode “Opt("GUIOnEventMode", 1)” need to be introduced in the script.


Popular posts from this blog

Trim / Remove spaces in Xpath?

RPA - Blue Prism, OpenSpan, Automation Anywhere vs UIPath