AutoHotkey Webinar-When, Why and How to use Error Checking on Runtime Errors

Blue keyboard key labeled Webinar on a white keyboard, next to Ctrl and Menu keysWhen, Why and How to use Error Checking on Runtime Errors

Video Hour 1: High-level overview: Hour 1
Video Hour 2: Q&A: Hour 2

Script Highlight: Detecting Carrier type, location, company from a phone number.

When / Why to use Error Checking

For general troubleshooting of your own code use:

  1. Msgbox
  2. Debug in SciTE , AHK Studio or Notepad++
  3. Watch this Webinar on Debugging & Troubleshooting

Runtime Errors– An error that occurs during the execution of a program

  1. Use Error Handling to diagnose Runtime Errors for scripts distributed to clients
  2. Allows you to adapt the reported error as something meaningful to non-coders
  3. Frequently provides information you cannot get elsewhere
  4. Easy to Log the error with additional information so we can have context of what is frequently going wrong  (Users are typically terrible are providing enough information)
  5. Can prevent the script from “locking up” / throwing an Error that is confusing to the client
  6. Build-into your Class / Library to help others utilizing your code

ErrorLevel and OnError

ErrorLevel–

  • Built-in variable which indicates success/failure of many (84) commands
  • A value of Zero means success. Most commands return a 1 for failure but some have values higher than 1

OnError–

  • Specifies a function to run automatically when an unhandled error occurs.

OnExit–

  • A Built-in Function name/Object to call when your script is exiting
  • It can help understand why/when your script exited

There are 84 Built-in Command/Functions with Error Level

Try / Catch / Throw / Finally / Exception

  • Try– Will “try” to execute a given line(s) of code
  • Catch– Specifies the code to execute if an exception is raised during execution of a Try statement.
  • Throw– Signals the existence of an error allowing a Try/Catch command to display info about this error. This object allows you to personalize the message / information available
  • Finally– Used in conjunction with Try or Catch. Ensures that one or more statements (commands or expressions) are always executed after the execution of a try statement
  • Exception()- An Object with properties to be accessed from Catch’s OutputVar
  • Message:An error message or ErrorLevelvalue.
  • What:The name of the command, function or label which was executing or about to execute when the error occurred.
  • Extra:Additional information about the error, if available.
  • File:Set automatically to the full path of the script file which contains the line at which the error occurred.
  • Line:Set automatically to the line number at which the error occurred.

 

Best Practices / Tips & Tricks

  1. Remember –in Try / Catch  the Exception thrown is an object.
  2. Not all programs accurately report ErrorLevel when run from RunWait
    1. –If this is the case, think of other ways to determine if your script finished correctly
  3. Unless you truly have a need, don’t worry about Throw or Finally.  Most developers do not use them
  4. While typically used as pairs, Try can be used without Catch
    1. — in this case, it is used only to bypass the error message
  5. ComObjError()–  can be set to 0 to disable COM errors (but isn’t recommended)
  6. Copy the ErrorLevel value to your own variable immediately  after the command that  caused the error (before its content is changed after executing another command)

AutoHotkey Webinar- SQLite3 with AutoHotkey

SQLite3 with AutoHotkeyIn today’s webinar Jean Lalonde, author of Quick Access Popup, lead us through a demonstration how to use SQLite with AutoHotkey.

Video Hour 1:  High level overview

Video Hour 2: Continue overview and Q&A

Script Highlight: This was actually a “website” highlight.  Skrommel’s 1-hour Software is a great site with 116 examples of scripts that can manipulate various tasks on Windows.  His code is available both as an executable as well as the AutoHotkey source files.

SQLite3 with AutoHotkey

Here is a link to the SQLite3 with AutoHotkey files Jean shared and reviewed below

–SQLite files:

–Class_SQLiteDB library (by just me)

–Utility DB Browser for SQLite

SQLite-First_Example.ahk

  • Open an existing database

–Display error report

  • Query the database
    • in a RecordSet with Query()
    • in a Table with GetTable()
  • Execute various commands
    • Insert rows into a table
    • Delete rows

 

BLOB_Sample.ahk

  • Store and retrieve binary large objects (BLOB)

SQLite-TheBeatles.ahk

  • Create a new database
  • Create table and indexes
  • Insert multiple rows (import)
  • Display in a ListView with GetTable
  • Execute various commands
    • Alter table (add columns)
    • Vacuum the database

Using transactions

  • BEGIN TRANSACTION;
  • ROLLBAK:
  • COMMIT:

AutoHotkey User / Expert Interviews

In the below videos I interview AutoHotkey experts / users.  The goals are to:

  1. Find better ways to get new people to adopt / try AutoHotkey
  2. Stimulate ideas how current users might leverage AutoHotkey in other ways
  3. Create a bigger community of AutoHotkey users
  4. Raise awareness of AutoHotkey with non- users

1) AutoHotkey User / Expert interview: Jean Lalonde

My first interview was with Jean Lalonde, author of Quick Access PopUp.    Jean has also co-hosted several webinars with Jackie and I and is a very competent programmer.

2) AutoHotkey User / Expert Interview: Chad Wilson

In this interview I speak with Chad / Maestrith.  Chad is the author of AutoHotkey Studio and is a guru using GUIS, XML, and Objects.  In the video we discuss how he got into programming and some areas people should focus when learning AutoHotkey.  We also review a couple dozen applications (at a high level) that we collaborated on together.

 

3) AutoHotkey User / Expert Interview: Jack Dunning

In this interview I speak with Jack Dunning from Jack’s AutoHotkey Blog and Computor edge .  Jack has also authored several books on AutoHotkey. They can be purchased from his blog or on Amazon.com.

 

4) AutoHotkey User / Expert Interview: Charlie Simmons / Tank

Charlie / Tank actually works in the Robotics Process Automation (RPA) industry and is an admin on the AHK forum.  Below is my interview with him.  If the RPA industry interests you you can see another discussion with him here.  BTW- at the end of the interview Charlie mentions anyone with AutoHotkey knowledge could probably get a high-paying job in the RPA industry.

 

5) AutoHotkey User / Expert Interview: Nicolás Castillo

In this interview I speak with Nico from Mexico.  Nico has a background in IT and also works in the real estate industry.  We talked through some of his personal uses as well as how he’s helped people at his work.

 

6) AutoHotkey User / Expert Interview: Mitch Berry

In this interview I speak with Mitch out of North Dakota. He is an experienced Planner and Electrical & Instrumentation Specialist with a demonstrated history of working in the energy industry.

 

7) AutoHotkey User / Expert Interview: Jim Ford

In this interview I speak with Jim Ford out of China. He has a background in programming is Amazing! He’s programmed in over 50 languages and worked in technology all is life. We had a lively discussion about automation, corporate world, consulting world, RPA (Robotics Process Automation) and where technology is going.

 

8) AutoHotkey User / Expert Interview: Susan Thomas

In this interview I speak with Susan Thomas out of Nashville, TN. We talked about what life is like working at a huge company and how there is a group of ~20 people at her work with the task of “automating” (many using AutoHotkey).

 

9) AutoHotkey User / Expert Interview: Joe Glines

Yes, I interviewed myself!  LOL   I realized even though I mentioned a lot of what Maestrith and I had worked on together, there was a ton of stuff that I’ve done with AutoHotkey on my own and I wanted to make sure I shared with y’all.  I’m in Dallas, TX and have an undergraduate degree in Marketing and a Masters in Market Research.  I worked for a long time as a Data Scientist (way before they were called that) and then spent the last 8 years working in Internet marketing.

 

10) AutoHotkey User / Expert Interview: Isaias Baez / RaptorX

In this interview I speak with Isaias Baez / RaptorX out of the Dominican Republic. When I first started learning more than Hotstrings & Hotkeys I was fortunate enough to stumble upon RaptorX’s YouTube channel AHKTuts.
If you’re wanting to learn some advanced things like DLL Calls, SendMessage, etc. I highly recommend you check them out!

 

11) AutoHotkey User / Expert Interview: Dr. Gabriel Cook /

In this interview I speak with Dr. Gabriel (Gabe) Cook out of the Pasedena, CA. Gabe and I have been coding with each other for nearly 20 years now! Initially we worked in SPSS (a statistical program) but over the past years we’ve also played with Python and AutoHotkey. Quite a few years Gabe & I take a week to have a “code-cation” where we get together and work 12-hour days learning how to code! I highly recommend you have a “coding buddy”!

 

12) AutoHotkey User / Expert Interview: Ryan Wells

