{"id":13419775,"url":"https://github.com/AutoHotkey/AutoHotkey","last_synced_at":"2025-03-15T05:33:05.297Z","repository":{"id":735162,"uuid":"385065","full_name":"AutoHotkey/AutoHotkey","owner":"AutoHotkey","description":"AutoHotkey - macro-creation and automation-oriented scripting utility for Windows.","archived":false,"fork":false,"pushed_at":"2024-07-06T14:02:52.000Z","size":26189,"stargazers_count":9219,"open_issues_count":19,"forks_count":943,"subscribers_count":268,"default_branch":"alpha","last_synced_at":"2024-10-29T15:11:02.679Z","etag":null,"topics":["autohotkey","automation","c-plus-plus","hotkeys","scripting","scripting-language","windows"],"latest_commit_sha":null,"homepage":"https://autohotkey.com/","language":"C++","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AutoHotkey.png","metadata":{"files":{"readme":"README-LIB.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2009-11-25T11:08:21.000Z","updated_at":"2024-10-29T08:56:05.000Z","dependencies_parsed_at":"2024-04-20T11:36:14.692Z","dependency_job_id":"337d96cf-e325-442f-8eea-f76d2127d0d8","html_url":"https://github.com/AutoHotkey/AutoHotkey","commit_stats":{"total_commits":4272,"total_committers":27,"mean_commits":"158.22222222222223","dds":0.2963483146067416,"last_synced_commit":"581114c1c7bb3890ff61cf5f6e1f1201cd8c8b78"},"previous_names":["lexikos/autohotkey_l"],"tags_count":398,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AutoHotkey%2FAutoHotkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AutoHotkey%2FAutoHotkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AutoHotkey%2FAutoHotkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AutoHotkey%2FAutoHotkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AutoHotkey","download_url":"https://codeload.github.com/AutoHotkey/AutoHotkey/tar.gz/refs/heads/alpha","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243112148,"owners_count":20238185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autohotkey","automation","c-plus-plus","hotkeys","scripting","scripting-language","windows"],"created_at":"2024-07-30T22:01:20.662Z","updated_at":"2025-03-15T05:33:04.740Z","avatar_url":"https://github.com/AutoHotkey.png","language":"C++","funding_links":[],"categories":["TODO scan for Android support in followings","C++","RPA(Robotic Process Automation)","Programs","c-plus-plus","windows","automation","Windows","Hotkey Daemons"],"sub_categories":["Other"],"readme":"# AutoHotkeyLib\n\nThis project includes the capability to compile as a dll, for hosting the interpreter in another application. This was added in 2022, and is not to be confused with the AutoHotkey.dll first created by tinku99 in 2009 and later developed by HotKeyIt ([HotKeyIt/ahkdll](https://github.com/HotKeyIt/ahkdll/)) and thqby ([thqby/AutoHotkey_H](https://github.com/thqby/AutoHotkey_H/)). In contrast with those projects, this dll aims to provide a more convenient interface for hosting the interpreter, behaving as close to base AutoHotkey as is practical.\n\nThe dll has two primary use cases:\n  - Host and execute a script; in particular, allow the use of v1 code within a v2 process.\n  - Examine a script without executing it; provide data for auto-complete, calltips, navigating to function definitions, etc.\n\nThe dll is Unicode-only; ANSI is currently unsupported.\n\n## Experimental\n\nThe syntax and behaviour described here may change between releases, without notice. Version numbers are purely for the base version of AutoHotkey and do not reflect the status of the Lib API.\n\n## Building\n\nSelect the `Release.dll` build configuration and appropriate platform to build the dll.\n\nUse the `Debug.dll` configuration for debugging, but in the project settings, set the debug command line to the path of an exe which will load the dll. If both the dll and the exe are debug builds, it should be possible to debug both at once (even if they are not in the same project/directory).\n\n## Entry Points\n\nThe dll currently has two entry points.\n\n### Host\n\nCreates and returns an instance of AutoHotkeyLib.\n\n```C++\nHRESULT Host(IDispatch **ppLib);\n```\n\nThis can be used from AutoHotkey v2 as follows, where *dll* contains the path or filename:\n```AutoHotkey\nif !hmod := DllCall(\"LoadLibrary\", \"str\", dll, \"ptr\")\n    throw OSError()\nDllCall(dll \"\\Host\", \"ptr*\", Lib := ComValue(9, 0), \"hresult\")\n```\n\n`Lib` then contains a COM object as described below.\n\nThe dll does not yet include the set of functions needed to implement a COM class factory, which would allow activation by means such as CoCreateInstance, ComObjCreate, ComObject or CreateObject (depending on the language/version). Such use would require registering the dll, whereas `Host` does not.\n\n### Main\n\nExecutes the script in the same way that AutoHotkey.exe would. \n\n```C++\nint Main(int argc, LPTSTR argv[]);\n```\nThis was mainly for testing during early development, and is internally used by `Lib.Main(CmdLine)`.\n\n## Lib API\n\nThe methods and properties exposed by the Lib object are defined in [ahklib.idl](source/ahklib.idl), in the  `IAutoHotkeyLib` interface. These are subject to change.\n\n**General:**\n\n  - `ExitCode := Lib.Main(CmdLine)` executes a command line more or less the same as AutoHotkey.exe would. If the script is persistent, it does not return. *CmdLine* must include \"parameter 0\" (which is normally the path of the exe), although its value is ignored. *ExitCode* is either 0 or 2 (CRITICAL_ERROR); ExitApp causes the whole program to terminate.\n  - `Lib.LoadFile(FileName)` loads a script file but does not execute it. It can only be called once, unless the dll is unloaded and loaded again. The script is partially initialized for execution, but hotkeys are not manifested.\n  - `Lib.OnProblem(Callback)` registers a callback to be called for each warning or error, including load-time errors (if registered before the script is loaded) and exceptions that aren't caught or handled by OnError. If a callback is set, the default error message is not shown. *Callback* receives a single parameter containing the thrown value or exception. If an exception object is created for warnings and errors that otherwise wouldn't have one, `What` is set to \"Warn\" or \"Error\".\n\n**Execution:**\n\n  - `ExitCode := Lib.Execute()` manifests hotkeys and excecutes the auto-execute section, then returns. Unlike *Main*, it does not initialize the command line arg variables or check for a previous instance of the script. *Execute* can be called multiple times. If this function is not called, it is possible to extract information about the script without executing it, or to execute specific functions without (or before) executing the auto-execute section.\n  - `Lib.Script` returns an object which can be used to retrieve or set global variables (as properties) or call functions (as methods).\n\n**Informational:**\n\n  - `Lib.Funcs`, `Lib.Vars` and `Lib.Labels` return collections of objects describing functions, variables and labels. See `IDescribeFunc`, `IDescribeVar`, `IDescribeLabel` and `IDescribeParam` in [ahklib.idl](source/ahklib.idl) for usage. Collections use the `IDispCollection` interface, with Funcs, Vars and Labels accepting a name for *Index* and Params accepting a one-based index.\n\n## Not Implemented\n\n`Lib` does not provide any means to enumerate classes. It can be done by enumerating global variable names with `Lib.Vars`, retrieving the classes from `Lib.Script` and inspecting them, but this carries some risk because invoking the class object may cause unknown script to execute.\n\nThere are many other ways that the API could be extended, either to extract information or to control how the script executes or integrates with its host. \n\n## Known Issues\n\nEvents that execute in a new pseudo-thread may cause undefined behaviour if `Lib.Execute()` was skipped.\n\n`A_AhkPath` refers to the path of the current process, so attempts to use it to execute scripts may not behave as intended.\n\nFunctions and menu items which execute a command line derived from the path of the current executable may not behave as intended. This includes `Reload`.\n\n## Unloading/Reloading\n\nAlthough the dll only supports loading one main script file, it is possible to execute or examine multiple scripts, one at a time, by unloading the dll and loading it again.\n```AutoHotkey\nDllCall(\"FreeLibrary\", \"ptr\", hmod)  ; hmod was previously returned by LoadLibrary\n```\n\nBefore unloading the dll, release all external references to objects created by the dll and ensure the keyboard/mouse hook is uninstalled (such as by suspending hotkeys). If the keyboard/mouse hook is still installed, calling FreeLibrary generally will not unload the dll. `Lib` currently does not provide any way to remove the hooks explicitly, so in some cases (e.g. if `#InstallKeybdHook` was used) it may not be possible.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAutoHotkey%2FAutoHotkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAutoHotkey%2FAutoHotkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAutoHotkey%2FAutoHotkey/lists"}