Autohotkey webinar Deep-Dive into File Encoding

webinarIn this AutoHotkey Webinar took a deep-dive into File Encoding by our guest speaker Jean Lalonde (author of Quick Access Popup)

Video Hour 1:  High Level:

  • Why File encoding matters
  • Pros/Cons of each type of encoding
  • Tools like the File Encoding Lab to help determine a file’s encoding
  • How to set File Encoding in AutoHotkey

Video Hour 2: Coding and Q&A

Script Highlight: BarChart by Learning One

(Here is a link to BarChart scripts demonstrated during the webinar)


1) File Enconding in AutoHotkey

(Here is a link to all of Jean Lalonde’s files)
  • Edit and run the AHK script “FileRead.ahk”
  • Load “Demo-UTF-16.txt” with default encoding
  • Load “Demo-UTF-16-No_BOM.txt” with default encoding  -> problem!
  • Load “Demo-UTF-16-No_BOM.txt” with UTF-16-RAW encoding  -> OK!
  • Try the other file enconding available in AHK

2) File Encoding in DOS (code pages)

  • Run the batch file “Type Box.bat” in DOS console (under “Tutorial“ folder)
  • See this ASCII/ANSI file displayed with code pages 1252 (default ASCI/ANSI) and 437

3) Load the File Encoding Lab

  • Run the AHK script “File Encoding Lab.ahk”
  • Loaded bu default “ASCII.txt” (detected CP1252, 7-bit chars)
  • File Encoding Lab tour
    • Binary display on the left side / Normal AHK display on the right
    • Click on the file name to see with Notepad
    • Encoded detected and use the dropdown list to reload with another encoding
  • Load “ANSI.txt” (detected CP1252, 8-bit chars)
  • Load “Box-CP437.txt” (detected CP1252, 8-bit chars)
    • Which encoding will display a box?
  • Load “UTF-8.txt” (detected UTF-8)
    • see BOM (“byte ordre mark” or header) on left side: two first bytes
    • See one byte for “!”
    • See two bytes each for “é”  and “É«
    • See three bytes for “用”

4) File Encoding Lab Cheat Sheet

  • ASCII and ANSI
  • Unicode 8-16-32 bits
  • Unicode with/without BOM
  • Unicode Little or Big Endian

5) Real life files

  • QAP Spanish translation
  • QAP Chinese translation
  • Other examples?

Web Scraping with AutoHotkey 110- Saving Files / Images from a URL / Hyperlink

While URLDownloadToFile is a built-in function for downloading binary files (Images, Word files, Spreadsheets, etc.) I’ve, and others, have had issues using it (I think it was that I was behind a proxy at work).   In the below video I demonstrate how to use the URLDownloadToFile command as well as demonstrate a function I borrowed from Maestrith (Author of AutoHotkey Studio).

Saving Files / Images from a URL / Hyperlink

Web Scraping with AutoHotkey 110- Saving binary files / images with AutoHotkey

 

Here is the code I walk through in the first part of the above video (demonstrating the built-in functionality and an example calling the function.

And here is the code where I demonstrate how you can get a list of images and iterate over them in an object (calling the download function)

 

AutoHotkey Web service API syntax writer- Automate writing your WinHTTP Requests with my syntax writer

AutoHotkey API syntax writer

In this video I walk through how to use my AutoHotkey API Syntax Writer.  If you’re new to APIs, be sure to check out our Webinar on API / Web Services or this page for a lot of examples of connecting to API services.

Please remember that, after launching the script, you’ll need to hold down the control key and left mouse-click to activate the menu options.

Here is the video walking through how to use the tool.

AutoHotkey API Syntax writer

 

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