Home

Awesome

Exo: JavaScript unleashed!

Imagine the power of AHK (File/OS/Keyboard/Mouse/GUI Management) in the hands of JavaScript. Imagine the ecosystem of JavaScript libraries (jQuery, CreateJS, etc.) in the hands of AHK.

Exo makes this happen!

Archived

Exo has been archived because it is somewhat outdated and is no longer actively maintained. Here are other paths to follow for OS automation through JS:

Description

Exo exposes most built-in commands/functions/variables of AHK to JavaScript, allowing you to practically write AHK inside JS (with JS syntax).

There are several advantages to using JS, rather than AhkScript:

  1. A lot of people are already familiar with JS, so there's no need to learn the peculiarities of the AhkScript-syntax.
  2. Gain access to a huge repository of libraries written in JS.
  3. You can use JS-specific constructs (eval, anonymous functions, prototype, etc.).
  4. You get to code in your favorite JS editor (IDE). ... and more.

It does all this by embedding a browser (Internet Explorer) and hooking into it with ComObject. It then bridges the JS global functions to their AHK counterpart.

Goals

While migrating the keywords, the following goals were set:

Usage

Launch Exo with a ".js" file argument (either through drag-and-drop, or from the command-line).

> Exo.ahk "demo.js"

Sample code:

alert(A_Now);
FileAppend('Hello, World!', 'hello.txt')
var list = Loop('*.txt');
for (var i = 0; i < list.length; i++) {
	var fileProperties = list[i];
	MsgBox(fileProperties.LongPath);
}
Sleep(1000);
ExitApp();

About

Migration Guide

This section lists all relevant AHK keywords (Commands, Function, Directives and Variables) and illustrates their counterpart in JS. In most cases, there is no significant change and everything is intuitive.

The breakdown for the following 470 keywords:

Keywords that were not migrated (categories 0, 4 and 5) are marked bold.

