Home Table of Contents Community # Unofficial AutoHotkey FAQ **Note:** this page comes from the AutoHotkey Wiki which has been removed. It hopefully serves a purpose until the official faq can be edited in the new documentation setup. It is a good idea to check the [official documentation](http://www.autohotkey.com/docs/) to see if a new FAQ is available - April 2012. # Purpose This page is meant to list and categorize important forum threads, which answer the most frequently asked questions concerning AutoHotkey. It is a community effort to supplement the official FAQ page. If you have suggestions or would like to contribute, discuss it here: [forum topic](http://www.autohotkey.com/forum/viewtopic.php?t=60798). See also: [Official AHK FAQ](http://www.autohotkey.com/docs/FAQ.htm) **Table of contents** 1. [Purpose](#purpose) 2. [Getting Started](#getting-started) * [Tutorials](#tutorials) * [Can't edit script?](#cant-edit-script) * [Administrator](#administrator) 3. [Tools](#tools) * [Editors](#editors) * [Visual Creators](#visual-creators) * [Syntax](#syntax) * [Recorders](#recorders) * [Documenting](#documenting) * [Window Information Getters](#window-information-getters) 4. [About AHK](#about-ahk) * [AutoIT](#autoit) * [Other Languages](#other-languages) * [AHK in the Workplace](#ahk-in-the-workplace) * [Paradigm](#paradigm) * [Donate](#donate) * [License](#license) * [Portability](#portability) * [Versions](#versions) 5. [AutoHotkey_L (Current AutoHotkey version)](#autohotkey_l-current-autohotkey-version) 6. [Macros](#macros) * [Sending Text and Commands](#sending-text-and-commands) * [Spam a Key](#spam-a-key) * [Date & Time](#date--time) * [Clipboard](#clipboard) * [Hotkeys](#hotkeys) * [Double-click](#double-click) * [Fn key](#fn-key) * [Different Keyboard layouts](#different-keyboard-layouts) * [Hotstrings](#hotstrings) * [Windows](#windows) * [IfWinActive](#ifwinactive) * [System Tray](#system-tray) * [Scheduling](#scheduling) * [Run at Specific Time](#run-at-specific-time) 7. [Files & Folders](#files--folders) * [Opened File Path](#opened-file-path) * [Monitor Folders and Files](#monitor-folders-and-files) * [Selecting files](#selecting-files) * [Working with PDFs](#working-with-pdfs) 8. [Text](#text) * [CSV](#csv) * [Text files](#text-files) * [XML](#xml) 9. [GUIs](#guis) * [Associated Variables](#associated-variables) * [Hotkey Controls](#hotkey-controls) 10. [Graphics](#graphics) * [Can AutoHotkey Draw?](#can-autohotkey-draw) * [How to make a Screenshot](#how-to-make-a-screenshot) * [OCR](#ocr) 11. [Window](#window) 12. [Testing & Debugging](#testing--debugging) * [Basic Debugging](#basic-debugging) * [Advanced Debugging](#advanced-debugging) 13. [Security](#security) * [Virus?](#virus) * [Protection](#protection) 14. [Communication](#communication) * [Browser Automation](#browser-automation) * [Automation of Office Applications](#automation-of-office-applications) * [Variables](#variables) * [E-mail](#e-mail) * [Interact with command line](#interact-with-command-line) 15. [Hardware](#hardware) * [Multiple Keyboards or Mice](#multiple-keyboards-or-mice) 16. [Program Specific Problems](#program-specific-problems) * [Firefox](#firefox) 17. [Games](#games) * [Commands](#commands) * [Troubleshooting](#troubleshooting) 18. [More info](#more-info) # Getting Started Questions on how best to learn AHK and common problems with your first script. ## Tutorials **I just found AutoHotkey, looks great, but where do I start?** [Search](http://www.autohotkey.com/board/index.php?app=core&module=search&search_in=forums) terms: *tutorial, manual* * [Official Quick start tutorial](http://www.autohotkey.com/docs/Tutorial.htm) * [Tutorial for Newbies](http://www.autohotkey.com/forum/post-289433.html#289433) * [AHK Tutorials](http://www.autohotkey.net/~faqbot/scripts.html#Tutorials) * [AHK Forum: How to Get Answers Effectively](http://www.autohotkey.com/forum/topic4986.html) * [AHK Video Tutorials](http://www.autohotkey.com/forum/viewtopic.php?t=59764) ## Can't edit script? **Can't edit your script because it won't start (error) or unable to find your script?** * [Messed up AHK and now I can't load scripts](http://www.autohotkey.com/forum/viewtopic.php?t=28539&p=177882#177882) * [Lost my system tray icon... would like it back](http://www.autohotkey.com/forum/viewtopic.php?t=32056) * [Debugging a Script](http://www.autohotkey.com/docs/Scripts.htm#debug) (AutoHotkey documentation) * [Modifier/Hotkey combinations do not work](http://www.autohotkey.com/forum/viewtopic.php?p=325909) ## Administrator **Why does my script run fine in XP but not in Vista or Windows 7?** * [Autostart Autohotkey as Administrator](http://www.autohotkey.com/forum/topic56817.html) * [Run as Administrator (Vista/Windows-7) A_IsAdmin Params](http://www.autohotkey.com/forum/viewtopic.php?t=50448) * [Add "Run as Administrator" for AutoHotkey Scripts](http://www.autohotkey.com/forum/viewtopic.php?t=50493) * [Enable interaction with administrative programs - Modifies AutoHotkey.exe](http://www.autohotkey.com/board/topic/70449-enable-interaction-with-administrative-programs/) Advanced # Tools Questions about the tools that make scripting easier. These may be written in AHK or by third parties. ## Editors **What is the best [IDE](http://en.wikipedia.org/wiki/Integrated_development_environment) to use for editing AutoHotkey Scripts?** General: * [The Extras folder included with AutoHotkey has some add-ons for editors](http://www.autohotkey.com/docs/commands/Edit.htm) **AutoHotkey basic only** * [How to change the default editor (Right click, edit this script)](http://www.autohotkey.com/forum/topic949.html) Discussion: * [What's your favorite FREE text editor?](http://www.autohotkey.com/forum/viewtopic.php?t=33357) * [What Editor do you use for AHK programming?](http://www.autohotkey.com/forum/viewtopic.php?t=20295) Editors tailored for AutoHotkey or Made in AutoHotkey: * [SciTE4AutoHotkey v3 Stable](http://www.autohotkey.com/board/topic/54431-scite4autohotkey-v3000-stable-updated-2272012/) * [Dev-PHP with AHK support](http://www.autohotkey.com/forum/viewtopic.php?p=422565#422565) * [AutoHotKey for Notepad2](http://www.autohotkey.com/forum/topic37652.html) and [Notepad2 with AutoHotKey and Bookmarks](http://www.autohotkey.com/forum/viewtopic.php?t=62040) * [QuickAHK v2.2](http://www.autohotkey.com/forum/viewtopic.php?t=36159) * [AHK Studio](http://www.autohotkey.com/board/topic/85996-ahk-studio/) * [Vic - A free text editor based on HiEdit control](http://www.autohotkey.com/forum/viewtopic.php?t=52880) * [Listing of Editor related scripts in AutoHotkey Wiki](http://www.autohotkey.net/~faqbot/scripts.html#Editors) AutoHotkey syntax highlighting: * [AutoHotkey syntax highlighting for various editors](http://www.autohotkey.net/~Lexikos/AutoHotkey_L/docs/commands/Edit.htm#Editors) search the forum for other editors * [AutoHotkey basic (download the ZIP)](http://www.autohotkey.com/board/topic/86134-autohotkey-10-classic-and-basic-versions/) has some old(er) syntax highlighting files in the Extras\Syntax folder * [UltraEdit 9 - 18 Syntax Highlighting](http://www.autohotkey.com/community/viewtopic.php?p=514497#p514497) * [GreenPad](http://www.autohotkey.com/community/viewtopic.php?f=7&t=68644&hilit=greenpad) ## Visual Creators **Are there any [WYSIWYG](http://en.wikipedia.org/wiki/WYSIWYG) editors to create AHK GUIs by drag-and-drop?** * [SmartGUI Creator](http://www.autohotkey.com/forum/viewtopic.php?t=775) * [SmartGUI+ (Alpha v5.00)](http://www.autohotkey.com/forum/viewtopic.php?t=67138) * [X-Gui Creator](http://www.autohotkey.com/community/viewtopic.php?f=2&t=85639) * [Basic GUI Creator](http://www.autohotkey.com/board/topic/66967-basic-gui-creator/) * [Lil Builder 0.7.1](http://www.autohotkey.com/forum/viewtopic.php?t=20097) ## Syntax **Are there any auto-completion tools for AHK?** * [ISense, Intelisense for AutoHotKey classic](http://www.autohotkey.com/forum/viewtopic.php?t=12985) * [How can context sensitive help for AutoHotkey commands be used in any editor?](http://www.autohotkey.com/docs/FAQ.htm#help) * [Auto-Syntax-Tidy v12](http://www.autohotkey.com/forum/topic7810.html) ## Recorders **Can I create AHK [macros][] by recording my actions?** * [Pulover's Macro Creator, Recorder & Script Writer](http://www.autohotkey.com/community/viewtopic.php?f=13&t=85452) * [Mouse Movement & Click Recorder](http://www.autohotkey.com/forum/viewtopic.php?t=64464) * [AHK MouseRecorder](http://www.autohotkey.com/forum/viewtopic.php?t=16473) * [Mouse and Key Recorder](http://www.autohotkey.com/forum/viewtopic.php?t=53196) * [GG's Find Clickable Locs Window Aid](http://www.autohotkey.com/forum/viewtopic.php?t=69863) * [Macro recorder](http://www.autohotkey.com/forum/topic23671.html) *For AHK Basic there is also the AutoHotkey ScriptWriter that comes with the AHK Basic installer* ## Documenting **How can I generate professional looking documentation for my scripts?** * [Natural Docs](http://www.autohotkey.com/forum/viewtopic.php?t=20361) * [GenDocs v2 - part of SciTE4AutoHotkey](http://www.autohotkey.com/forum/viewtopic.php?t=41287) or [GenDocs v3 - standalone, custom pages, support for markdown](http://www.autohotkey.com/forum/topic76949.html) * [Doc-O-Matic - beta](http://www.autohotkey.com/forum/topic54846.html) *AutoHotkey script* ## Window Information Getters **How can I find the attributes of a window, such as its title, class, text, or mouse coordinates?** **DOES NOT WORK FOR WEB PAGES! USE [COM](#browserautomation)** * Launch Window Spy from a script's tray-icon menu (right click) or the Start Menu. * [AHK Window Info 1.7](http://www.autohotkey.com/forum/viewtopic.php?t=8976) *AutoHotkey script* # About AHK Questions concerning the origin of the language, its relationship to other languages, and theoretical discussion of programming as it relates to AHK. ## AutoIT **How is AHK related to AutoIT?** * [What programming language does AutoHotKey use?](http://www.autohotkey.com/forum/viewtopic.php?t=9923) * [Difference between autoit and ahk communities, activity, etc](http://www.autohotkey.com/forum/viewtopic.php?t=44916) ## Other Languages **What other languages are similar to AHK? Which language is the best or easiest to learn?** * [More advanced programming language, AHK-like?](http://www.autohotkey.com/forum/viewtopic.php?t=53896) * [Programming Languages Discussion](http://www.autohotkey.com/forum/viewtopic.php?t=57217) * [What language is AHK most similar to ??](http://www.autohotkey.com/forum/viewtopic.php?t=43391) * [Programing language](http://www.autohotkey.com/forum/viewtopic.php?t=19849) ## AHK in the Workplace **AHK could really help me out at work. How can I convince my boss to allow it?** * [No AHK at work?](http://www.autohotkey.com/forum/viewtopic.php?t=55890) ## Paradigm **What [programming paradigm](http://en.wikipedia.org/wiki/Programming_paradigm) does AHK represent?** * [Programming paradigm](http://www.autohotkey.com/forum/viewtopic.php?t=54767) ## Donate **I'd like to make a donation to AHK's author. How can I do that?** Do note that there are now several people involved. Some are working on AutoHotkey (Lexikos), some on the website and forum (polyethene and moderators). * [Thank you for the tool](http://www.autohotkey.com/forum/viewtopic.php?t=41) * [I miss donate buttons everywhere!](http://www.autohotkey.com/forum/viewtopic.php?t=15348) ## License **What license is AHK covered by? Am I allowed to sell my scripts for profit?** * [OK to sell?](http://www.autohotkey.com/forum/viewtopic.php?t=4720) ## Portability **Can I run AHK from a USB drive?** * [Portability of AutoHotkey.exe](http://www.autohotkey.com/docs/Scripts.htm#port) In general: * AutoHotkey.exe (basic) looks for AutoHotkey.ini or AutoHotkey.ahk in the same directory and will automatically run that script. * AutoHotkey_L also looks for <EXENAME>.ahk instead of AutoHotkey.ini or AutoHotkey.ahk. So if you rename AutoHotkey.exe to MyApp.exe it will run MyApp.ahk if it is placed in the same directory. There are various scripts that might be helpful: * [Script for people who like to run portable - 1](http://www.autohotkey.com/forum/viewtopic.php?t=58682) (doesn't use the registry) * [Script for people who like to run portable - 2](http://www.autohotkey.com/forum/topic32097.html) (does use the registry) * [Script manager](http://www.autohotkey.com/forum/topic69035.html) by asred * [Script manager](http://www.autohotkey.com/forum/topic37442.html) by pacifika * [Script manager](http://www.autohotkey.com/forum/viewtopic.php?t=65119) by sumon * [OneIcon](http://www.autohotkey.com/forum/topic70467.html) by nimda Compile a script: * [Note about ahk2exe portability](http://www.autohotkey.com/forum/post-464340.html#464340) * [AutoHotkey_L](http://www.autohotkey.com/forum/topic74816.html) (recommended) * [AutoHotkey Basic](http://www.autohotkey.com/docs/Scripts.htm#ahk2exe) ## Versions **Where can I find the official build, or older releases?** **Update October 2012** [AutoHotkey_L to replace AutoHotkey Basic](http://www.autohotkey.com/board/topic/80433-formal-request-to-polyethene/page__st__105#entry548678) Read the Post by the author of AutoHotkey, Chris Mallet [about the future of AutoHotkey(_L)](http://www.autohotkey.com/forum/viewtopic.php?t=63474) *October 2010* * [AutoHotkey, latest version](http://www.autohotkey.com/download/) *AutoHotkey* * [AutoHotkey Classic or Basic](http://www.autohotkey.com/board/topic/86134-autohotkey-10-classic-and-basic-versions/) *Archived* **What [forks](http://en.wikipedia.org/wiki/Fork_(software_development)) and [ports](http://en.wikipedia.org/wiki/Porting) of AHK have been developed?** * [AutoHotkey v2 Alpha Release](http://www.autohotkey.com/forum/viewtopic.php?t=70267) by Lexikos * [AutoHotkey_L: Arrays, Debugger, #If expression](http://www.autohotkey.com/forum/viewtopic.php?t=34070) by Lexikos *(Unicode, ANSI, 64-bit)* see [note above October 2012](#update2012), AHK_L now simply AHK * [AutoHotkey for Pocket PCs / WinCE / Smartphones](http://www.autohotkey.com/forum/topic27146.html) by Micha * [IronAHK (alpha): cross platform .NET rewrite of AutoHotkey](http://www.autohotkey.com/forum/viewtopic.php?t=54494) by polyethene * [AutoHotkey.dll, AutoHotkey_N](http://www.autohotkey.com/forum/topic43049.html) Latest update [AutoHotkey.dll, AutoHotkey_H](http://www.autohotkey.net/~HotKeyIt/AutoHotkey/) by HotKeyIt (AHK_H includes AHK_L and AHK_N) **Are there AutoHotkey alternatives for Linux?** * [Running AutoHotkey using Wine](http://appdb.winehq.org/objectManager.php?sClass=application&iId=5173) * [AutoKey](http://code.google.com/p/autokey/) - AutoKey is a desktop automation utility for Linux and X11 # AutoHotkey_L (Current AutoHotkey version) See note above October 2012 - AHK_L now simply AHK **Why does my AutoHotkey script no longer work with AHK_L** * [Hotkey doesn't work anymore with Autohotkey_L](http://www.autohotkey.com/forum/viewtopic.php?t=67766) * [Fundamental differences between AutoHotkey and AutoHotkey_L](http://l.autohotkey.net/) *See WARNING and [Script compatibility](http://l.autohotkey.net/docs/Compat.htm)* # Macros Questions concerning [keyboard and mouse macros](http://en.wikipedia.org/wiki/Macro_(computer_science)#Keyboard_and_mouse_macros) ## Sending Text and Commands **What if the window I want to interact with isn't active or isn't visible?** [Search](http://www.autohotkey.com/board/index.php?app=core&module=search&search_in=forums) terms (for games): *multiboxing, WoW* * [ControlSend](http://www.autohotkey.com/docs/commands/ControlSend.htm) *AHK Command* * [Dual box script](http://www.autohotkey.com/forum/viewtopic.php?t=65253) ## Spam a Key **How do I spam a key?** * [The definitive autofire thread](http://www.autohotkey.com/forum/viewtopic.php?t=69474) * [Auto fire Tutorial](http://www.autohotkey.com/forum/viewtopic.php?t=62385) * [How to hold a key and spam it](http://www.autohotkey.com/forum/topic64233.html) * [How can a repeating action be stopped without exiting the script?](http://www.autohotkey.com/docs/FAQ.htm#repeat) ## Date & Time **How can I send the current Date and/or Time?** * [Example using FormatTime](http://www.autohotkey.com/forum/topic78672.html) *AutoHotkey command* * [Use the built-in variables](http://www.autohotkey.com/docs/Variables.htm#YYYY) **How can I send large blocks of texts as fast as possible?** * Use the [Clipboard](#Clipboard) *see Sending or Storing texts for some suggestions* ## Clipboard **How to save and restore everything on the clipboard?** * [ClipboardAll example](http://www.autohotkey.com/docs/misc/Clipboard.htm) *built-in variable* **How to do math with data copied from Excel** * [Convert clipboard to integer](http://www.autohotkey.com/forum/topic67450.html) **Examples** * [Examples of Clipboard Manipulation in the Scripts listing](http://www.autohotkey.net/~faqbot/scripts.html#Script_Listing#Clipboard_Manipulation) **Sending or Storing texts** *useful when sending long texts while preserving the clipboard* * [Alternative 1: Send text via Clipboard: Clip()](http://www.autohotkey.com/forum/topic75550.html) * [Alternative 2: Send / Store text via / in Clipboard: Virtual clipboards+, VirClip()](http://www.autohotkey.com/forum/topic56926.html) * [WinClip - Direct clipboard manipulations](http://www.autohotkey.com/forum/topic79998.html) (Class, requires AutoHotkey_L) ## Hotkeys ### Double-click **How do I detect the double click of a mouse button or the double press of a keyboard key?** * [Catch a double press or clicks](http://www.autohotkey.com/forum/viewtopic.php?p=158892#158892) * [Triple click](http://www.autohotkey.com/forum/viewtopic.php?p=194162#194162) ### Fn key **Can I use the Fn key on my Laptop as a hotkey?** * [Make the Fn key usable](http://www.autohotkey.com/forum/viewtopic.php?t=69396) * [Mystery of the Fn key.](http://www.daonlyfreez.net/tutorials/3p/Veil/fnkey.htm) ### Different Keyboard layouts **How can I use a hotkey that is not in my keyboard layout?** * [Use a keys Scancode for a hotkey](http://www.autohotkey.com/docs/KeyList.htm#SpecialKeys) * [Script to find Scancode of a Key](http://www.autohotkey.com/board/topic/21105-crazy-scripting-scriptlet-to-find-scancode-of-a-key/) helps with setting up the above solution ## Hotstrings **Can I use wildcards or regular expressions in Hotstrings?** * [RegEx Powered Dynamic Hotstrings](http://www.autohotkey.com/forum/topic16367.html) **Why don't my Hotstrings and/or Hotkeys work in my browswer / webforms or email program?** * [AHK hotkeys and hotstrings blocked by FF, IE and Chrome?](http://www.autohotkey.com/board/topic/85473-ahk-hotkeys-and-hotstrings-blocked-by-ff-ie-and-chrome/) *check your security software, AV, Firewall, other...* ## Windows ### IfWinActive **What's the difference between #IfWinActive and IfWinActive?** * [ #IfWinActive, Creates context-sensitive hotkeys and hotstrings. Such hotkeys perform a different action (or none at all) depending on the type of window that is active or exists.](http://www.autohotkey.com/docs/commands/_IfWinActive.htm) *AHK Command* * [IfWinActive, Checks if the specified window exists and is currently active (foremost)](http://www.autohotkey.com/docs/commands/IfWinActive.htm) *AHK Command* * [ #IfWinActive doesn't accept variables](http://www.autohotkey.com/forum/viewtopic.php?t=66372) *See #IfWinActive documentation* * [Comment about using #If for context-sensitive hotkeys](http://www.autohotkey.com/forum/post-437100.html#437100) ### System Tray **How can I work with (system) tray icons?** * [ #NoTrayIcon, Disables the showing of a tray icon](http://www.autohotkey.com/docs/commands/_NoTrayIcon.htm) *AHK command* * [Open Tray Icon](http://www.autohotkey.com/forum/viewtopic.php?p=450032#450032) * [Extract Information and Manipulate TrayIcons](http://www.autohotkey.com/forum/topic17314.html) * [Remove tray icon of terminated programs](http://www.autohotkey.com/forum/viewtopic.php?p=399138#399138) * [OneIcon - Tame your tray menu](http://www.autohotkey.com/forum/viewtopic.php?t=70467) ## Scheduling ### Run at Specific Time **How do I limit *when* a script or function will execute?** **Use Windows Task Scheduler!** Automatically: * [Schedule a Task with AHK_L](http://www.autohotkey.com/forum/viewtopic.php?t=65768) * [Schedule a Task with AHK Basic](http://www.autohotkey.com/forum/viewtopic.php?t=29640) Manually: * [Schedule a Task in Windows XP](http://support.microsoft.com/kb/308569) * [Schedule a Task in Windows Vista](http://windows.microsoft.com/en-us/windows-vista/Schedule-a-task) * [Schedule a Task in Windows 7](http://windows.microsoft.com/en-US/windows7/schedule-a-task) Scripting: * [Sleep Until Time](http://www.autohotkey.com/forum/topic55800.html) * [Use the built-in date-time math along with SetTimer to schedule something](http://www.autohotkey.com/forum/viewtopic.php?t=1123#6402) # Files & Folders Questions about manipulating the files and folders on your hard drive. ## Opened File Path **How to get the file path of the currently opened file(s)?** * [Use WinGetTitle if the Program displays the path+file in the Window title](http://www.autohotkey.com/docs/commands/WinGetTitle.htm) *AutoHotkey command* * [Getting the command line information from a program using COM](http://www.autohotkey.com/forum/post-516924.html#516924) *AutoHotkey_L* * [GetCommandLine](http://www.autohotkey.com/forum/viewtopic.php?t=16575) * [Process list, file names, command lines](http://www.autohotkey.com/forum/viewtopic.php?t=9000) ## Monitor Folders and Files **How can I monitor a folder or a (log) file?** [Search](http://www.autohotkey.com/board/index.php?app=core&module=search&search_in=forums) terms: *tail, log* * [WatchDirectory()](http://www.autohotkey.com/forum/topic45237.html) * [CheckFile(File)](http://www.autohotkey.com/forum/viewtopic.php?p=349164#349164) * [TF_Tail, a function from the TF Library](http://www.autohotkey.net/~hugov/tf-lib.htm#TF_Tail) * [Tail with a Gui](http://www.autohotkey.com/forum/viewtopic.php?p=306366#306366) ## Selecting files **How can I process the selected files in explorer** * [Use the Clipboard](http://www.autohotkey.com/docs/misc/Clipboard.htm) and a [Loop in case of multiple files](http://www.autohotkey.com/docs/commands/LoopParse.htm) *AHK Commands* * [Can AutoHotKey retrieve file path of the selected file?](http://www.autohotkey.com/forum/viewtopic.php?t=65419) * [Is there a way to get the current folder and list of selected files from an open explorer window when pressing a hotkey](http://www.autohotkey.com/forum/viewtopic.php?t=65433) * [Access Explorer & IE Windows/Tabs; Open & Manipulate Windows](http://www.autohotkey.com/forum/viewtopic.php?p=384523#384523) *com* * [Get paths of selected items in an explorer window](http://www.autohotkey.com/forum/viewtopic.php?t=65707) **How can I select files in explorer** * [Select files/folders on the SysListView321 control of Explorer](http://www.autohotkey.com/forum/topic37642.html) * [Select multiple files in the Explorer window programmatically?](http://www.autohotkey.com/forum/topic51915.html) * [Open Windows Explorer with multiple objects selected](http://www.autohotkey.com/forum/viewtopic.php?t=71523) ## Working with PDFs **In AutoHotkey:** * [Create/Convert to PDF w/ PDFCreator using COM](http://www.autohotkey.com/board/topic/63736-createconvert-to-pdf-w-pdfcreator-com-ahk-l/) * [Wrapper for libHaru - creating PDFs](http://www.autohotkey.com/board/topic/40659-wrapper-for-libharu-creates-pdfs-stdlib-r1-2009-05-11/) **Using external command line tools, using *Run %comspec% /c*.** Search AHK forum for examples... * [Pdftk - The PDF Toolkit to merge, split, rotate, de/encrypt, metadata and much more ...](http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/) * [Xpdf - Includes a PDF text extractor, PDF-to-PostScript converter, and various other utilities](http://www.foolabs.com/xpdf/) * [xdoc2txt - cmdline, COM or DLL - also for variety of other formats](http://www.ahkscript.org/boards/viewtopic.php?f=5&t=267) # Text Questions concerning string manipulation. ## CSV **How can I read CSV data?** **Tip:** Do **not** use the StringSplit command as it may lead to unexpected results with anything but very basic CSV lists. * [Loop, parse, variable, CSV](http://www.autohotkey.com/docs/commands/LoopParse.htm) *AutoHotkey command* * [CSV Library](http://www.autohotkey.com/forum/topic55909.html) * [TSV Table Manipulation Library](http://www.autohotkey.com/forum/viewtopic.php?t=66290) *Can work with CSV* * [Example: Create, modify/edit/sort csv files using a Listview](http://www.autohotkey.com/forum/topic4526.html) ## Text files **How can I remove or replace a line or .... in a text file?** * [TF Library](http://www.autohotkey.net/~hugov/tf-lib.htm) ## XML **How can I read or manipulate XML files** * [Any way to parse XML and fetch a value?](http://www.autohotkey.com/board/topic/88834-any-way-to-parse-xml-and-fetch-a-value/) - Using AHK 1.1+ built-in methods (ComObjCreate) * [XML wrapper - Build and parse XML](http://www.autohotkey.com/board/topic/89197-xml-build-parse-xml/) * [XA Save / Load Arrays to/from XML Functions](http://www.autohotkey.com/board/topic/85461-ahk-l-saveload-arrays/) - Note XA_XMLEncode() needs to be 'fixed' (bad forum post) # GUIs Questions concerning [graphical user interfaces](http://en.wikipedia.org/wiki/Graphical_user_interface) created by AHK. ## Associated Variables **How can I save the contents of my GUI variables?** * [Use Gui, Submit](http://www.autohotkey.com/docs/commands/Gui.htm#Submit) **Error: The same variable cannot be used for more than one control.....** * ["Error: The same variable cannot be used for more than one control....."](http://www.autohotkey.com/forum/viewtopic.php?t=63875) ## Hotkey Controls **When using Gui, Add, Hotkey, the Windows-key or mouse clicks are not detected** * [User-defined Dynamic Hotkeys](http://www.autohotkey.com/forum/topic51428.html) * [Official FAQ about Hotkeys, Hotstrings, and Remapping](http://www.autohotkey.com/docs/FAQ.htm) # Graphics ## Can AutoHotkey Draw? Apart from some rudimentary methods using Gui, drawing with AutoHotkey is limited. But there are other options: * [GDI+ standard library](http://www.autohotkey.com/community/viewtopic.php?t=32238) * [ImageMagick - COM](http://www.autohotkey.com/community/viewtopic.php?t=61509&p=393020#p393020) ## How to make a Screenshot * [Screen Capture with Transparent Windows and Mouse Cursor](http://www.autohotkey.com/community/viewtopic.php?t=18146) * [Capture Screenshot to JPG](http://www.autohotkey.com/community/viewtopic.php?f=2&t=50675) * [Capture Screenshot to PNG - GDI](http://www.autohotkey.com/community/viewtopic.php?p=570942#p570942) * [Transparent screen capture - ImageMagick](http://www.autohotkey.com/community/viewtopic.php?p=513011#p513011) * [Using Irfanview](http://www.autohotkey.com/community/viewtopic.php?p=418218#p418218) ## OCR * [OCR.ahk - Library for recognizing text in images](http://www.autohotkey.com/community/viewtopic.php?f=2&t=74227&hilit=gocr) * [Use 3rd party tools - MSPVIEW, Abbyy, OneNote, Google Docs](http://www.autohotkey.com/community/viewtopic.php?f=1&t=93679) * [Screengrab --> OCR -- text, GUI for options/results](http://www.autohotkey.com/community/viewtopic.php?t=11186) - various versions throughout the thread # Window How can I start an action when a window appears, becomes active etc? * [WinWait](http://www.autohotkey.com/docs/commands/WinWait.htm) and [WinWaitActive](http://www.autohotkey.com/docs/commands/WinWaitActive.htm) - AHK commands * [WinTrigger: Watch de-activation/un-existance of windows...](http://www.autohotkey.com/community/viewtopic.php?f=2&t=63673) * [Hook on to Shell, HookWindow](http://www.autohotkey.com/community/viewtopic.php?p=123323) # Testing & Debugging Questions about finding and fixing the errors in your code. ## Basic Debugging **How can I debug simple scripts?** * [ListLines](http://www.autohotkey.com/docs/commands/ListLines.htm) *AutoHotkey command* * [ListVars](http://www.autohotkey.com/docs/commands/ListVars.htm) *AutoHotkey command* * [MsgBox (use it to show contents of a variable)](http://www.autohotkey.com/docs/commands/MsgBox.htm) or [ToolTip](http://www.autohotkey.com/docs/commands/ToolTip.htm) *AutoHotkey commands* ## Advanced Debugging **How can I debug complex scripts?** * [Interactive Debugging](http://l.autohotkey.net/docs/Scripts.htm#idebug) * [Debugging library](http://www.autohotkey.com/forum/topic58677.html) # Security ## Virus? **My AntiVirus software flagged AHK as malware. Does it really contain a virus?** Note: Recent versions of the AutoHotkey installer no longer include UPX or MPress. [Search](http://www.autohotkey.com/board/index.php?app=core&module=search&search_in=forums) terms: *virus, trojan, upx, false alarm, false positive* * [An open letter for Antiviral software companies](http://www.autohotkey.com/forum/topic31975.html) * [Enough with the UPX packed virus false alarms](http://www.autohotkey.com/forum/viewtopic.php?t=53129) * [Should UPX be removed from Autohotkey install?](http://www.autohotkey.com/forum/topic53219.html) * [Virus warnings on Autohotkey](http://www.autohotkey.com/forum/viewtopic.php?t=46876) ## Protection **How can I protect my source code?** [Search](http://www.autohotkey.com/board/index.php?app=core&module=search&search_in=forums) terms: **compile, password, expir** * [Convert a Script to an EXE (ahk2exe)](http://www.autohotkey.com/docs/Scripts.htm#ahk2exe) * [SW Copy protection](http://www.autohotkey.com/forum/viewtopic.php?t=5763) * [Time limit like a trial software for script, how to do it?](http://www.autohotkey.com/forum/viewtopic.php?t=8493) * [Someone decompiled my passworded and protected script](http://www.autohotkey.com/forum/viewtopic.php?t=28823) * [Password protect a script](http://www.autohotkey.com/forum/viewtopic.php?t=55167) * See [the ahk2exe notes](http://www.autohotkey.net/~Lexikos/AutoHotkey_L/docs/Scripts.htm#ahk2exe): As of v1.1.01, password protection and the /NoDecompile switch are not supported. [Mpress](http://www.matcode.com/mpress.htm) can be used to compress the script executable. This also compresses the script source code. (Note: See AHK_L Decompiler below) * [Obfuscator for Autohotkey Scripts](http://www.autohotkey.com/board/topic/89357-obfuscator-for-autohotkey-scripts/) **Problems compiling your script?** * [Microsoft Security Essentials breaks compilation](http://www.autohotkey.com/forum/viewtopic.php?t=65224) * [Can't turn .ahk into .exe with win7](http://www.autohotkey.com/forum/viewtopic.php?t=61440) * [Compile / Run AutoHotkey program](http://www.autohotkey.com/forum/viewtopic.php?p=300660#300660) **I compiled my script, but I've lost the source-code. Can I get the AutoHotkey source back?** * [Script Decompiler AHK Classic](http://www.autohotkey.com/board/topic/86134-autohotkey-10-classic-and-basic-versions/) * [Script Decompiler AHK_L](http://www.autohotkey.com/community/viewtopic.php?f=13&t=89275) (including UPX or Mpress packed exe) **Recover deleted but still running AHK script** * [Recover deleted but still running AHK script](http://www.autohotkey.com/forum/viewtopic.php?p=371808) # Communication ## Browser Automation **Can AutoHotkey interact with browsers or webpages?** [Search](http://www.autohotkey.com/board/index.php?app=core&module=search&search_in=forums) terms: *com, httpquery, javascript, curl, wget, UrlDownloadToFile, UrlDownloadToVar* *AutoHotkey* * [UrlDownloadToFile](http://www.autohotkey.com/docs/commands/UrlDownloadToFile.htm) *AutoHotkey command* * [httpQuery GET and POST requests](http://www.autohotkey.com/forum/topic33506.html) * [libcurl example](http://www.autohotkey.com/forum/topic22621.html) *IE browser* * [Basic Webpage Controls with JavaScript / COM - Tutorial](http://www.autohotkey.com/forum/topic51020.html) *Internet Explorer* * [Example of Navigating a Website](http://www.autohotkey.com/forum/viewtopic.php?t=42488) *Firefox* * [Combine iMacros and Firefox](http://www.autohotkey.com/board/topic/88596-imacrosahk-library-for-automating-interaction-with-web-pages/) * [Retrieve AddressBar of Firefox, Internet Explorer or Opera through DDE Message](http://www.autohotkey.com/forum/topic19169.html) * Library: [Remotely control Firefox](http://www.autohotkey.com/forum/topic46974.html) - [Class](http://www.autohotkey.com/board/topic/92287-firefox-automation-with-mozrepl/) *with MozRepl addon* * [Accessible Library](http://www.autohotkey.com/board/topic/77888-accessible-info-viewer-alpha-release-2012-09-20/) - not just for Firefox but can be used for FF ## Automation of Office Applications **Can AutoHotkey interact with Microsoft Office Applications?** * [MS Office Automation Functions (via COM)](http://www.autohotkey.com/forum/viewtopic.php?t=31923) * [AHK_L MS Office Automation Samples (via COM)](http://www.autohotkey.com/forum/viewtopic.php?t=61509) * [Basic Ahk_L COM Tutorial for Excel ](http://www.autohotkey.com/board/topic/69033-basic-ahk-l-com-tutorial-for-excel/) ## Variables **How can I pass on variables or data from one script to another?** [Search](http://www.autohotkey.com/board/index.php?app=core&module=search&search_in=forums) terms: *ini, ipc, command line, onmessage* * [Passing Command Line Parameters to a Script](http://www.autohotkey.com/docs/Scripts.htm#cmd) * Use [IniWrite](http://www.autohotkey.com/docs/commands/IniWrite.htm) and [IniRead](http://www.autohotkey.com/docs/commands/IniRead.htm) * or [FileAppend](http://www.autohotkey.com/docs/commands/FileAppend.htm) and [FileRead](http://www.autohotkey.com/docs/commands/FileRead.htm) * [Example: Send a string of any length from one script to another](http://www.autohotkey.com/docs/commands/OnMessage.htm) *AHK Documentation, fourth example on page* * [Interprocess communication (IPC) - module, ahk & dotNet](http://www.autohotkey.com/forum/topic21699.html) * [Interprocess communication using Mailslots](http://www.autohotkey.com/forum/viewtopic.php?t=59920) * [Reload with parameters](http://www.autohotkey.com/forum/viewtopic.php?p=268240#268240) * [SendData() - Sending data between scripts with SendMessage](http://www.autohotkey.com/forum/topic83276.html) * [WorkerThread - easy and powerful Multithreading](http://www.autohotkey.com/forum/topic82772.html) *AutoHotkey_L, library* * [talk() - class to communicate between scripts](http://www.autohotkey.com/board/topic/94321-talk-interscript-communication-provider-and-more-updated-2707/) ## E-mail **Can I use AutoHotkey to send e-mail?** [Search](http://www.autohotkey.com/board/index.php?app=core&module=search&search_in=forums) terms: *blat, cdo, mailto* * [Blat Dll usage](http://www.autohotkey.com/forum/viewtopic.php?t=10813) * [CDO COM - Email delivery](http://www.autohotkey.com/forum/viewtopic.php?t=39797); [AHK_L Version](http://www.autohotkey.com/forum/viewtopic.php?p=403177) * [Instructing Outlook from the command line and using mailto](http://www.autohotkey.com/forum/viewtopic.php?t=592) ## Interact with command line **Can I use AutoHotkey to Interact with the command line?** [Search](http://www.autohotkey.com/board/index.php?app=core&module=search&search_in=forums) terms: *cli, dos, console, StdOut* * [Run](http://www.autohotkey.com/docs/commands/Run.htm) *%comspec% /c* * [FileAppend](http://www.autohotkey.com/docs/commands/FileAppend.htm) see *stdout* * [How can the output of a command line operation be retrieved?](http://www.autohotkey.com/docs/FAQ.htm#output) * [CMDret - AHK functions](http://www.autohotkey.com/forum/topic8606.html) * [Retrieve standard output (StdOut) of a program](http://www.autohotkey.com/forum/viewtopic.php?t=34511) * [StdoutToVar](http://www.autohotkey.com/forum/topic16823.html) * [Function: Run - Retrieve and be notified about output from the console programs](http://www.autohotkey.com/forum/viewtopic.php?t=63117) * [Using COM to interact with command-line programs](http://www.autohotkey.com/forum/viewtopic.php?t=72731) * [Tip: retrieving command line output without a text file](http://www.autohotkey.com/forum/topic33894.html) * [Compile/Run script as console application](http://www.autohotkey.com/forum/viewtopic.php?p=333402#333402) * [Copy text from DOS console using its system menu](http://www.autohotkey.com/forum/viewtopic.php?p=266108#266108) Related: * [Passing Command Line Parameters to a Script](http://www.autohotkey.com/docs/Scripts.htm#cmd) # Hardware Questions concerning the input and output devices AHK interacts with. ## Multiple Keyboards or Mice **How can I distinguish a second keyboard or mouse?** * [AHKHID - An AHK implementation of the HID functions](http://www.autohotkey.com/forum/viewtopic.php?t=41397) *Keyboards, Mice, Other* * [Multiple keyboards workaround using HID Macros (external app)](http://www.autohotkey.com/forum/topic60393.html) * [EitherMouse - auto switch mouse buttons on second mouse](http://www.autohotkey.com/forum/topic48238.html) * [AutoHotkey script template for the 120 hotkey Enterpad (special keyboard)](http://www.autohotkey.com/forum/viewtopic.php?t=25599) # Program Specific Problems ## Firefox * [ # no longer works as modifier in hotkeys with Firefox 17+] (http://www.autohotkey.com/board/topic/87602-autohotkey-stopped-working-for-firefox-only/#entry562905) just use *LWin & KEY::* [See custom combinations](http://www.autohotkey.com/docs/Hotkeys.htm#Features) # Games ## Commands **What are the most used commands in games?** 1. [Send](http://www.autohotkey.com/docs/commands/Send.htm) >> Sends simulated keystrokes and mouse clicks to the active window. 2. [Click](http://www.autohotkey.com/docs/commands/Click.htm) / [MouseClick](http://www.autohotkey.com/docs/commands/MouseClick.htm) >> Clicks a mouse button at the specified coordinates. It can also hold down a mouse button, turn the mouse wheel, or move the mouse. 3. [ImageSearch](http://www.autohotkey.com/docs/commands/ImageSearch.htm) >> ImageSearch can be used to detect graphical objects on the screen that either lack text or whose text cannot be easily retrieved. For example, it can be used to discover the position of picture buttons, icons, web page links, or game objects. Once located, such objects can be clicked via [Click](http://www.autohotkey.com/docs/commands/Click.htm). 4. [PixelSearch](http://www.autohotkey.com/docs/commands/PixelSearch.htm) >> Searches a region of the screen for a pixel of the specified color. 5. [PixelGetColor](http://www.autohotkey.com/docs/commands/PixelGetColor.htm) >> Retrieves the color of the pixel at the specified x,y coordinates. 6. [Loop](http://www.autohotkey.com/docs/commands/Loop.htm) >> Perform a series of commands repeatedly: either the specified number of times or until [Break](http://www.autohotkey.com/docs/commands/Break.htm) is encountered. 7. [Sleep](http://www.autohotkey.com/docs/commands/Sleep.htm) >> Waits the specified amount of time before continuing. 8. [SetTimer](http://www.autohotkey.com/docs/commands/SetTimer.htm) >> Causes a subroutine to be launched automatically and repeatedly at a specified time interval. ## Troubleshooting **Why do Hotstrings, Send, and Click have no effect in certain games?** Not all games allow AHK to send keys and clicks or receive pixel colors. But their are some alternatives, try all the solutions mentioned below. If all these fail, it may not be possible for AHK to work with your game. Sometimes games have a hack and cheat prevention measure, such as GameGuard and Hackshield. If they do, there is a high chance that AutoHotkey will not work with that game. *Use SendPlay via:* 1. the [SendPlay](http://www.autohotkey.com/docs/commands/Send.htm#SendPlay) command; 2. using [SendMode Play](http://www.autohotkey.com/docs/commands/SendMode.htm); and/or 3. the [hotstring option SP](http://www.autohotkey.com/docs/Hotstrings.htm). If you use Windows 7 and want to try SendPlay, read this [SendPlay on Win7, Run as admin and disable UAC](http://www.autohotkey.com/forum/viewtopic.php?p=306814#306814) To allow SendPlay even with UAC running and without running your script as admin, see [Enable interaction with administrative programs](http://www.autohotkey.com/forum/topic75595.html) by Lexikos Increase [SetKeyDelay](http://www.autohotkey.com/docs/commands/SetKeyDelay.htm). For example: ```autohotkey SetKeyDelay, 0, 50 SetKeyDelay, 0, 50, Play ``` *Try* [ControlSend](http://www.autohotkey.com/docs/commands/ControlSend.htm), which might work in cases where the other Send modes fail. *Try* ```autohotkey Send {KEY down}{KEY up} ``` with the various send methods *Try* ```autohotkey Send {KEY down} Sleep 10 ; try various milliseconds Send {KEY Up} ``` Read about [DirectInput](http://msdn.microsoft.com/en-us/library/ee416842(v=VS.85).aspx), [XInput](http://msdn.microsoft.com/en-us/library/hh405053(v=VS.85).aspx), [Raw Input](http://msdn.microsoft.com/en-us/library/ms645543) There is also an [Official FAQ on Games](http://www.autohotkey.com/docs/FAQ.htm#games) # More info Suggestions welcome, post them [here](http://www.autohotkey.com/forum/viewtopic.php?t=60798). **Other pages of interest** * [Script Listing](http://www.autohotkey.net/~faqbot/scripts.html) * [Typing Scripts](http://www.autohotkey.net/~faqbot/typing-scripts.html)