g00001
2021-09-17 12:16:07 +08:00
作为 Windows 开发工具,就说说调用 API 这种简单的事,aardio 代码这样:
var fileTime = {
int lowDateTime;
int highDateTime;
}
::Kernel32.SystemTimeToFileTime( time(),fileTime )
AutoIt 代码这样:
$SYSTEMTIME = DllStructCreate("ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort")
$lpSYSTEMTIME = DllStructGetPtr($SYSTEMTIME)
$LOCALFILETIME=DllStructCreate("dword;dword")
$lpLOCALFILETIME = DllStructGetPtr($LOCALFILETIME)
DllStructSetData($SYSTEMTIME, 1, $Year)
DllStructSetData($SYSTEMTIME, 2, $Month)
DllStructSetData($SYSTEMTIME, 3, _DateToDayOfWeek($Year,$Month,$Day)-1)
DllStructSetData($SYSTEMTIME, 4, $Day)
DllStructSetData($SYSTEMTIME, 5, $Hour)
DllStructSetData($SYSTEMTIME, 6, $Minute)
DllStructSetData($SYSTEMTIME, 7, 0)
DllStructSetData($SYSTEMTIME, 8, 0)
$result = DllCall("kernel32.dll", "long", "SystemTimeToFileTime", "ptr", $lpSystemTime, "ptr", $lpLocalFileTime)
If $result[0] = 0 Then
Local $lastError = DllCall("kernel32.dll", "int", "GetLastError")
SetExtended($lastError[0])
SetError(1)
Return 0
EndIf
AutoHotkey 代码这样:
VarSetCapacity(MyFiletime , 64, 0)
VarSetCapacity(MySystemtime, 32, 0)
DayOfWeek=00
Second=00
Millisecond=00
InsertInteger(Year, MySystemtime, 0)
InsertInteger(Month, MySystemtime, 2)
InsertInteger(DayOfWeek, MySystemtime, 4)
InsertInteger(Day, MySystemtime, 6)
InsertInteger(Hour, MySystemtime,8)
InsertInteger(Min, MySystemtime,10)
InsertInteger(Second, MySystemtime,12)
InsertInteger(Millisecond, MySystemtime,14)
DllCall("SystemTimeToFileTime", Str, MySystemtime, UInt, &MyFiletime)
LocalFiletime := ExtractInteger(MyFiletime, 0, false, 64)
VarSetCapacity(MyUTCFiletime , 64, 0)
DllCall("LocalFileTimeToFileTime", Str, MyFiletime, UInt, &MyUTCFiletime)
UTCFiletime := ExtractInteger(MyUTCFiletime, 0, false, 64)
AutoHotkey,AutoIt 写代码其实啰嗦又费事 ,
当然 AutoHotkey 实现简单的热键功能是不错。
aardio 还提供了一个 ahk 扩展库,可以嵌入 AutoHotkey 代码,aardio 与 AutoHotkey 可以相互调用对方的函数。另外 aardio 还可以嵌入十几种其他的第三方编程语言。