Then your goal is indeed the one for which I said "stop reading." :-) I happen
not to prefer that, but it is a valid use of delay there.
On Thu, Apr 16, 2020 at 07:28:16PM +0200, Csaba Árpádházy-Godo wrote:
I understand your argument, Doug, but my own experience has shown that
in cases where pressing a key combination several times performs
different functions per press, it is worth using the delay function.
When I press a key combination, JAWS immediately starts running the
script. This is best detected with the JAWSKey + F12 - SaySystemTime ()
script. Whenever I press twice (because I want to hear the date) before
we start hearing the date, we hear the first few tenths of a second of
the time being announced. Especially if you press it down a second time
more slowly. Delay (2) allows you not to start announcing the time
before the date. And 2ms is not enough time for the user to notice.
2020. 04. 16. 17:03 keltezéssel, Doug Lee írta:
Honestly I don't recommend a delay here, but the reasons are a bit__________�
complicated. The only advantage to using delay() as suggested here is that
the user may not hear the results of the first run of the script before the
key
repeats and the second run begins. If that is the goal, stop reading. :-)
Otherwise, carry on...
First, the delay function only delays script execution until a key is
pressed; then it basically does nothing. The pause function delays regardless
of keystrokes, but I don't recommend that either.
Second, delaying a script, by delay or pause, just makes it take more time to
run. If you use delay(), you won't notice this in this case because delay()
will stop doing anything once a key is pressed anyway. If you use
pause, users may find your script slow in this case because there will be a
pause for each repeat script invocation keystroke.
Most important though, JAWS does not need time to figure out how many key
presses have occurred. If your script code takes time to run, there is merit
in making it avoid running until JAWS knows how many times the keystroke
will be typed, so that the time-consuming code is run only once. That is most
effectively done by using scheduleFunction to schedule the time-consuming
code though. The current example, finding screen text, does not require
this level of complexity in my opinion; but something that does a lot with an
application's object model, for instance, might.
Please pardon my weird sense of humor in the following example:
; This is used to signal a doTheDigging function what to do.
; the myNamespace prefix protects the global from colliding with other
scripting projects.
globals int myNamespace_giWhich
script digForGold()
; Dig for gold where the user wishes, based on number of script invocations
in quick succession.
; Tell the digger what we want to do, based on how many times the user sent
the keystroke: 0 once, 1 twice, 2 three times, etc.
myNamespace_giWhich = isSameScript()
; Wait about 0.6 seconds before trying to run this time-consuming process.
; JAWS waits 0.5 seconds before resetting the isSameScript() counter, so this
is just sufficient delay to guarantee expected behavior of running only one
process per user request.
scheduleFunction("doTheDigging", 6)
endScript
void function doTheDigging()
var int city = myNamespace_giWhich
if city == 0
; Dig in California; that'll take a while.
elif city == 1
; Dig in Illinois; but please don't dig up my home town!
else
; Dig in the user's back yard.
endIf
endFunction
On Thu, Apr 16, 2020 at 04:27:18PM +0200, Csaba Árpádházy-Godo wrote:
CAUTION: This email originated from outside of the organization. Do not click
links or open attachments unless you recognize the sender and know the
content is safe.
Hi Steve!
I would modify a little bit Doug's script. I often program "more-press"
keystrokes and my experiences are that JAWS needs some extra time to
recognize correctly second, third, or more times presses. So I inserted
a simple 2 ms delay line in the front of the script which gives JAWs to
recognize correctly user's presses.
So the modified script:
Script findWordRequestedBy ()
var
string strFindText
Delay (2)
let strFindText = "Requested by"
if isSameScript()
let strFindText = "Requested for"
endIf
SetJAWSFindText (strFindText)
JAWSTopOfFile ()
; search from top of the file
if (JAWSFindNext ()) then
SayLine()
NextLine()
SayLine()
else
SayMessage (OT_ERROR, "Not Found", "Not Found") endIf
EndScript
2020. 04. 16. 13:27 keltezéssel, HICKS, Steven (Redacted sender
steven.hicks for DMARC) írta:
That is fantastic, thanks so much for your help, I will give it a try and__________�
report back.
-----Original Message-----
From: jawsscripts-bounce@xxxxxxxxxxxxx <jawsscripts-bounce@xxxxxxxxxxxxx> On
Behalf Of Doug Lee
Sent: 15 April 2020 17:03
To: jawsscripts@xxxxxxxxxxxxx
Subject: [jawsscripts] Re: Script Advice
Try this - I added three lines in a block:
Script findWordRequestedBy ()
var
string strFindText
let strFindText = "Requested by"
if isSameScript()
let strFindText = "Requested for"
endIf
SetJAWSFindText (strFindText)
JAWSTopOfFile ()
; search from top of the file
if (JAWSFindNext ()) then
SayLine()
NextLine()
SayLine()
else
SayMessage (OT_ERROR, "Not Found", "Not Found") endIf EndScript
On Wed, Apr 15, 2020 at 03:02:59PM +0000, HICKS, Steven wrote:
Hi friends,
Not sure if anyone has the time to advise but I will list my script below
which works really well. It locates a location on the screen which is text
saying Requested By.
Sometimes this field text that I need to find is actually called requested
for rather than requested by.
What I would like to do if possible is search for requested by on one press
of the shortcut key and if I press it twice quickly, it searches for
requested for instead of requested by if that makes any sense?
I Was thinking that I may be able to use the IfSameKey() statement to look
for a double press?
I Could then set the search variable according to if the key is pressed once
or twice?
Script findWordRequestedBy ()
var
string strFindText
let strFindText = "Requested by"
SetJAWSFindText (strFindText)
JAWSTopOfFile ()
; search from top of the file
if (JAWSFindNext ()) then
SayLine()
NextLine()
SayLine()
else
SayMessage (OT_ERROR, "Not Found", "Not Found") endIf EndScript
********************************************************************************************************************
This message may contain confidential information. If you are not the
intended recipient please inform the sender that you have received the
message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or
take any action in relation to its contents. To do so is strictly prohibited
and may be unlawful. Thank you for your co-operation.
NHSmail is the secure email and directory service available for all NHS
staff in England and Scotland. NHSmail is approved for exchanging patient
data and other sensitive information with NHSmail and other accredited email
services.
For more information and to find out how you can switch,
https://portal.nhs.net/help/joiningnhsmail
__________???
View the list's information and change your settings at
http://www.freelists.org/list/jawsscripts
--
Doug Lee, Lead Accessibility Architect
Level Access - over 1,000 organizations trust us to help them achieve and
maintain digital accessibility compliance!
mailto:Doug.Lee@xxxxxxxxxxxxxxx http://www.LevelAccess.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
********************************************************************************************************************
This message may contain confidential information. If you are not the
intended recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or
take any action in relation to its contents. To do so is strictly prohibited
and may be unlawful. Thank you for your co-operation.
NHSmail is the secure email and directory service available for all NHS
staff in England and Scotland. NHSmail is approved for exchanging patient
data and other sensitive information with NHSmail and other accredited email
services.
For more information and to find out how you can switch,
https://portal.nhs.net/help/joiningnhsmail
__________�
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