AHK KeywordJS ImplementationJS Type
1, 2, 3, etc.Replacement: "A_Args"Array
A_AhkPathIdenticalString
A_AhkVersionIdenticalString
A_AppDataIdenticalString
A_AppDataCommonIdenticalString
A_AutoTrimNot needed (AHK specific)N/A
A_BatchLinesIdenticalString
A_CaretXIdenticalString
A_CaretYIdenticalString
A_ComputerNameIdenticalString
A_ControlDelayIdenticalNumber
A_CursorIdenticalString
A_DDIdenticalString
A_DDDIdenticalString
A_DDDDIdenticalString
A_DefaultMouseSpeedIdenticalNumber
A_DesktopIdenticalString
A_DesktopCommonIdenticalString
A_DetectHiddenTextIdenticalString
A_DetectHiddenWindowsIdenticalString
A_EndCharCannot use yetN/A
A_EventInfoIdenticalString
A_ExitReasonIdenticalString
A_FileEncodingIdenticalString
A_FormatFloatIdenticalString
A_FormatIntegerIdenticalString
A_GuiIdenticalString
A_GuiControlIdenticalString
A_GuiControlEventIdenticalString
A_GuiEventIdenticalString
A_GuiHeightIdenticalNumber
A_GuiWidthIdenticalNumber
A_GuiXIdenticalNumber
A_GuiYIdenticalNumber
A_HourIdenticalString
A_IconFileIdenticalString
A_IconHiddenIdenticalNumber
A_IconNumberIdenticalString
A_IconTipIdenticalString
A_IndexNot needed (AHK specific)N/A
A_IPAddress1IdenticalString
A_IPAddress2IdenticalString
A_IPAddress3IdenticalString
A_IPAddress4IdenticalString
A_Is64bitOSIdenticalNumber
A_IsAdminIdenticalNumber
A_IsCompiledIdenticalString
A_IsCriticalIdenticalNumber
A_IsPausedIdenticalNumber
A_IsSuspendedIdenticalNumber
A_IsUnicodeIdenticalString
A_KeyDelayIdenticalNumber
A_LanguageIdenticalString
A_LastErrorIdenticalString
A_LineFileCannot use yetN/A
A_LineNumberCannot use yetN/A
A_LoopFieldNot needed as such (Returned by "Loop()").N/A
A_LoopFileAttribNot needed as such (Returned by "Loop()").N/A
A_LoopFileDirNot needed as such (Returned by "Loop()").N/A
A_LoopFileExtNot needed as such (Returned by "Loop()").N/A
A_LoopFileFullPathNot needed as such (Returned by "Loop()").N/A
A_LoopFileLongPathNot needed as such (Returned by "Loop()").N/A
A_LoopFileNameNot needed as such (Returned by "Loop()").N/A
A_LoopFileShortNameNot needed as such (Returned by "Loop()").N/A
A_LoopFileShortPathNot needed as such (Returned by "Loop()").N/A
A_LoopFileSizeNot needed as such (Returned by "Loop()").N/A
A_LoopFileSizeKBNot needed as such (Returned by "Loop()").N/A
A_LoopFileSizeMBNot needed as such (Returned by "Loop()").N/A
A_LoopFileTimeAccessedNot needed as such (Returned by "Loop()").N/A
A_LoopFileTimeCreatedNot needed as such (Returned by "Loop()").N/A
A_LoopFileTimeModifiedNot needed as such (Returned by "Loop()").N/A
A_LoopReadLineNot needed as such (Returned by "Loop()").N/A
A_LoopRegKeyNot needed as such (Returned by "Loop()").N/A
A_LoopRegNameNot needed as such (Returned by "Loop()").N/A
A_LoopRegSubKeyNot needed as such (Returned by "Loop()").N/A
A_LoopRegTimeModifiedNot needed as such (Returned by "Loop()").N/A
A_LoopRegTypeNot needed as such (Returned by "Loop()").N/A
A_MDayIdenticalString
A_MinIdenticalString
A_MMIdenticalString
A_MMMIdenticalString
A_MMMMIdenticalString
A_MonIdenticalString
A_MouseDelayIdenticalNumber
A_MSecIdenticalString
A_MyDocumentsIdenticalString
A_NowIdenticalString
A_NowUTCIdenticalString
A_NumBatchLinesIdenticalString
A_OSTypeIdenticalString
A_OSVersionIdenticalString
A_PriorHotkeyIdenticalString
A_PriorKeyIdenticalString
A_ProgramFilesIdenticalString
A_ProgramsIdenticalString
A_ProgramsCommonIdenticalString
A_PtrSizeIdenticalNumber
A_RegViewIdenticalString
A_ScreenDPIIdenticalNumber
A_ScreenHeightIdenticalNumber
A_ScreenWidthIdenticalNumber
A_ScriptDirIdenticalString
A_ScriptFullPathIdenticalString
A_ScriptHwndIdenticalString
A_ScriptNameIdenticalString
A_SecIdenticalString
A_SpaceIdenticalString
A_StartMenuIdenticalString
A_StartMenuCommonIdenticalString
A_StartupIdenticalString
A_StartupCommonIdenticalString
A_StringCaseSenseIdenticalString
A_TabIdenticalString
A_TempIdenticalString
A_ThisFuncNot needed (AHK specific)N/A
A_ThisHotkeyIdenticalString
A_ThisLabelNot needed (AHK specific)N/A
A_ThisMenuIdenticalString
A_ThisMenuItemIdenticalString
A_ThisMenuItemPosIdenticalString
A_TickCountIdenticalNumber
A_TimeIdleIdenticalNumber
A_TimeIdlePhysicalIdenticalNumber
A_TimeSincePriorHotkeyIdenticalNumber
A_TimeSinceThisHotkeyIdenticalNumber
A_TitleMatchModeIdenticalString
A_TitleMatchModeSpeedIdenticalString
A_UserNameIdenticalString
A_WDayIdenticalString
A_WinDelayIdenticalNumber
A_WinDirIdenticalString
A_WorkingDirIdenticalString
A_YDayIdenticalString
A_YearIdenticalString
A_YWeekIdenticalString
A_YYYYIdenticalString
Abs()IdenticalNumber
ACos()IdenticalNumber
Array()Not needed (AHK specific)N/A
Asc()IdenticalNumber
ASin()IdenticalNumber
ATan()IdenticalNumber
AutoTrimNot needed (AHK specific)N/A
BlockInputNormalizationEmpty
Ceil()IdenticalNumber
Chr()IdenticalString
ClickNormalizationEmpty
ClipboardIdenticalString
ClipboardAllIdenticalString
ClipWaitNormalizationEmpty
ComObjActive()Cannot use yetN/A
ComObjArray()Cannot use yetN/A
ComObjConnect()Cannot use yetN/A
ComObjCreate()Cannot use yetN/A
ComObject()Cannot use yetN/A
ComObjEnwrap()Not needed (Deprecated)N/A
ComObjError()Cannot use yetN/A
ComObjFlags()Cannot use yetN/A
ComObjGet()Cannot use yetN/A
ComObjMissing()Not needed (Deprecated)N/A
ComObjParameter()Cannot use yetN/A
ComObjQuery()Cannot use yetN/A
ComObjType()Cannot use yetN/A
ComObjUnwrap()Not needed (Deprecated)N/A
ComObjValue()Cannot use yetN/A
ComSpecIdenticalString
ControlNormalizationEmpty
ControlClickNormalizationEmpty
ControlFocusNormalizationEmpty
ControlGetNormalizationString
ControlGetFocusNormalizationString
ControlGetPosMinor change (returns Object){}
ControlGetTextNormalizationString
ControlMoveNormalizationEmpty
ControlSendNormalizationEmpty
ControlSendRawNormalizationEmpty
ControlSetTextNormalizationEmpty
CoordModeNormalizationEmpty
Cos()IdenticalNumber
CriticalNormalizationEmpty
DetectHiddenTextNormalizationEmpty
DetectHiddenWindowsNormalizationEmpty
DllCall()IdenticalString
DriveNormalizationEmpty
DriveGetNormalizationString
DriveSpaceFreeNormalizationNumber
EditCannot use yetN/A
EnvAddNot needed (Feature duplication)N/A
EnvDivNot needed (Feature duplication)N/A
EnvGetNormalizationString
EnvMultNot needed (Feature duplication)N/A
EnvSetNormalizationEmpty
EnvSubNot needed (Feature duplication)N/A
EnvUpdateNormalizationEmpty
ErrorLevelIdenticalN/A
ExceptionNot needed (AHK specific)N/A
ExitNot needed (AHK specific)N/A
ExitAppNormalizationEmpty
Exp()IdenticalNumber
FileAppendNormalizationEmpty
FileCopyNormalizationEmpty
FileCopyDirNormalizationEmpty
FileCreateDirNormalizationEmpty
FileCreateShortcutNormalizationEmpty
FileDeleteNormalizationEmpty
FileEncodingNormalizationEmpty
FileExist()IdenticalString
FileGetAttribNormalizationString
FileGetShortcutMinor change (returns Object){}
FileGetSizeNormalizationNumber
FileGetTimeNormalizationString
FileGetVersionNormalizationString
FileInstallCannot use compile-time features.N/A
FileMoveNormalizationEmpty
FileMoveDirNormalizationEmpty
FileOpen()Minor change (RawRead() multiple output)File
FileReadNormalizationString
FileReadLineNormalizationString
FileRecycleNormalizationEmpty
FileRecycleEmptyNormalizationEmpty
FileRemoveDirNormalizationEmpty
FileSelectFileNormalizationString
FileSelectFolderNormalizationString
FileSetAttribNormalizationEmpty
FileSetTimeNormalizationEmpty
Floor()IdenticalNumber
FormatTimeNormalizationString
Func()Not needed (AHK specific)N/A
GetKeyName()IdenticalString
GetKeySC()IdenticalNumber
GetKeyStateNot needed (occluded by homonym)String
GetKeyState()IdenticalNumber
GetKeyVK()IdenticalNumber
GosubCannot use (AHK specific)N/A
GotoCannot use (AHK specific)N/A
GroupActivateNormalizationEmpty
GroupAddNormalizationEmpty
GroupCloseNormalizationEmpty
GroupDeactivateNormalizationEmpty
GuiNormalizationEmpty
GuiCloseMinor change (built-in label becomes built-in function)Empty
GuiContextMenuMinor change (built-in label becomes built-in function)Empty
GuiControlNormalizationEmpty
GuiControlGetNormalizationString
GuiDropFilesMinor change (built-in label becomes built-in function)Empty
GuiEscapeMinor change (built-in label becomes built-in function)Empty
GuiSizeMinor change (built-in label becomes built-in function)Empty
HotkeyMinor change (target label becomes closure)Empty
IL_Add()IdenticalNumber
IL_Create()IdenticalNumber
IL_Destroy()IdenticalNumber
ImageSearchMinor change (returns Object){}
IniDeleteNormalizationEmpty
IniReadNormalizationString
IniWriteNormalizationEmpty
InputNormalizationString
InputBoxNormalizationString
InStr()IdenticalNumber
IsByRef()Not needed (AHK specific)N/A
IsFunc()Not needed (AHK specific)N/A
IsLabel()Not needed (AHK specific)N/A
IsObject()Not needed (AHK specific)N/A
KeyHistoryNormalizationEmpty
KeyWaitNormalizationEmpty
ListHotkeysNormalizationEmpty
ListLinesCannot implement for JSN/A
ListVarsCannot implement for JSN/A
Ln()IdenticalNumber
Log()IdenticalNumber
LoopMajor change{}
LTrim()IdenticalString
LV_Add()IdenticalNumber
LV_Delete()IdenticalNumber
LV_DeleteCol()IdenticalNumber
LV_GetCount()IdenticalNumber
LV_GetNext()IdenticalNumber
LV_GetText()Major changeString/{}
LV_Insert()IdenticalNumber
LV_InsertCol()IdenticalNumber
LV_Modify()IdenticalNumber
LV_ModifyCol()IdenticalNumber
LV_SetImageList()IdenticalNumber
MenuNormalizationEmpty
Mod()IdenticalNumber
MouseClickNormalizationEmpty
MouseClickDragNormalizationEmpty
MouseGetPosMinor change (returns Object){}
MouseMoveNormalizationEmpty
MsgBoxNormalizationEmpty
NumGet()Cannot use yetN/A
NumPut()Cannot use yetN/A
ObjAddRef()Not needed (AHK specific)N/A
ObjClone()Not needed (AHK specific)N/A
Object()Not needed (AHK specific)N/A
ObjGetAddress()Not needed (AHK specific)N/A
ObjGetCapacity()Not needed (AHK specific)N/A
ObjHasKey()Not needed (AHK specific)N/A
ObjInsert()Not needed (AHK specific)N/A
ObjMaxIndex()Not needed (AHK specific)N/A
ObjMinIndex()Not needed (AHK specific)N/A
ObjNewEnum()Not needed (AHK specific)N/A
ObjRelease()Not needed (AHK specific)N/A
ObjRemove()Not needed (AHK specific)N/A
ObjSetCapacity()Not needed (AHK specific)N/A
OnClipboardChangeMinor change (built-in label becomes built-in function)Empty
OnExitMinor change (target label becomes closure)Empty
OnMessage()Minor change (target function becomes closure)Empty
OutputDebugNormalizationEmpty
PauseNormalizationEmpty
PixelGetColorNormalizationString
PixelSearchMinor change (returns Object){}
PostMessageNormalizationEmpty
ProcessNormalizationEmpty
ProgramFilesIdenticalString
ProgressNormalizationEmpty
RandomMajor changeNum/Empty
RegDeleteNormalizationEmpty
RegExMatch()Major changeNumber/{}
RegExReplace()Major changeString/{}
RegisterCallback()Cannot use yetN/A
RegReadNormalizationString
RegWriteNormalizationEmpty
ReloadNormalizationEmpty
Round()IdenticalNumber
RTrim()IdenticalString
RunNormalizationEmpty
RunAsNormalizationEmpty
RunWaitMajor change (doesn't return exit code)String
SB_SetIcon()IdenticalNumber
SB_SetParts()IdenticalNumber
SB_SetText()IdenticalNumber
SendNormalizationEmpty
SendEventNormalizationEmpty
SendInputNormalizationEmpty
SendLevelNormalizationEmpty
SendMessageNormalizationEmpty
SendModeNormalizationEmpty
SendPlayNormalizationEmpty
SendRawNormalizationEmpty
SetBatchLinesNormalizationEmpty
SetCapslockStateNormalizationEmpty
SetControlDelayNormalizationEmpty
SetDefaultMouseSpeedNormalizationEmpty
SetEnvNot needed (AHK specific)N/A
SetFormatNormalizationEmpty
SetKeyDelayNormalizationEmpty
SetMouseDelayNormalizationEmpty
SetNumLockStateNormalizationEmpty
SetRegViewNormalizationEmpty
SetScrollLockStateNormalizationEmpty
SetStoreCapslockModeNormalizationEmpty
SetTimerCannot use yetEmpty
SetTitleMatchModeNormalizationEmpty
SetWinDelayNormalizationEmpty
SetWorkingDirNormalizationEmpty
ShutdownNormalizationEmpty
Sin()IdenticalNumber
SleepNormalizationEmpty
SortMajor changeString
SoundBeepNormalizationEmpty
SoundGetNormalizationStr/Num
SoundGetWaveVolumeNormalizationNumber
SoundPlayNormalizationEmpty
SoundSetNormalizationEmpty
SoundSetWaveVolumeNormalizationEmpty
SplashImageNormalizationEmpty
SplashTextOffNormalizationEmpty
SplashTextOnNormalizationEmpty
SplitPathMinor change (returns Object){}
Sqrt()IdenticalNumber
StatusBarGetTextNormalizationString
StatusBarWaitNormalizationEmpty
StrGet()IdenticalString
StringCaseSenseNormalizationEmpty
StringGetPosNormalizationNumber
StringLeftNormalizationString
StringLenNormalizationString
StringLowerNormalizationString
StringMidNormalizationString
StringReplaceNormalizationString
StringRightNormalizationString
StringSplitNot needed (deprecated by StrSplit)N/A
StringTrimLeftNormalizationString
StringTrimRightNormalizationString
StringUpperNormalizationString
StrLen()IdenticalNumber
StrPut()IdenticalStr/Num
StrSplit()IdenticalArray
SubStr()IdenticalString
SuspendNormalizationEmpty
SysGetMinor change (returns Object)Str/Num/{}
Tan()IdenticalNumber
ThreadNormalizationEmpty
ToolTipNormalizationEmpty
TransformNormalizationStr/Num
TrayTipNormalizationEmpty
Trim()IdenticalString
TV_Add()IdenticalNumber
TV_Delete()IdenticalNumber
TV_Get()IdenticalNumber
TV_GetChild()IdenticalNumber
TV_GetCount()IdenticalNumber
TV_GetNext()IdenticalNumber
TV_GetParent()IdenticalNumber
TV_GetPrev()IdenticalNumber
TV_GetSelection()IdenticalNumber
TV_GetText()Major changeString/{}
TV_Modify()IdenticalNumber
TV_SetImageList()IdenticalNumber
UrlDownloadToFileNormalizationEmpty
VarSetCapacity()Cannot use yetN/A
WinActivateNormalizationEmpty
WinActivateBottomNormalizationEmpty
WinActive()IdenticalString
WinCloseNormalizationEmpty
WinExist()IdenticalString
WinGetMinor change (returns Object)Str/Num/{}
WinGetActiveStatsMinor change (returns Object){}
WinGetActiveTitleNormalizationString
WinGetClassNormalizationString
WinGetPosMinor change (returns Object){}
WinGetTextNormalizationString
WinGetTitleNormalizationString
WinHideNormalizationEmpty
WinKillNormalizationEmpty
WinMaximizeNormalizationEmpty
WinMenuSelectItemNormalizationEmpty
WinMinimizeNormalizationEmpty
WinMinimizeAllNormalizationEmpty
WinMinimizeAllUndoNormalizationEmpty
WinMoveNormalizationEmpty
WinRestoreNormalizationEmpty
WinSetNormalizationEmpty
WinSetTitleNormalizationEmpty
WinShowNormalizationEmpty
WinWaitNormalizationEmpty
WinWaitActiveNormalizationEmpty
WinWaitCloseNormalizationEmpty
WinWaitNotActiveNormalizationEmpty
#ClipboardTimeoutCannot use directivesN/A
#CommentFlagNot needed (AHK specific)N/A
#ErrorStdOutNot needed (AHK specific)N/A
#EscapeCharNot needed (AHK specific)N/A
#HotkeyIntervalCannot use directivesN/A
#HotkeyModifierTimeoutCannot use directivesN/A
#HotstringCannot use directives. TODO: implement "Hotstring()" by MenixatorN/A
#IfCannot use directives. Try "Hotkey()"+"if" instead.N/A
#IfTimeoutCannot use directives. Try "Hotkey()"+"if" instead.N/A
#IfWinActiveCannot use directives. Try "Hotkey()"+"if" instead.N/A
#IfWinExistCannot use directives. Try "Hotkey()"+"if" instead.N/A
#IncludeCannot use yet.N/A
#InputLevelCannot use directivesN/A
#InstallKeybdHookCannot use directivesN/A
#InstallMouseHookCannot use directivesN/A
#KeyHistoryCannot use directivesN/A
#LTrimNot needed (AHK specific)N/A
#MaxHotkeysPerIntervalCannot use directivesN/A
#MaxMemCannot use directivesN/A
#MaxThreadsCannot use directivesN/A
#MaxThreadsBufferCannot use directivesN/A
#MaxThreadsPerHotkeyCannot use directivesN/A
#MenuMaskKeyCannot use directivesN/A
#NoEnvNot needed (AHK specific)N/A
#NoTrayIconCannot use directives. Try "Menu()" instead.N/A
#PersistentCannot use directives. Try creating a (dummy) "hotkey()".N/A
#SingleInstanceCannot use directives. Try "Run" and "/restart" instead.N/A
#UseHookCannot use directives. Try "Hotkey($)" instead.N/A
#WarnNot needed (AHK specific)N/A
#WinActivateForceCannot use directivesN/A
~Addition: "Require()" (a globally scoped #Include)Empty

TODO