[jawsscripts] Re: Reading changed volues automatically
- From: "Martin Slack" <m.g.slack@xxxxxxxxxxxx>
- To: "JAWSScripts" <jawsscripts@xxxxxxxxxxxxx>
- Date: Thu, 6 Jan 2011 16:29:38 -0000
Ok, now bearing in mind that I don't have the application that will produce
a stream of steadily increasing numbers to test my code, here is my attempt
to poll the screen and announce when the numbers change: As well as the
function which actually looks for the numbers, I have included two scripts,
one to start the monitoring process, and one to stop it.
; define some global constants
Globals
int giRunning,
int giThisNumber,
int giLastNumber
;note - attach this script to a key using the control+d dialog
Script startMonitoring ()
saystring ("starting")
;start the monitorNumbers function after a short delay
giRunning = ScheduleFunction ("monitorNumbers", 2)
EndScript
Void Function monitorNumbers ()
; look for the string - beware this line is wrapped - make it one line
if (FindString (GetFocus (), "Visitors In Site", S_TOP, S_UNRESTRICTED,
false)) then
; move along to where the number is
NextWord ()
NextWord ()
NextWord ()
; read the number and turn it into an integer
giThisNumber = StringToInt (GetWord ())
; check to see if the number has changed
if (giThisNumber != giLastNumber) then
; if it has changed, make a note of the latest number
giLastNumber = giThisNumber
; and speak the new number
SayInteger (giThisNumber)
endif
else
; if necessary, say you couldn't find the string
SayString ("missed it")
endif
; finally, schedule the same function to run again after 30 seconds
giRunning = ScheduleFunction ("monitorNumbers", 300)
; the findString function uses the Jaws cursor
; so revert to PC cursor for next 30 seconds
PCCursor ()
EndFunction
; just to be tidy, this will stop the schedule loop running
Script stopMonitoring ()
SayString ("stop monitoring")
UnScheduleFunction (giRunning)
EndScript
Let me know how you get on. You may want to play with the scheduled delay
in the main loop (300 is equivalent to 30 seconds). Also I don't know what
you will be doing on the screen while this loop is running in the
background. It may help to look at the final parameter of the FindString
function if the string you are searching for is obscured, although this is a
recent feature I haven't used myself.
Good Luck,
Martin
----- Original Message -----
From: "Can Kirca" <cankirca@xxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Thursday, January 06, 2011 1:26 PM
Subject: [jawsscripts] Re: Reading changed volues automatically
> Hi martin,
> this is the copy of line:
> Filter: Visitors In Site: 0 Waiting For Chat:0 Chat: Online
>
> these numbers are changeable
> but texts are static (Filter: Visitors In Site:, wating for chat:, chat)
>
> my simple script is working perfectly when I pressing the script shortkey.
> I want jaws to say one of this numbers automatically.
>
> ----- Original Message -----
> From: "Martin Slack" <m.g.slack@xxxxxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Thursday, January 06, 2011 12:18 AM
> Subject: [jawsscripts] Re: Reading changed volues automatically
>
>
>> Can Kirca,
>>
>> Sorry about the delay. I asked about static text. I was really hoping
>> for more than the single word "in", if only because such a short word
>> might
>> well occur somewhere else on the page, and lead us astray.
>>
>> The proposal from Reed to use a frame certainly requires thought. The
>> frame is designed to be able to be set up so that speech is triggered
>> when
>> new text appears. This would work around the problem with my proposal of
>> having to wait for a few seconds after the text changes before the script
>> looks again. The downsides of using frames are that users run into
>> problems
>> when using different screen resolutions or window sizes, since the frame
>> is
>> defined with respect to the screen itself, not the window.
>>
>> We could take either approach. You must decide which is preferable in
>> your case. Is it better to have the text spoken immediately, or to be
>> able
>> to run the application window whether it is maximised or not?
>>
>> Martin
>>
>>
>> ----- Original Message -----
>> From: "Can Kirca" <cankirca@xxxxxxxxx>
>> To: <jawsscripts@xxxxxxxxxxxxx>
>> Sent: Wednesday, January 05, 2011 9:26 PM
>> Subject: [jawsscripts] Re: Reading changed volues automatically
>>
>>
>>> Martin,
>>> I'm waiting your answer, are you there?
>>> thanks alot
>>> ----- Original Message -----
>>> From: "Martin Slack" <m.g.slack@xxxxxxxxxxxx>
>>> To: <jawsscripts@xxxxxxxxxxxxx>
>>> Sent: Wednesday, January 05, 2011 10:04 AM
>>> Subject: [jawsscripts] Re: Reading changed volues automatically
>>>
>>>
>>>> Can Kirca
>>>>
>>>> Sorry, I was rather tired last night, and didn't notice your
>>>> code.
>>>>
>>>> First I would say that the procedure you are using seems rather
>>>> complicated, having to move up and down as well as left and right. Is
>>>> there any static text (text that never changes) on the same line as the
>>>> changing figures you want spoken? If so we ought to be able to use the
>>>> FindString function to move straight to that line in one go. We might
>>>> do
>>>> that in a function that we schedule to run at short intervals, say
>>>> every
>>>> 30
>>>> seconds or every minute, and only speak if the number has changed since
>>>> the
>>>> last read.
>>>>
>>>> How does that sound?
>>>>
>>>> Martin
>>>>
>>>>
>>>> ----- Original Message -----
>>>> From: "Can Kirca" <cankirca@xxxxxxxxx>
>>>> To: <jawsscripts@xxxxxxxxxxxxx>
>>>> Sent: Tuesday, January 04, 2011 11:28 PM
>>>> Subject: [jawsscripts] Re: Reading changed volues automatically
>>>>
>>>>
>>>>> Hi Martin,
>>>>> I paysted my code here.
>>>>> when I press ctrl+shift+4 jaws says number of wating visiters
>>>>> I want to modify this script to say number of wating visiters
>>>>> automatically
>>>>> when it change.
>>>>> ----- Original Message -----
>>>>> From: "Martin Slack" <m.g.slack@xxxxxxxxxxxx>
>>>>> To: <jawsscripts@xxxxxxxxxxxxx>
>>>>> Sent: Wednesday, January 05, 2011 1:13 AM
>>>>> Subject: [jawsscripts] Re: Reading changed volues automatically
>>>>>
>>>>>
>>>>>> There are a couple of possibilities. To start with, could you copy
>>>>>> and
>>>>>> paste your code into an email to the list and explain to us how it
>>>>>> works
>>>>>> at
>>>>>> the moment? This should provide a starting point.
>>>>>>
>>>>>> Martin
>>>>>>
>>>>>>
>>>>>> ----- Original Message -----
>>>>>> From: "Can Kirca" <cankirca@xxxxxxxxx>
>>>>>> To: <jawsscripts@xxxxxxxxxxxxx>
>>>>>> Sent: Tuesday, January 04, 2011 10:32 PM
>>>>>> Subject: [jawsscripts] Reading changed volues automatically
>>>>>>
>>>>>>
>>>>>>> Hi,
>>>>>>> I'm using a software in our office for talking with customer.
>>>>>>> I created a simple script for reading how many visiters wating for
>>>>>>> chat.
>>>>>>> my script worked correctly but now, I want to modify my script as
>>>>>>> read
>>>>>>> number of wating visiters automatically when it change.
>>>>>>> could you help me please?
>>>>>>> my script is:
>>>>>>> Script WaitingForChat ()
>>>>>>>
>>>>>>> SpeechOff ()
>>>>>>>
>>>>>>> SaveCursor ()
>>>>>>>
>>>>>>> InvisibleCursor ()
>>>>>>>
>>>>>>> JAWSTopOfFile ()
>>>>>>>
>>>>>>> JAWSPageUp ()
>>>>>>>
>>>>>>> NextLine ()
>>>>>>>
>>>>>>> NextLine ()
>>>>>>>
>>>>>>> NextLine ()
>>>>>>>
>>>>>>> NextLine ()
>>>>>>>
>>>>>>> PriorLine ()
>>>>>>>
>>>>>>> JAWSEnd ()
>>>>>>>
>>>>>>> PriorWord ()
>>>>>>>
>>>>>>> PriorWord ()
>>>>>>>
>>>>>>> PriorWord ()
>>>>>>>
>>>>>>> SpeechOn ()
>>>>>>>
>>>>>>> If GetWord () == "in" then
>>>>>>>
>>>>>>> PriorWord ()
>>>>>>>
>>>>>>> PriorWord ()
>>>>>>>
>>>>>>> PriorWord ()
>>>>>>>
>>>>>>> SayWord ()
>>>>>>>
>>>>>>> else
>>>>>>>
>>>>>>> SayWord ()
>>>>>>>
>>>>>>> EndIf
>>>>>>>
>>>>>>> PCCursor ()
>>>>>>>
>>>>>>> RestoreCursor ()
>>>>>>>
>>>>>>> EndScript
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> __________�
>>>>>>>
>>>>>>> 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
>>>>>>
>>>>>
>>>>> __________�
>>>>>
>>>>> 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
>>>>
>>>
>>> __________�
>>>
>>> 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
>>
>>
>
> __________�
>
> 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
Other related posts: