Write a autohotkey version 2 script that takes this precise macro, that works perfectly…
- User
Write a autohotkey version 2 script that takes this precise macro, that works perfectly when applied, and represent it more concise.
- because it needs to be mantainable and optimized.
- it needs also to work, so watch out for the correct syntax and the new autohotkey v2 code
#NoEnv SetWorkingDir %A_ScriptDir% CoordMode, Mouse, Window SendMode Input #SingleInstance Force SetTitleMatchMode 2 #WinActivateForce SetControlDelay 1 SetWinDelay 0 SetKeyDelay -1 SetMouseDelay -1 SetBatchLines -1
F3:: tabtab: BlockInput, MouseMove Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 100 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 100 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 30 Send, {Tab} Sleep, 30 Send, {F2} Sleep, 30 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 100 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 100 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 30 Send, {Tab} Sleep, 30 Send, {F2} Sleep, 30 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 100 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 100 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 30 Send, {Tab} Sleep, 30 Send, {F2} Sleep, 30 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 100 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 100 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 30 Send, {Tab} Sleep, 30 Send, {F2} Sleep, 30 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 100 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 100 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 30 Send, {Tab} Sleep, 30 Send, {F2} Sleep, 30 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 100 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 100 Send, {Tab} Sleep, 100 Send, {LAlt Down}{a} Sleep, 100 Send, {LAlt Up} Sleep, 30 Send, {Tab}{Space} BlockInput, MouseMoveOff Return
- Assistant
Here's a more concise and maintainable version of your AutoHotkey script rewritten for AutoHotkey v2:
#NoEnv SetWorkingDir A_ScriptDir CoordMode "Mouse", "Window" #SingleInstance Force SetTitleMatchMode 2 SetControlDelay 1 SetWinDelay 0 SetKeyDelay -1 SetMouseDelay -1 SetBatchLines -1 F3::tabtab() tabtab() { BlockInput "MouseMove" Loop 4 { executeBlock() } executeLastBlock() BlockInput "MouseMoveOff" } executeBlock() { Loop 3 { sendAltA() Sleep 100 Send "{Tab}" Sleep 100 } Sleep 30 Send "{Tab}" Sleep 30 Send "{F2}" Sleep 30 } executeLastBlock() { Loop 3 { sendAltA() if A_Index = 3 { Sleep 30 Send "{Tab}{Space}" } else { Sleep 100 Send "{Tab}" Sleep 100 } } } sendAltA() { Send "{LAlt Down}a" Sleep 100 Send "{LAlt Up}" }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.