#NoEnv #NoTrayIcon #SingleInstance force ;~ Send {Alt Down} ;~ Sleep, 20 #IfWinActive ahk_class TTOTAL_CMD #0::SendTCUserCommand("em_To7zip") return ;~ WinWait, ahk_class AutoIt v3 GUI ;~ Send {Alt Up} SendTCUserCommand(Command) ; string { If Command <> { VarSetCapacity(CopyDataStruct, 3*A_PtrSize, 0) ; Set up the structure's memory area. dwData := Asc("E") + 256 * Asc("M") NumPut(dwData, CopyDataStruct, 0) cbData := StrPutVar(Command, Command, "cp0") NumPut(cbData, CopyDataStruct, A_PtrSize) ; OS requires that this be done. NumPut(&Command, CopyDataStruct, 2*A_PtrSize) ; Set lpData to point to the string itself. SendMessage, 0x4a, 0, &CopyDataStruct,, ahk_class TTOTAL_CMD ; 0x4a is WM_COPYDATA. Must use Send not Post. } } StrPutVar(string, ByRef var, encoding) { ; Ensure capacity. VarSetCapacity( var, StrPut(string, encoding) * ((encoding="utf-16"||encoding="cp1200") ? 2 : 1) ) ; Copy or convert the string. return StrPut(string, &var, encoding) }
FROM:http://ahk8.com/thread-3677.html (这个不支持Unicode版的AHK)
http://forum.ru-board.com/topic.cgi?forum=5&topic=45288&start=1030&limit=1&m=1 (支持Unicode)