RE: wm_mouseWhell, highword and lowWord, jaws scripting and some related questions

  • From: "Jamal Mazrui" <Jamal.Mazrui@xxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 7 Feb 2008 11:12:19 -0500

In case this helps, below are custom JAWS scripting functions (from the
Homer script library) that work with decimal/hex conversions and
low/high words in any JAWS version.

Jamal

String Function MathDecIntToHexString(Int iDec)
;Convert decimal integer to hex string
Var
Int iLeadingZero, Int i, Int iPower, Int iDiv,
String s, String sLookup, String sReturn

Let iLeadingZero = True
Let sReturn = "0x"
Let sLookup = "123456789abcdef"
Let iPower = 7
While iPower >= 0
Let iDiv = MathIntToPower(16, iPower)
Let i = iDec / iDiv
If i Then
Let s = Substring(sLookup, i, 1)
Let iLeadingZero = False
Else
Let s = "0"
EndIf
If !iLeadingZero Then
Let sReturn = sReturn + s
EndIf
Let iDec = iDec % iDiv
Let iPower = iPower - 1
EndWhile
Return sReturn
EndFunction

Int Function MathHexStringToDecInt(String sHex)
;Convert hex string to decimal integer
Var
Int iReturn, Int i, Int iPower,
String s, String sLookup

Let sLookup = "123456789abcdef"
Let sHex = StringLower(sHex)
If StringLeft(sHex, 2) == "0x" Then
Let sHex = StringChopLeft(sHex, 2)
EndIf
Let sHex = StringRight("0x0000000" + sHex, 8)

Let iPower = 7
While iPower >= 0
Let s = SubString(sHex, 8 - iPower, 1)
Let i = StringContains(sLookup, s)
Let iReturn = iReturn + i * MathIntToPower(16, iPower)
Let iPower = iPower - 1
EndWhile
Return iReturn
EndFunction

Int Function MathHighWord(Int iDec)
;Get high word of an integer
Var
Int i, Int iPower, Int iDiv, Int iReturn

Let iPower = 7
While iPower >= 4
Let iDiv = MathIntToPower(16, iPower)
Let i = iDec / iDiv
Let iReturn = iReturn + i * MathIntToPower(16, iPower - 4)
Let iDec = iDec % iDiv
Let iPower = iPower - 1
EndWhile
Return iReturn
EndFunction

Int Function MathIntToPower(Int i, Int iPower)
;Get result of a number raised to a power
Var
Int iReturn

Let iReturn = 1
While iPower > 0
Let iReturn = iReturn * i
Let iPower = iPower - 1
EndWhile
Return iReturn
EndFunction

Int Function MathLowWord(Int iDec)
;Get low word of an integer
Var
Int iPower, Int iDiv, Int iReturn

Let iPower = 4
Let iDiv = MathIntToPower(16, iPower)
Let iReturn = iDec % iDiv
Return iReturn
EndFunction
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: