[jawsscripts] Re: ScheduleFunction: why does compiler complain?

  • From: Andrew Hart <ahart@xxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Tue, 26 Nov 2013 14:35:09 -0300

Geoff,

To the best of my knowledge, I don't believe you can pass arguments to
the function using ScheduleFunction.  To do the sort of thing you're
suggesting you would need to do something like

Void Function SaySomething()
SayString("Ok, I'm saying something")
EndFunction

and you could then call
ScheduleFunction("SaySomething", 5)

If you need to pass something to such a function, you'd need to use
global variables to do it.

However, to deal with your particular problem, I'd be inclined to set up
a Global variable for holding whether or not speaking can be interrupted
by NewTextEvent.  Then, have NewTextEvent check if the variable is set.
 If so, then do nothing.  Otherwise set the global variable  an
dschedule a function to reset it to 0 after a certain amount of time has
elapsed.

However, there may be some side-effects of this kind of mechanism, e.g.,
if the user tabs away from the application before the function is fired,
which would permanently block your NewTextEvent.  So, you'd need to put
in some recovery logic in AutoStartEvent or AutoFinishEvent or both to
prevent any problems.

This is the best I can come up with off the top of my head, but perhaps
someone else has a better idea of how to deal with this kind of situation.

Hth,
Andrew.

On 26/11/2013 2:07 PM, Geoff Chapman wrote:
> Wondering if anyone can clear up a small mystery I'm having here.
> I know there's some deal about ScheduleFunctions, and what they will and 
> won't accept, but I've just forgotten what it exactly is now, and I need a 
> little straightening out. :)
> 
> In an effort to reduce multiple triggerings in NewTextEvent with a 
> specialized situation,
> Where I'm wanting jaws to check when a certain window class has appeared, at 
> a successful Combo box activation,
> And when it does, to do two things:
> (a) get jaws to say Popup, just once, i.e. not repeat it every time one 
> upDown arrows and the item you've left, and the item you're moving to, gets 
> redrawn,
> and
> (b) speak the entire text of that comboBox window, just at present for my 
> debugging purposes, again only the once.
> Eventually of course I wouldn't need either of those, just for it to speak 
> the first highlighted item, and read the next one as arrowed to, as per 
> normal.
> 
> Now if I just put a line:
> SayString ("popup")
> in my if condition for checking for this combo box class window to appear, 
> then it'll 
> speak that for each item it initially writes into the combobox window, in 
> this case 5 times, and so I thought Scheduling it, might be a way of 
> eliminating that multiple triggering situation.
> However, when I write:
> ScheduleFunction ("SayString ("PopUp")", 1)
> The compiler doesn't like me, and will return, "unexpected word PopUp."
> 
> So my questions are:
> 1. Is it the deal then, that you can't put quoted strings into a 
> ScheduleFunction call like my above example?
> But, that you can do it, if the string text is already inside a variable? 
> like:
> ScheduleFunction ("SayString (buffer)", 1)
> Which certainly appears to be the case. Does anyone know why? though that is 
> rather an irrelevant question I guess.
> 
> 2. Sometimes, when attempting to use ScheduleFunction calls, in a bid to 
> eliminate multiple triggerings of something I want the user to hear, inside 
> NewTextEvent, occasionally the lowest second parameter for ScheduleFunction,
> , 1, seems to eliminate the thing from speaking altogether.  Whereas if 
> there's a straight ahead wach for a string, then a
> SayString (buffer)
> it may speak it multiple times.
> Has anyone got any more sophisticated ideas for how one may get around this 
> kind of problem?
> 
> Thanks much for any tips.
> 
> Regards
> Geoff C.
> 
> __________�
> 
> 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: