This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Feature Updates
 Closed or Deferred Requests
 [ALIEN SCRIPT] S+ and OS Version API
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Kingron

39 Posts

Posted - 03/03/2012 :  01:42:13  Show Profile
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

Posted - 03/03/2012 :  09:58:20  Show Profile  Visit Rob's Homepage
See this topic to get OS version via Alien. You can make almost any API call via Alien, which is built into S+ =)

http://www.strokesplus.com/forum/topic.asp?TOPIC_ID=272
Go to Top of Page

Rob

USA
2615 Posts

Posted - 03/03/2012 :  10:08:28  Show Profile  Visit Rob's Homepage
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! =)
Go to Top of Page

Kingron

39 Posts

Posted - 03/03/2012 :  14:08:28  Show Profile
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==")
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000