diff --git a/AutoHotkey64.exe b/AutoHotkey64.exe index 50822a4..93095eb 100644 Binary files a/AutoHotkey64.exe and b/AutoHotkey64.exe differ diff --git a/UX/WindowSpy.ahk b/UX/WindowSpy.ahk index 9b918e3..6499a67 100644 --- a/UX/WindowSpy.ahk +++ b/UX/WindowSpy.ahk @@ -23,6 +23,8 @@ WinSpyGui() { oGui.OnEvent("Close",WinSpyClose) oGui.OnEvent("Size",WinSpySize) + oGui.SetFont('s9', "Segoe UI") + oGui.Add("Text",,"Window Title, Class and Process:") oGui.Add("Checkbox","yp xp+200 w120 Right vCtrl_FollowMouse","Follow Mouse").Value := 1 oGui.Add("Edit","xm w320 r5 ReadOnly -Wrap vCtrl_Title") diff --git a/UX/inc/identify_regex.ahk b/UX/inc/identify_regex.ahk index 952ed37..1706438 100644 --- a/UX/inc/identify_regex.ahk +++ b/UX/inc/identify_regex.ahk @@ -1,4 +1,4 @@ get_identify_regex() => ' ( -(?(DEFINE)(?(?(?m:^[ `t]*/\*(?:.*\R?)+?(?:[ `t]*\*/|.*\Z)))(?(?=[ `t]*+(?&line_comment)?(?m:$)))(?(?:(?&eol).*\R|(?&block_comment))++)(?(?:[^ `t`r`n]++|[ `t]*+(?!(?&eol)))*+)(?[ `t]*+\((?i:Join[^ `t`r`n]*+|(?&line_comment)|[^ `t`r`n()]++|[ `t]++)*+\R(?:[ `t]*+(?!\)).*\R)*+[ `t]*+\))(?[ `t]*+(?:,(?!::| +& )|[<>=/|^,?:\.+\-*&!~](?![^"'`r`n]*?(?:".*?::(?!.*?")|'.*?::(?!.*?')|::))|(?i:AND|OR)(?=[ `t])))(?(?&eol)(?:(?(?<=:=)|(?<=[:,]))|(?<=[<>=/|^,?:\.+\-*&!~](?(?&tosol)(?:(?&solcont)(?&subexp)|[ `t]*+,[ `t]*+(?=%)(?&pct)|(?&contsec)(?&ambig)))(?(?:.*+(?&v1_cont))*.*+)(?(?:(?&exp)|(?&v1_cont)|.*+)++(*:~))(?(?=%[ `t])(?:(?&subexp)(?&exp)|(?&v1_fin)(*:v1-pct)))(?(*:exp)(?&exp))(?(?&toeol)(?:(?&tosol)(?:(?&solcont)|(?&contsec))(?&v1_lines))?)(?(?=/|^,?:\.*&!~])(?\R(?:(?&contsec)|(?!(?&solcont))(*:v2-cbe)|))(?(?:[, `t]++|(?&enclf)|(?&subexp)|(?&line_comment))*+)(?%(?:[^,`r`n;\[\]{}()"%']*+|,(?![ `t]*+%)|(?&subexp))*+%(*:v2-pct)|=>(*:v2-fat))(?(?:(?!(?&otb))(?&eolcont)?[ `t]*+(?:[^ `t;,`r`n=\[\]{}()"%']++|\((?&encex)\)|\[(?&encex)\]|\{(?&encex)\}|(?>"(?>[^"``\r\n]|``["'``])*+"|'(?>[^'``\r\n]|``["'``])*+'(*:v2-sq))|'(?&tosol)(?&contsec)'(*:v2-sq)|(?(?:(?&subexp)|[ `t]*+,|(?&eol))++(?&otb)?))(?:[ `t]*+(?&line_comment)(*SKIP)(?!)|(?m:^)[ `t{}]*(?:(?m:^[ `t]*/\*(?:.*\R?)+?(?:[ `t]*\*/|.*\Z))(*SKIP)(?!)|(?:[<>*~$!^+#]*(?>\w+|[^ `t`r`n])|~?(?>\w+|[^ `t`r`n]) & ~?(?>\w+|[^ `t`r`n]))(?i:[ `t]+up)?::(?:[<>*~$!^+#]*(?>\w+|[^ `t`r`n])(?&eol)(*:remap?)|(?&eol)(?!(?&tosol)[ `t]*+(?:[\{#]|.*?::|[\w[:^ascii:]]++\())(*:v1-hk)|(*:hotkey))|(?(?=:[^\:`r`n]*[xX]):[[:alnum:]\?\*\- ]*:.*(?=/|^,?:\.+\-*&!~ `t()\[\]{}%]++|(?>"(?>[^"``\r\n]|``["'``])*+"|'(?>[^'``\r\n]|``["'``])*+'(*:v2-sq))|['"].*)*+(?=[ `t]*+(?:(?[\w[:^ascii:]#@$]++|%[\w[:^ascii:]#@$]++%)++(?:[ `t]++(?i:not[ `t]++)?(?i:in|contains|between)[ `t]++(?&v1_fin)(*:v1-if)|[ `t]*+(?:[<>]=?|!?=)(?&ambig))|(?&expm))|[\w[:^ascii:]]++(?:[ `t]*+=(?:>(?&ambig)|.*?\?.+?:.*(?&ambig)|(?&v1_fin)(*:v1-ass))|[\(\[](?=.*[\)\]][ `t`r`n]*\{)(?:[ `t]*+[\w[:^ascii:]]++[ `t]*+(?::=(?&subexp))?[ `t]*+,)*+[ `t]*+(?:(?i:ByRef)[ `t]++[\w[:^ascii:]](*:v1-ref)|&(*:v2-ref)|[\w[:^ascii:]]++[ `t]*+=(*:v1-def)|\*[ `t]*+[\)\]](*:v2-vfn)).*|(?=[\(\[\.\?]|[ `t]*+(?>[\:\+\-\*/\.\|&\^]|<<|>>|//)=)(?&expm)|,(?&v1_fin)(*:v1-cmd)|(?&eol)(?&ambig)|[ `t]++(?:[ `t]*+(?:\^|(?:(?!\{)[\w[:^ascii:]<>=/|^,?:\.+\-*&!~ `t()\[\]{}%]|(?>"(?>[^"``\r\n]|``["'``])*+"|'(?>[^'``\r\n]|``["'``])*+'(*:v2-sq)))*+\{[ `t]*+(?:\w+|.)(?:[ `t]++\w+)?[ `t]*+\})(?&v1_fin)(*:v1-send)|(?:[^`r`n,\[\]{}()"%']*+,[ `t]*+)*+(?&pct)|(?&ambig)(*:cmd?)))|(?:\+\+|--)(?&expm)|.(?&ambig)(*:!!))) +(?(DEFINE)(?(?(?m:^[ `t]*/\*(?:.*\R?)+?(?:[ `t]*\*/|.*\Z)))(?(?=[ `t]*+(?&line_comment)?(?m:$)))(?(?:(?&eol).*\R|(?&block_comment))++)(?(?:[^ `t`r`n]++|[ `t]*+(?!(?&eol)))*+)(?[ `t]*+\((?i:Join[^ `t`r`n]*+|(?&line_comment)|[^ `t`r`n()]++|[ `t]++)*+\R(?:[ `t]*+(?!\)).*\R)*+[ `t]*+\))(?[ `t]*+(?:,(?!::| +& )|[<>=/|^,?:\.+\-*&!~](?![^"'`r`n]*?(?:".*?::(?!.*?")|'.*?::(?!.*?')|::))|(?i:AND|OR)(?=[ `t])))(?(?&eol)(?:(?(?<=:=)|(?<=[:,]))|(?<=[<>=/|^,?:\.+\-*&!~](?(?&tosol)(?:(?&solcont)(?&subexp)|[ `t]*+,[ `t]*+(?=%)(?&pct)|(?&contsec)(?&ambig)))(?(?:.*+(?&v1_cont))*.*+)(?(?:(?&exp)|(?&v1_cont)|.*+)++(*:~))(?(?=%[ `t])(?:(?&subexp)(?&exp)|(?&v1_fin)(*:v1-pct)))(?(*:exp)(?&exp))(?(?&toeol)(?:(?&tosol)(?:(?&solcont)|(?&contsec))(?&v1_lines))?)(?(?=/|^,?:\.*&!~])(?\R(?:(?&contsec)|(?!(?&solcont))(*:v2-cbe)|))(?(?:[, `t]++|(?&enclf)|(?&subexp)|(?&line_comment))*+)(?%(?:[^,`r`n;\[\]{}()"%']*+|,(?![ `t]*+%)|(?&subexp))*+%(*:v2-pct)|=>(*:v2-fat))(?(?:(?!(?&otb))(?&eolcont)?[ `t]*+(?:[^ `t;,`r`n=\[\]{}()"%']++|\((?&encex)\)|\[(?&encex)\]|\{(?&encex)\}|(?>"(?>[^"``\r\n]|``["'``])*+"|'(?>[^'``\r\n]|``["'``])*+'(*:v2-sq))|'(?&tosol)(?&contsec)'(*:v2-sq)|(?(?:(?&subexp)|[ `t]*+,|(?&eol))++(?&otb)?))(?:[ `t]*+(?&line_comment)(*SKIP)(?!)|(?m:^)[ `t{}]*(?:(?m:^[ `t]*/\*(?:.*\R?)+?(?:[ `t]*\*/|.*\Z))(*SKIP)(?!)|(?:[<>*~$!^+#]*(?>\w+|[^ `t`r`n])|~?(?>\w+|[^ `t`r`n]) & ~?(?>\w+|[^ `t`r`n]))(?i:[ `t]+up)?::(?:[<>*~$!^+#]*(?>\w+|[^ `t`r`n])(?&eol)(*:remap?)|(?&eol)(?!(?&tosol)[ `t]*+(?:[\{#]|.*?::|[\w[:^ascii:]]++\())(*:v1-hk)|(*:hotkey))|(?(?=:[^\:`r`n]*[xX]):[[:alnum:]\?\*\- ]*:.*(?=/|^,?:\.+\-*&!~ `t()\[\]{}%]++|(?>"(?>[^"``\r\n]|``["'``])*+"|'(?>[^'``\r\n]|``["'``])*+'(*:v2-sq))|['"].*)*+(?=[ `t]*+(?:(?[\w[:^ascii:]#@$]++|%[\w[:^ascii:]#@$]++%)++(?:[ `t]++(?i:not[ `t]++)?(?i:in|contains|between)[ `t]++(?&v1_fin)(*:v1-if)|[ `t]*+(?:[<>]=?|!?=)(?&ambig))|(?&expm))|[\w[:^ascii:]]++(?:[ `t]*+=(?:>(?&ambig)|.*?\?.+?:.*(?&ambig)|(?&v1_fin)(*:v1-ass))|[\(\[](?=.*[\)\]][ `t`r`n]*\{)(?:[ `t]*+[\w[:^ascii:]]++[ `t]*+(?::=(?&subexp))?[ `t]*+,)*+[ `t]*+(?:(?i:ByRef)[ `t]++[\w[:^ascii:]](*:v1-ref)|&(*:v2-ref)|[\w[:^ascii:]]++[ `t]*+=(*:v1-def)|\*[ `t]*+[\)\]](*:v2-vfn)).*|(?=[\(\[\.\?]|[ `t]*+(?>[\:\+\-\*/\.\|&\^]|<<|>>|//)=)(?&expm)|,(?&v1_fin)(*:v1-cmd)|(?&eol)(?&ambig)|[ `t]++(?:[ `t]*+(?:\^|(?:(?!\{)[\w[:^ascii:]<>=/|^,?:\.+\-*&!~ `t()\[\]{}%]|(?>"(?>[^"``\r\n]|``["'``])*+"|'(?>[^'``\r\n]|``["'``])*+'(*:v2-sq)))*+\{[ `t]*+(?:\w+|.)(?:[ `t]++\w+)?[ `t]*+\})(?&v1_fin)(*:v1-send)|(?:[^`r`n,\[\]{}()"%']*+,[ `t]*+)*+(?&pct)|(?&ambig)(*:cmd?)))|(?:\+\+|--)(?&expm)|.(?&ambig)(*:!!))) )' diff --git a/UX/inc/ui-base.ahk b/UX/inc/ui-base.ahk index aafd37a..28c8b3c 100644 --- a/UX/inc/ui-base.ahk +++ b/UX/inc/ui-base.ahk @@ -1,129 +1,129 @@ -class AutoHotkeyUxGui extends Gui { - __new(title, opt:='') { - super.__new(opt, title, this) - this.SetFont('s9', "Segoe UI") - this.OnEvent('Escape', 'Destroy') - this.OnEvent('Close', 'Destroy') - } - - AddListMenu(options:='', columns:=unset) { - IsSet(columns) || columns := [] - c := this.AddListView(UxListMenu.DefaultOptions ' ' options, columns) - if !InStr(options, 'Theme') - DllCall("uxtheme\SetWindowTheme", "ptr", c.hwnd, "wstr", "Explorer", "ptr", 0) - static LVTVIM_TILESIZE := 1, LVTVIM_COLUMNS := 2, LVTVIM_LABELMARGIN := 4 - static LVTVIF_AUTOSIZE := 0, LVTVIF_EXTENDED := 4, LVTVIF_FIXEDHEIGHT := 2 - , LVTVIF_FIXEDSIZE := 3, LVTVIF_FIXEDWIDTH := 1 - static LVM_SETTILEVIEWINFO := 0x10A2 - tileviewinfo := Buffer(40, 0) - ControlGetPos(,, &w,, c) - pad := 2 * A_ScreenDPI // 96 - NumPut( - 'uint', 40, ; cbSize - 'uint', LVTVIM_LABELMARGIN | LVTVIM_TILESIZE, ; dwMask - 'uint', LVTVIF_FIXEDWIDTH, ; dwFlags - 'int', w, 'int', 0, ; sizeTile - 'int', 0, ; cLines - 'int', pad, 'int', pad, 'int', pad, 'int', pad, ; rcLabelMargin - tileviewinfo - ) - SendMessage LVM_SETTILEVIEWINFO,, tileviewinfo, c - c.base := UxListMenu.Prototype - return c - } - - AddIconButton(options, iconHandle, hiddenText:="") { - static BS_ICON := 0x40 - static BS_CENTER := 0x300 - static BS_VCENTER := 0xC00 - btn := this.AddButton((BS_ICON | BS_CENTER | BS_VCENTER) ' ' options, hiddenText) - static BM_SETIMAGE := 0xF7 - SendMessage(BM_SETIMAGE, 1, iconHandle, btn) - return btn - } - - FileSelect(p*) { - this.Opt '+OwnDialogs' - try - return FileSelect(p*) - finally - this.Opt '-OwnDialogs' - } - - static Show(p*) { - for w in WinGetList('ahk_pid ' ProcessExist()) - if (g := GuiFromHwnd(w)) && g.base = this.Prototype - return g.Show() - inst := this(p*) - inst.Show() - } -} - -class UxListMenu extends Gui.ListView { - static DefaultOptions := '-Multi Tile' - . ' R1' - . ' -E0x200' ; -WS_EX_CLIENTEDGE (remove border) - . ' LV0x14000' - . Format(' Background{:x}', DllCall("GetSysColor", "int", 15, "int")) ; COLOR_3DFACE - - Add(p*) { - i := super.Add(p*) - static LVM_SETTILEINFO := 0x10A4 - static LVCFMT_FILL := 0x200000 - static LVCFMT_WRAP := 0x400000 - tileinfo := Buffer(8 + 3*A_PtrSize, 0) - col := Buffer(4) - colf := Buffer(4) - NumPut("int", 1, col) - NumPut("int", LVCFMT_FILL | LVCFMT_WRAP, colf) - NumPut("int", tileinfo.size, "int", i-1, "uptr", 1, "ptr", col.ptr, "ptr", colf.ptr, tileinfo) - SendMessage(LVM_SETTILEINFO, 0, tileinfo, this) - return i - } - - _SetTileWidth(w) { - static LVTVIM_TILESIZE := 1, LVTVIM_COLUMNS := 2, LVTVIM_LABELMARGIN := 4 - static LVTVIF_AUTOSIZE := 0, LVTVIF_EXTENDED := 4, LVTVIF_FIXEDHEIGHT := 2 - , LVTVIF_FIXEDSIZE := 3, LVTVIF_FIXEDWIDTH := 1 - static LVM_SETTILEVIEWINFO := 0x10A2 - tileviewinfo := Buffer(40, 0) - pad := 2 * A_ScreenDPI // 96 - NumPut( - 'uint', 40, ; cbSize - 'uint', LVTVIM_LABELMARGIN | LVTVIM_TILESIZE, ; dwMask - 'uint', LVTVIF_FIXEDWIDTH, ; dwFlags - 'int', w, 'int', 0, ; sizeTile - 'int', 0, ; cLines - 'int', pad, 'int', pad, 'int', pad, 'int', pad, ; rcLabelMargin - tileviewinfo - ) - SendMessage LVM_SETTILEVIEWINFO,, tileviewinfo, this - } - - AutoSize(maxItems:=20) { - static LVM_GETITEMRECT := 0x100E, LVIR_BOUNDS := 0 - static SM_CXVSCROLL := 2 - - itemCount := this.GetCount() - - ; Keep control width and adjust tile width to avoid horizontal scrollbar. - ControlGetPos(,, &w,, this) - if itemCount > maxItems - w -= SysGet(SM_CXVSCROLL) - this._SetTileWidth(w) - - ; Adjust control height to fit content. - rect := Buffer(16, 0) - NumPut('int', LVIR_BOUNDS, rect) - SendMessage(LVM_GETITEMRECT, Min(itemCount, maxItems) - 1, rect.ptr, this) - iy := NumGet(rect, 4, 'int') - iw := NumGet(rect, 8, 'int') - ih := NumGet(rect, 12, 'int') - iy - ; Result needs additional padding. Testing showed the width returned was less - ; than what we set with LVM_SETTILEVIEWINFO. The amount of padding needed to - ; avoid scrollbars appeared to be exactly the amount to bring it up to the size - ; we specified, so perhaps something similar is happening with the height. - h := NumGet(rect, 12, 'int') + 4 - ControlMove(,,, h, this) - } +class AutoHotkeyUxGui extends Gui { + __new(title, opt:='') { + super.__new(opt, title, this) + this.SetFont('s9', "Segoe UI") + this.OnEvent('Escape', 'Destroy') + this.OnEvent('Close', 'Destroy') + } + + AddListMenu(options:='', columns:=unset) { + IsSet(columns) || columns := [] + c := this.AddListView(UxListMenu.DefaultOptions ' ' options, columns) + if !InStr(options, 'Theme') + DllCall("uxtheme\SetWindowTheme", "ptr", c.hwnd, "wstr", "Explorer", "ptr", 0) + static LVTVIM_TILESIZE := 1, LVTVIM_COLUMNS := 2, LVTVIM_LABELMARGIN := 4 + static LVTVIF_AUTOSIZE := 0, LVTVIF_EXTENDED := 4, LVTVIF_FIXEDHEIGHT := 2 + , LVTVIF_FIXEDSIZE := 3, LVTVIF_FIXEDWIDTH := 1 + static LVM_SETTILEVIEWINFO := 0x10A2 + tileviewinfo := Buffer(40, 0) + ControlGetPos(,, &w,, c) + pad := 2 * A_ScreenDPI // 96 + NumPut( + 'uint', 40, ; cbSize + 'uint', LVTVIM_LABELMARGIN | LVTVIM_TILESIZE, ; dwMask + 'uint', LVTVIF_FIXEDWIDTH, ; dwFlags + 'int', w, 'int', 0, ; sizeTile + 'int', 0, ; cLines + 'int', pad, 'int', pad, 'int', pad, 'int', pad, ; rcLabelMargin + tileviewinfo + ) + SendMessage LVM_SETTILEVIEWINFO,, tileviewinfo, c + c.base := UxListMenu.Prototype + return c + } + + AddIconButton(options, iconHandle, hiddenText:="") { + static BS_ICON := 0x40 + static BS_CENTER := 0x300 + static BS_VCENTER := 0xC00 + btn := this.AddButton((BS_ICON | BS_CENTER | BS_VCENTER) ' ' options, hiddenText) + static BM_SETIMAGE := 0xF7 + SendMessage(BM_SETIMAGE, 1, iconHandle, btn) + return btn + } + + FileSelect(p*) { + this.Opt '+OwnDialogs' + try + return FileSelect(p*) + finally + this.Opt '-OwnDialogs' + } + + static Show(p*) { + for w in WinGetList('ahk_pid ' ProcessExist()) + if (g := GuiFromHwnd(w)) && g.base = this.Prototype + return g.Show() + inst := this(p*) + inst.Show() + } +} + +class UxListMenu extends Gui.ListView { + static DefaultOptions := '-Multi Tile' + . ' R1' + . ' -E0x200' ; -WS_EX_CLIENTEDGE (remove border) + . ' LV0x14000' + . Format(' Background{:x}', DllCall("GetSysColor", "int", 15, "int")) ; COLOR_3DFACE + + Add(p*) { + i := super.Add(p*) + static LVM_SETTILEINFO := 0x10A4 + static LVCFMT_FILL := 0x200000 + static LVCFMT_WRAP := 0x400000 + tileinfo := Buffer(8 + 3*A_PtrSize, 0) + col := Buffer(4) + colf := Buffer(4) + NumPut("int", 1, col) + NumPut("int", LVCFMT_FILL | LVCFMT_WRAP, colf) + NumPut("int", tileinfo.size, "int", i-1, "uptr", 1, "ptr", col.ptr, "ptr", colf.ptr, tileinfo) + SendMessage(LVM_SETTILEINFO, 0, tileinfo, this) + return i + } + + _SetTileWidth(w) { + static LVTVIM_TILESIZE := 1, LVTVIM_COLUMNS := 2, LVTVIM_LABELMARGIN := 4 + static LVTVIF_AUTOSIZE := 0, LVTVIF_EXTENDED := 4, LVTVIF_FIXEDHEIGHT := 2 + , LVTVIF_FIXEDSIZE := 3, LVTVIF_FIXEDWIDTH := 1 + static LVM_SETTILEVIEWINFO := 0x10A2 + tileviewinfo := Buffer(40, 0) + pad := 2 * A_ScreenDPI // 96 + NumPut( + 'uint', 40, ; cbSize + 'uint', LVTVIM_LABELMARGIN | LVTVIM_TILESIZE, ; dwMask + 'uint', LVTVIF_FIXEDWIDTH, ; dwFlags + 'int', w, 'int', 0, ; sizeTile + 'int', 0, ; cLines + 'int', pad, 'int', pad, 'int', pad, 'int', pad, ; rcLabelMargin + tileviewinfo + ) + SendMessage LVM_SETTILEVIEWINFO,, tileviewinfo, this + } + + AutoSize(maxItems:=20) { + static LVM_GETITEMRECT := 0x100E, LVIR_BOUNDS := 0 + static SM_CXVSCROLL := 2 + + itemCount := this.GetCount() + + ; Keep control width and adjust tile width to avoid horizontal scrollbar. + ControlGetPos(,, &w,, this) + if itemCount > maxItems + w -= SysGet(SM_CXVSCROLL) + this._SetTileWidth(w) + + ; Adjust control height to fit content. + rect := Buffer(16, 0) + NumPut('int', LVIR_BOUNDS, rect) + SendMessage(LVM_GETITEMRECT, Min(itemCount, maxItems) - 1, rect.ptr, this) + iy := NumGet(rect, 4, 'int') + iw := NumGet(rect, 8, 'int') + ih := NumGet(rect, 12, 'int') - iy + ; Result needs additional padding. Testing showed the width returned was less + ; than what we set with LVM_SETTILEVIEWINFO. The amount of padding needed to + ; avoid scrollbars appeared to be exactly the amount to bring it up to the size + ; we specified, so perhaps something similar is happening with the height. + h := NumGet(rect, 12, 'int') + 4 + ControlMove(,,, h, this) + } } \ No newline at end of file diff --git a/UX/install-version.ahk b/UX/install-version.ahk index b470a5e..0ae3d45 100644 --- a/UX/install-version.ahk +++ b/UX/install-version.ahk @@ -33,7 +33,7 @@ InstallAutoHotkey(version) { if req.status != 200 throw Error(req.status ' - ' req.statusText, -1) currentVersion := req.responseText - if VerCompare(currentVersion, baseVersion) < 0 || VerCompare(currentVersion, Round(baseVersion + 1)) >= 0 + if !(currentVersion ~= '^\Q' baseVersion '\E\b') abort "An error occurred while trying to identify the latest available version. The downloaded version.txt was invalid.", currentVersion version := currentVersion } diff --git a/UX/install.ahk b/UX/install.ahk index 7be51a9..c68662f 100644 --- a/UX/install.ahk +++ b/UX/install.ahk @@ -891,9 +891,10 @@ class Installation { MakeUIA(baseFile) { SplitPath baseFile,, &baseDir,, &baseName baseDir := baseDir = '.' ? '' : baseDir '\' - FileCopy baseFile, newPath := baseDir baseName '_UIA.exe', true + newPath := baseDir baseName '_UIA.exe' static abort := false ; Let "Abort" disable MakeUIA calls, but let other PostActions complete. while !abort { + FileCopy baseFile, newPath, true try { EnableUIAccess newPath break @@ -907,7 +908,7 @@ class Installation { break Sleep 500 } - switch MsgBox("Unable to create " baseName ". Try adding an exclusion in your antivirus software. If that doesn't work, please report the issue.`n`nError: " e.Message + switch MsgBox("Unable to create " baseName "_UIA.exe. Try adding an exclusion in your antivirus software. If that doesn't work, please report the issue.`n`nError: " e.Message ,, "a/r/i") { case "Abort": abort := true case "Ignore": break @@ -945,6 +946,9 @@ class Installation { if ConfigRead('Launcher\v1', 'UTF8', '') = '' && InStr(RegRead('HKCR\' this.ScriptProgId '\Shell\Open\Command',, ''), '/cp65001 ') ConfigWrite(true, 'Launcher\v1', 'UTF8') + + if FileExist('Compiler\Ahk2Exe.exe') + this.CreateCompilerShortcut ; Record these for Uninstall add 'AutoHotkey{1}.exe', '', 'A32', 'U32', 'U64', 'A32_UIA', 'U32_UIA', 'U64_UIA' diff --git a/UX/launcher.ahk b/UX/launcher.ahk index d73adfa..ae38333 100644 --- a/UX/launcher.ahk +++ b/UX/launcher.ahk @@ -62,7 +62,7 @@ Main() { GetLaunchParameters(ScriptPath, interactive:=false) { code := FileRead(ScriptPath, 'UTF-8') require := prefer := rule := exe := "" - if RegExMatch(code, 'im)^[ `t]*#Requires[ `t]+AutoHotkey[ `t]+([^;`r`n]*)(?:[ `t]*;[ `t]*prefer[ `t]+([^;`r`n\.]+))?', &m) { + if RegExMatch(code, 'im)^[ `t]*#Requires[ `t]+AutoHotkey[ `t]+([^;`r`n]*?)[ `t]*(?:;[ `t]*prefer[ `t]+([^;`r`n\.]+))?(?:$|;)', &m) { trace "![Launcher] " m.0 require := RegExReplace(m.1, '[^\s,]\K\s+(?!$)', ",") prefer := RegExReplace(m.2, '[^\s,]\K\s+(?!$)', ",")