In this interview I speak with Ryan Wells out of Kiev, Ukraine. Like me Ryan has been using AutoHotkey for ~10 years; the first years using Hotkeys & Hotstrings, now he automates things with COM, Gui’s, etc. Ryan demonstrated some of the cool things he’s automated for his, and his wife’s work.   During the interview Ryan mentioned James Clear on Systems not Goals and How 1% Performance Improvements Led to Olympic Gold

 

 

13) AutoHotkey User / Expert Interview: Hellbent

In this interview I speak with Hellbent out of Canada. He has a background in C and has been creating awesome AutoHotkey GUI tutorials on his YouTube channel CivReborn .

 

14) AutoHotkey User / Expert Interview: joedf /

In this interview I speak with joedf out of Canada. He has a background in Geology and is an admin on the AutoHotkey forum.

 

15) AutoHotkey User / Expert Interview: Steve Maziarz

In this interview I speak with Steve Maziarz out of Dallas Texas. Steve and I used to work together and is as nice as he is smart! He has a background in IT / Technology and has been coding for longer than most of y’all have been alive!

 

16) AutoHotkey User / Expert Interview: Jackie Sztuk

In this interview I speak with Jackie Sztuk out of Denmark. He has a background in design and has been co-hosting webinars with me for over two years now.

 

17) AutoHotkey User / Expert Interview: Rick C

In this interview I speak with RickC out of Plano,TX. He has a background in IT and has a degree in programming. I met Rick when I tried to start a local “AutoHotkey meet up” in the Dallas/Ft. Worth area. While I didn’t get many to attend, it was cool to meet another AHK user!

 

18) AutoHotkey User / Expert Interview: Jesús Prieto

In this interview I speak with Jesús Prieto out of Spain. He has a background as a sound engineer and Translations. Check out his Spanish blog.

 

19) AutoHotkey User / Expert Interview: James Griffing

In this interview I speak with James Griffing out of Austin, TX. James has a varied background and has used AutoHotkey in different positions over the past years..

 

20) AutoHotkey User / Expert Interview: Michael Wilson

In this interview I speak with Michael Wilson out of Australia. Michael has worked with AutoHotkey for many years but recently has been diving deeper into using GUI and COM. You can check out his GITHUB respository here.

 

21) AutoHotkey User / Expert Interview: Joe Winograd

In this interview I speak with Joe Winograd out of Chicago, IL. Joe has worked with AutoHotkey for many years and has a huge background in programming. You can learn more about him on Experts Exchange Spotlight here.

 

22) SPSS User / Expert Interview: Jon Peck

In this interview I speak with Jon Peck out of Arizona. He has a background in: Programming, Econometrics, & Statistics and has been programming and using for longer than most of us have been alive!

Jon is a personal hero of mine and has saved me so much time coding in SPSS that it is impossible to quantify!

https://youtu.be/flACrUIpr8g

 

23) AutoHotkey User / Expert Interview: Jethrow

In this “interview” I read through Jethrow’s responses to my questions (he declined being interviewed). He has a background in: accounting but has migrated to being a programmer (at a 60% pay increase!)!   Among other posts, Jethrow is the author of this Web Scraping tutorial which is where I learned the vast amount of what I know now!

 

24) AutoHotkey User / Expert Interview: Gio Sperotto

In this interview I speak with Gio out of Brazil and has a background in Accounting & Law. He demonstrated a ton of amazing programs / scripts he’s written for work. Lots of great ideas here to peak your interest! BTW- Gio also lead our webinar back in March on Neural Networks.

25) AutoHotkey User / Expert Interview: Ernestas Ceciorka

In this interview I speak with Ernestas out of Lithuania. He’s new to AutoHotkey but is learning quickly and enjoying Web Scraping as well as using COM with Excel.

 

26) AutoHotkey User / Expert Interview: Sebastian

In this interview I speak with Sebastian from Germany.  He’s been programming since 2001 and wrote his first program when he was 13 and started with JavaScript, perl, mysql and doSqlWeb. We had a good discussion of using AutoHotkey and various IDE / Editors.

 

27) AutoHotkey User / Expert Interview: Mason George

In this interview I speak with Mason out of Colorado. He’s been programming in various languages since he was 13! He plans to go back to college and get a degree in Computer Science.