Skip to content

Instantly share code, notes, and snippets.

@samthecodingman
Created November 21, 2018 19:02
Show Gist options
  • Save samthecodingman/bed5cbed1cebe0f794f3d47b76d20661 to your computer and use it in GitHub Desktop.
Save samthecodingman/bed5cbed1cebe0f794f3d47b76d20661 to your computer and use it in GitHub Desktop.
AutoHotkey function to create an array of command line arguments whilst maintaining compatibility with AHK v1.0.90+
; [COMPATIBILITY FUNCTION] Get command line arguments as an array (AHK v1.0.90+)
; by @samthecodingman [MIT License]
; You can use A_Args directly if using AHK v1.1.27 or later.
GetArgsArray() {
static _arr
global ; Give access to %0%, %1%, %2%, etc. for before v1.1.27
if (not _arr)
_arr := A_Args ; shortcut for v1.1.27+
if (not _arr) {
_arr:=[]
Loop, %0%
_arr.Insert(%A_Index%) ; deprecated, but here for compatibility with v1.0.90-v1.1.27
}
return _arr
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment