InTouch Battery Status Script Functions

Installing the Battery Status Script Functions


Download
the WW2kscriptfuncs.zip file


Extract the files WW2kscriptfuncs.dll and
WW2kscriptfuncs.wdf.   The WW2KScriptfuncs.Dll and
WW2KScriptfuncs.Wdf files must be in the InTouch folder for the contained
InTouch script functions to work correctly.


WWSFGetLinePowerStatus() Description


WWSFGetLinePowerStatus() allows the user to determine if the local
computer is running from the AC line power or from the battery using an InTouch
script.


Use


WWSFGetLinePowerStatus();


Returns


Returns an integer value. The return value is 1 to indicate the
computer is running on AC Line power.  The return value is 0 to
indicate the computer is running from the battery.  Any return value less
than 0 is to be interpreted as an error, meaning that the status of the
battery could not be determined.  The return value should be assigned to a
Memory Integer tag.


Example


The following is a script that determines if the computer is running from the
AC line power:


iACLinePower = WWSFGetLinePowerStatus();


WWSFGetBatteryChargeStatus() Description


WWSFGetBatteryChargeStatus() allows the user to determine the battery
charge status of the local computer using an InTouch script.


Use


WWSFGetBatteryChargeStatus();


Returns


Returns an integer value. 



  • The return value is 1 to indicate the battery charge status is
    high.
  • The return value is 2 to indicate the battery charge status is low.

  • The return value is 4 to indicate the battery charge status is
    critically low.
  • The return value is 8 to indicate the battery charge status is
    charging.
  • The return value is 128 to indicate the battery is not present.

Any return value less than 0 is to be interpreted as an error, meaning
that the status of the battery could not be determined. The return value should
be assigned to a Memory Integer tag.


Example


The following is a script that determines the status of the computer
battery:


iBatteryStatus = WWSFGetBatteryChargeStatus();


WWSFGetBatteryLifePercent() Description


WWSFGetBatteryLifePercent() allows the user to determine the remaining
battery power as a percent of its full power using an InTouch script.


Use


WWSFGetBatteryLifePercent();


Returns


Returns an integer value. The return value indicates the battery power
remaining as a percentage of its full value. Any return value less than
0 is to be interpreted as an error, meaning that the status of the
battery could not be determined. The return value should be assigned to a
Memory Integer tag.


Example


The following is a script that determines the percentage of battery power
remaining:


iBatteryPercent = WWSFGetBatteryLifePercent();


WWSFGetBatteryLifetime() Description


WWSFGetBatteryLifetime() allows the user to determine the remaining
battery lifetime using an InTouch script.


Use


WWSFGetBatteryLifetime();


Returns


Returns an integer value. The return value indicates the battery’s remaining
lifetime. Any return value less than 0 is to be interpreted as an
error, meaning that the status of the battery could not be determined. The
return value should be assigned to a Memory Integer tag.


The value returned is clamped so that it will not be larger than
0x0000EFFF or 61439 decimal. Depending upon the computer’s
BIOS and the technology level of the battery subsystem, this value might not
have relevance.


Example


The following is a script that determines the computer battery’s remaining
lifetime:


iBatteryRemaining = WWSFGetBatteryLifetime();


WWSFGetBatteryFullLifetime() Description


WWSFGetBatteryFullLifetime() allows the user to determine the fully
charged battery lifetime using an InTouch script.


Use


WWSFGetBatteryFullLifetime();


Returns


Returns an integer value. The return value indicates the battery’s fully
charged lifetime. Any return value less than 0 is to be interpreted
as an error, meaning that the status of the battery could not be
determined. The return value should be assigned to a memory integer tag.
The value returned is clamped so that it will not be larger than
0x0000EFFF or 61439 decimal. Depending upon the computer’s
BIOS and the technology level of the battery subsystem, this value might not
have relevance.


Example


The following is a script that determines the computer battery’s remaining
lifetime:


iBatteryLifetime = WWSFGetBatteryFullLifetime();


Probable Reasons For Failure


There are many reasons this function can fail and return a value of less than
0, and this list attempts to document some of them:



  • There is no battery installed on your computer.
  • The battery does not report its status to the PC BIOS.
  • The PC BIOS can not interpret the battery status and report the status to
    Windows.
  • The software drivers for your battery status are not installed or are
    incorrect.

Leave a Reply

Your email address will not be published. Required fields are marked *

6 + 3 =