AutoHotkey webinar- Intro to GUIs

In this AutoHotkey Webinar we covered: Introduction to GUIs  (Here is a link to scripts shared during the webinar)

Video Hour 1:  High Level:

  • Why you should create a GUI
  • Pros / Cons about Using a GUI
  • Pros / Cons about Programming a GUI
  • Rules of Thumb / Tips
  • Overview of various GUIs available in AutoHotkey
  • Resources: Tutorials & Tools for building GUIs

Video Hour 2: Coding and Q&A

Script Highlight: TaskDialog from just me and TaskDialog Creator from


When should you consider a GUI

  • Help select from a list of items that changes frequently
  • Use dropdowns , radio buttons, etc. to control what can be selected
  • Target audience using the tool is non-tech savvy
  • The list you want to choose from is available progromatically (files in folder, different accounts, etc)
  • You want to display data and be able to sort by columns keeping the rows intact
  • You want to lock-down use of the tool
  • You want to make sure certain values/fields get updated (tags for an email, subject line, etc)
  • Your code is long and key data points that you change are mixed throughout the script
  • Dealing with Images / Video files- Preview of image helps humans classify what “it” is

Pros / Cons of Using GUIs

Pros of Using GUIs

  • Non-programmers can do a lot while knowing little
  • Color / Animation can ease functionality / Usage
  • Graphics can convey data
  • Build in ways to reduce errors
  • input box for path, etc
  • “wizard” can be a template for end-user

Cons of Using GUIs

  • Non-programmers can do a lot while knowing little (make sure you build-in safeguards*)
  • Not as flexible / can typically only do what has been defined by designer
  • Manually have to repeat process each use
  • Poorly designed UI can be very painful

* Hawaii Missile-Alert Crisis


Pros / Cons of Programming GUIs

Pros of Programming GUIs

  • Can “lock down” interaction (have drop-downs, radio buttons, etc. ) with specific commands (instead of free-form typing by user)
  • Can reduce errors / mistakes by limiting options

Cons of Programming GUIs

  • Users can do actions, in any order, at any time (Not procedural)
  • Different screen resolutions
  • Various input (Mouse, Keyboard, touch,etc.)

Rules of Thumb / Tips

  • KISS- As they say, “less is more”.
  • Use Tabs to help separate tasks
  • Always “destroy” the GUI before you create it (yes, even the first time)
  • Name your GUIs
  • Label your inputs with pre-selected text or text control (e.g. edit fields)
  • Keep your design-focus on the End-User
  • Remember GUIs are EVENT driven (not linear – user can start “anywhere”)
  • Listviews & Treeviews- Disable redraw, Put in new info, Enable redraw
  • Build-in safeguards against users making mistakes

Quick Demonstrations  (See this file for the scripts)

  • Input box (multiple edit fields)
  • Tabs, Checkboxes, Radio Buttons
  • Resizable Edit
  • ListView
  • TreeView
  • DropdownList, ComboBox, Context sensitive help
  • On-Screen Display
  • Installation / Progress Bar
  • Editor with Menu bar
  • Menus

Tutorials

Use HTML & CSS in your GUIs by JoeDF

Tools


AutoHotkey Webinar- Working with Multiple Scripts & Sharing data / variables between them

In our first hour of today’s  AutoHotkey webinar we talked about working with multiple scripts in AutoHotkey.  How you can break out functions into separate files and leverage the library.

In the Second Hour we did Q&A and discussed other things we typically automate.

The two scripts we highlighted were: Dictionary by Fanatic Guru and iThesauras based of Dictionary by rommmecek.

Working with Multiple Files in AHK

  • Breaking out scripts into separate files / functions (Here is a page several videos on functions)
  • Using #include
  • Lib folder
  • Sharing data between scripts via:
  • Passing via command line parameters
  • OnMessage
  • COM object via Windows Temp Environment variables
  • COM object via custom object
  • Consolidating scripts from multiple files into one

Libraries and #Includes

Libraries

  • A script may call a function in an external file without having to use #Include. For this to work, a file of the same name as the function must exist in one of the following library directories:
  • Local library: %A_ScriptDir%\Lib\
  • User library: %A_MyDocuments%\AutoHotkey\Lib\
  • Standard library: path-to-the-currently-running-AutoHotkey.exe\Lib\

Order of search

  1. Original file
  2. Local Library
  3. User Library
  4. Standard Library
  • If a function is not found, but has an underscore in the name, it will search for a library with everything up to the underscore. (E.g. If your function is named “IE_Load” it will search for a file named IE.ahk and load it)

  Benefits of using Library: 1) Code maintenance, 2) Fewer files to keep track of, etc.  3) Easier to read code

  Negatives of using Library: Sharing code can be a bit more complex

Sharing data between scripts: Command line Parameters

AutoHotkey.exe [Switches] [Script Filename] [Script Parameters]

CompiledScript.exe [Switches] [Script Parameters]

Script Parameters:

  • The string(s) you want to pass into the script, with each separated from the next by a space.
  • Any parameter that contains spaces should be enclosed in quotation marks.
  • The script sees incoming parameters as the variables %1%, %2%, and so on.
  • In addition, %0% contains the number of parameters passed (0 if none). However, these variables cannot be referenced directly in an expression because they would be seen as numbers rather than variables.
  • In the receiver, use Param2 = %2% ;Note NO colon

Pros:  Simple, reliable

Cons: Only works when starting up, One-direction, Only passes strings/variables

Sharing data between scripts: OnMessage

Pass String between scripts with OnMessage

Pros: Simple to Use

Cons: Code is somewhat complex, A bit resource intensive, Pass single variable

Sharing data between scripts: Temp Environment Variable

Create a Temporary Environment Variable and stores it, until reboot, in Registery under: HKCU\VolatileEnvironment

Pros: Easy to use, Variable is Accessible after “sender” exits, Fast, Can use objects / dot-notation

Cons: Pass variables/strings, Character limitation

Sharing data between scripts: Custom COM Object

Registers a unique CLSID (Computer Licence Security ID) in registry  (A CLSID is a globally unique identifier that identifies a COM class object. If your server or container allows linking to its embedded objects, you need to register a CLSID for each supported class of objects.)

Pros:Can pass objects, Functions, Variables,Strings, Bi-directional, Super Fast

Cons: Code is more complex, Can’t use FOR loops to iterate over Objects, Can slow some when passing large data

Consolidating Multiple Scripts into One

  • AutoExec section – (Top of script until first: Return, Exit, hotkey/hotstring label)
  • Hotkeys – Conflicting Hotkeys prevents script from running (Make them context sensitive?)
  • Hotstrings – First Hotstring takes presedent
  • Re-using: Variables , Functions, Labels, Classes cause errors
  • Duplicate code – Often bring in things multiple times
  • Reasons why prefer one over the other
  • Multiple scripts-
    • Sharing scripts is easier
    • Troubleshooting can be easier
  • One Script-
    • One file to edit
    • One script in system tray (Can use #Notrayicon in multiple scritps to help negate this)
    • Ease sharing of code

AutoHotkey Webinar- Automating MS Outlook and COM

In our first hour of today’s  AutoHotkey webinar we talked about various ways you can automate MS Outlook.  We covered the below scripts:

  1. Creating an HTML email (Also see this video)
  2. Performing mail-merge on the above HTML email
  3. Integrating a mail-merge from an active Excel file  (Also see this video)
  4. Looping over emails in a folder
  5. Creating appointments in Outlook
  6. Creating an address book from looping over emails in Outlook

The second hour dove a bit deeper into using Outlook and Excel.  We also talked through a few user’s questions.

Below is the information that was reviewed in the PowerPoint deck we reviewed:

Script Highlight:

Sift by FanaticGuru uses Regular Expressions and nGrams* to fuzzy match strings

*n-gram is a contiguous sequence of n items

COMComponent Object Model

  • What is COM?
  • Some of the programs COM integrates with:

Creating an HTML email in Outlook with AutoHotkey

  1. Connect to Outlook or Create a new one (but may not deploy right then)
  2. Create a New Mail Item object
  3. Provide values for properties
    1. Specify Account Sending from
    2. Type of email (HTML, RTF, Text)  (Search here for Outlook Constants)
    3. Identify Recipients: To, CC, BBC
    4. Subject line
    5. HTML Body
    6. Attachments
    7. Delivery time (Fuse)
    8. Request Delivery Reciept
    9. Importance
    10. Display / Send
  4. Convert above email to mail-merge with names & email addresses

Resources

AHK Forum:

MSDN resources:

Outlook examples on the-Automator

Stack Overflow

AutoHotkey webinar on COM & Excel

AutoHotkey Webinar- Spreading AHK Luv & Making $ with AHK

In our first hour of today’s webinar we talked through the below points on how to improve adoption rate of AutoHotkey for users as well as making money with AutoHotkey.

The second hour dove a bit deeper into both topics and discussed other subjects related to these.

Script Highlight:

FindText – Capture Screen Image & Find it

Don’t let the name “FindText” fool you (it isn’t about ‘text’)

 Things to keep in mind:

  • Make sure you keep the same: Screen resolution, magnification, font, zoom
  • Test Grayscale vs Color
  • You can adjust the size of the capture area (but smaller is generally better)
  • Tutorial 1 demonstrating the function and an Example using it
  • Function to help take action on what you find

PowerPoint deck / Resources:

Which best describes your Organization’s current RPA (Robotics Process Automation) adoption level?

Here is the full Slide deck, podcast, and book entitled: Service Automation: Robots and the Future of Work 2016 by Leslie P. Willcocks (Author), Mary Lacity (Author)

Misconceptions of RPA / Desktop Automation

Desktop Automation

  • …is only used to reduce workload & lay-off employees
  • …is mainly driven by cost savings
  • completely replaces the need for a person

Why Don’t More People Automate / Use AutoHotkey?

  • People do notlike change. (correlation with age?)
  • People don’t realize what canbe automated (“think small” – “magic redo” button?)
  • Managers / Decision makers think it is “too expensive
  • No “GUI” to use for creating scripts.  Non-techies get “overwhelmed” with coding.
  • Everyone is “too busy” to learn how to save time. Even though they’re interested in saving time they don’t find time to learn how to automate. (Story of a woodcutteris a great analogy; remember to take time to ‘sharpen the saw’)
  • Some people are too proud to let-on that they really don’t understand what you’re doing. They might try it on their own but get frustrated and give up after 15 minutes.  (Perhaps reviewing 1-1 is better than in groups?)
  • Managers oftendo not encourage their employees to automate. (I’ve had several bosses that told me NOTto automate.)
  • Most people think short-termand not long-term. This can present itself in the following dimensions
  • The job is “too small” to be automated (almost never true)
  • The job is a “1-time” need (rarely, if ever, the case; the “job” might be but the “approach” is bound to come up again)
  • I’m the only one that would use this (rarely the case)
  • It will take too long to write code to automate (I think this is one of the best things about AutoHotkey.  FAST!)
  • It must be “fully automated” (No need to automate the entire process)
  • Not considering “side-effects” of automation (tracking log to examine events, employee / customer satisfaction etc.)

Best Approach to Get Adopters

1.Don’t overwhelm them with all that AutoHotkey can do!

  • Only get them to learn 1 thing!
  • Give them time to learn/adopt that and then come back with additional tips

2.Curtail what you demonstrate to the prospect’s level

  • Luddites- Stick to HotKeys and HotStrings
  • Somewhat Nerdy- Demonstrate some scripts, Input box, Sending keystrokes / Clicks, File manipulation
  • Nerds- Whatever their need! (Dll calls, Image search, API calls, Web Scraping, Objects, RegEx, GUIs, etc.)

3.Get a senior-level advocate (Director or above)

  • Senior people see the cost-savings
  • Your supervisor will think your coding is counting against “their time”
  • Colleagues might be worried you’re “automating” them out of a job
  • IT also might try and road-block you. Get the business to “demand” it

4.Create custom script for their needs

  • Don’t build in all bells-whistles

Making $ Money with AutoHotkey

General Models

  • Selling generic programs / scripts to large audience
  • Selling custom scripts to individuals / company
  • Getting paid to code (they own the intellectual property) & you get paid by hour

Getting Paid

Licensing

Shareware / Freeware / Donations

Rich” Target markets

  • Lots of people doing same job function
  • “Thankless” / mundane jobs with clear logic/ “rules-based” descisions and structured data
  • Lots of, repetitive, transactions
  • Non-programming “business” people
  • People with Money!!!
  • Sales people!
  • Realestate

Incentives / Benefits to Highlight to Potential Clients

  • Employee / man-hour savings resulting in high ROI (Return on Investment)
  • Better quality results than from humans / Higher compliance
  • Faster deployment getting things done (clients / customers are happier)
  • Increased scalability
  • Happier, more productive, employees
  • Have more “Meta-Data” to do analysis on
  • The more you do, the easier it gets
  • The more you automate, the more time you have to automate