Author |
Topic |
|
Kingron
39 Posts |
Posted - 03/03/2012 : 01:42:13
|
I'd like to have some API to know the OS version/platform and S+ version, so We might using some different API or logic to do something. For example, we might do different at Windows XP and Windows Vista or Windows 7.
Also if we can provider an API for debug info output is great. For example, we should provider an API acDebugPrint(string) and this API invoke the system API OutputDebugString to print string. The develop could using the DbgView to check the ouput logs. This is useful for debug the script. |
Edited by - Kingron on 03/03/2012 07:18:25 |
|
Rob
USA
2615 Posts |
|
Rob
USA
2615 Posts |
Posted - 03/03/2012 : 10:08:28
|
You should be able to call OutputDebugString via Alien as well, but I haven't looked into it. Note that I'm very much an Alien novice, I just built it into S+ for folks to use instead of building new actions for every little request...don't want to reproduce the whole Windows API! =) |
|
|
Kingron
39 Posts |
Posted - 03/03/2012 : 14:08:28
|
Great!
I put below script slice into Strokesplus.lua, and reload the config, it works for me:
API = alien.core local floor = math.floor
function xor(a, b) local r = 0 for i = 0, 31 do local x = a / 2 + b / 2 if x ~= floor (x) then r = r + 2^i end a = floor (a / 2) b = floor (b / 2) end return r end
function band(a,b) return ((a+b) - xor(a,b))/2 end
function shl(x, by) return x * 2 ^ by end
function shr(x, by) return floor(x / 2 ^ by) end
local mb = API.load("kernel32.dll") local GetVersion = mb.GetVersion GetVersion:types{ ret = 'uint', abi = 'stdcall'} local iVersion = GetVersion() OS_MAJOR_VER = band(band(iVersion,65535),255) OS_MINOR_VER = band(shr(band(iVersion,65535),8),255)
mb = API.load("kernel32.dll") acDebugPrint = mb.OutputDebugStringA acDebugPrint:types{ ret = 'void', abi = 'stdcall', 'string' }
Test action script
acSendKeys("{BEEP 1400 100}") acDebugPrint("test debug print") acDebugPrint(OS_MAJOR_VER) acDebugPrint(OS_MINOR_VER) acDebugPrint("==end==")
|
|
|
|
Topic |
|
|
|