[jawsscripts] Re: to make laptop battery say

  • From: Doug Lee <doug.lee@xxxxxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Sat, 24 May 2008 06:48:42 -0400

The file you put this in should contain a line that says

        include "hjconst.jsh"

The OT_User_Requested_Information constant is defined in
hjconst.jsh.  I don't remember which JAWS version first included that
constant, but you say you're using JAWS 9 anyway.

On Sat, May 24, 2008 at 03:49:18PM +1000, Scott Erichsen wrote:
Doug,

Thanks for this, but it still won't compile. I have put a blank line before
and after the lines that are refusing to compile.

I didn't think OT_USER_REQUESTED_INFORMATION was a variable


script sayBatteryLevel()
var
        handle hwnd
if !isSameScript() then
        performScript sayBatteryLevel()
        return
endIf
let hwnd = findTopLevelWindow("SystemTray_Main", "")
if hwnd then
        let hwnd = getLastWindow(getFirstChild(hwnd))  ; Dialog containing
details
        let hwnd = getFirstChild(hwnd)
        while hwnd && !stringContains(getWindowName(hwnd), "%")
                let hwnd = getNextWindow(hwnd)
        endWhile
        if stringContains(getWindowName(hwnd), "%") then
                ; Say total remaining battery power percentage, even if on
AC power.

                sayMessage(OT_User_Requested_Information,
getWindowName(hwnd))

                ; Then say "AC Power" or "Batteries" to indicate which is in
effect.

                sayMessage(OT_User_Requested_Information,
getWindowName(getNextWindow(hwnd)))

        endIf
        let hwnd = getLastWindow(hwnd)  ; Time remaining
        sayMessage(OT_User_Requested_Information, getWindowName(hwnd))
        return
endIf
performScript sayBatteryLevel()
endScript

-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Doug Lee
Sent: Saturday, 24 May 2008 9:15 AM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: to make laptop battery say

Ah, nope, the problem isn't missing brackets.  Some lines wrapped when
I pasted that script, and I didn't notice.  Here's the same script
without wrapped lines, at least I'm not letting them wrap at this
end...

script sayBatteryLevel()
var
        handle hwnd
if !isSameScript() then
        performScript sayBatteryLevel()
        return
endIf
let hwnd = findTopLevelWindow("SystemTray_Main", "")
if hwnd then
        let hwnd = getLastWindow(getFirstChild(hwnd))  ; Dialog containing
details
        let hwnd = getFirstChild(hwnd)
        while hwnd && !stringContains(getWindowName(hwnd), "%")
                let hwnd = getNextWindow(hwnd)
        endWhile
        if stringContains(getWindowName(hwnd), "%") then
                ; Say total remaining battery power percentage, even if on
AC power.
                sayMessage(OT_User_Requested_Information,
getWindowName(hwnd))
                ; Then say "AC Power" or "Batteries" to indicate which is in
effect.
                sayMessage(OT_User_Requested_Information,
getWindowName(getNextWindow(hwnd)))
        endIf
        let hwnd = getLastWindow(hwnd)  ; Time remaining
        sayMessage(OT_User_Requested_Information, getWindowName(hwnd))
        return
endIf
performScript sayBatteryLevel()
endScript


On Sat, May 24, 2008 at 08:55:52AM +1000, Scott Erichsen wrote:
Doug,

The code you sent doesn't compile and I cant figure out why.
I think there's some brackets missing.

Scott


-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx
[mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Doug Lee
Sent: Friday, 23 May 2008 7:46 PM
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: to make laptop battery say

I have run with the following script in my custom default.jss for
quite a while now.  It lets a single SayBatteryLevel (Shift+JAWSKey+B)
command run the original JAWS code but runs custom code if you type
the command twice quickly.  I wrote this a while back for myself
because sometimes JAWS is unable to find the battery information on my
laptop.  It will attempt to say three things, in this order:
Percentage of battery power remaining even if running on AC, then
current power source (AC Power or batteries), then time remaining
("unknown" when on AC power generally).

script sayBatteryLevel()
var
        handle hwnd
if !isSameScript() then
        performScript sayBatteryLevel()
        return
endIf
let hwnd = findTopLevelWindow("SystemTray_Main", "")
if hwnd then
        let hwnd = getLastWindow(getFirstChild(hwnd))  ; Dialog containing
details
        let hwnd = getFirstChild(hwnd)
        while hwnd && !stringContains(getWindowName(hwnd), "%")
                let hwnd = getNextWindow(hwnd)
        endWhile
        if stringContains(getWindowName(hwnd), "%") then
                ; Say total remaining battery power percentage, even if on
AC power.
                sayMessage(OT_User_Requested_Information,
getWindowName(hwnd))
                ; Then say "AC Power" or "Batteries" to indicate which is in
effect.
                sayMessage(OT_User_Requested_Information,
getWindowName(getNextWindow(hwnd)))
        endIf
        let hwnd = getLastWindow(hwnd)  ; Time remaining
        sayMessage(OT_User_Requested_Information, getWindowName(hwnd))
        return
endIf
performScript sayBatteryLevel()
endScript


On Fri, May 23, 2008 at 12:18:35PM +0300, Can K?rca wrote:
hi friends,
I'm using jaws 9.0 and turkish version windows.
the jaws  that I'm using doesn't say the battery state.
when i try to make it say, jaws says; "battery status not found"
what shall i do?
i would be glad if you could help me.
Can K?rca 

__________?
View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

-- 
Doug Lee, Senior Accessibility Programmer
SSB BART Group
mailto:doug.lee@xxxxxxxxxxxxxxxx  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________ 
View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

__________?
View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

-- 
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:doug.lee@xxxxxxxxxxxxxxxx  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________ 
View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

__________?
View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

-- 
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:doug.lee@xxxxxxxxxxxxxxxx  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________ 
View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: