[jawsscripts] Re: Function with optional parameters

  • From: Dang Manh Cuong <dangmanhcuong@xxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Fri, 13 Apr 2018 23:14:28 +0700

Could you please show me how to declare in jsd file. Never heard about this 
before.
Appreciated your help
Cuong
----------------
Dang Manh Cuong
 The Assistive technology specialist
 Sao Mai Vocational and assistive center for the blind
52/22 Huynh Thien Loc St., Hoa Thanh ward, Tan Phu dist., HCM, Vietnam.
 Tel: +8428 7302-4488
 E-mail: vanphong@xxxxxxxxxxxxxxxxxx; congnghe@xxxxxxxxxxxxxxxxxx
 Facebook: https://www.facebook.com/saomaicenterfortheblind
 Website: http://www.trungtamsaomai.org; http://www.saomaicenter.org  Mobile ;
/ Zalo: +84 902-572-300
 E-mail: dangmanhcuong@xxxxxxxxx; cuong@xxxxxxxxxxxxxxxxxx
 Skype name: dangmanhcuong
 facebook: http://facebook.com/dangmanhcuong
 Twitter: @ManhCuongTech
----- Original Message ----- 
From: "Doug Lee" <doug.lee@xxxxxxxxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Friday, April 13, 2018 7:23 PM
Subject: [jawsscripts] Re: Function with optional parameters


It should work under either of two conditions: The function is defined 
before use, or the function is also declared, with the optionalness of 
that parameter, in the jsd file. If you don't have it declared in the jsd 
file and you
reference the function before it is defined in your jss, the compiler will 
internally create a definition based on your first use of the function.

On Fri, Apr 13, 2018 at 09:48:55AM +0700, Dang Manh Cuong wrote:
Hi Doug and all
I tried this, and it didn't work

Void Function TestFunc (optional string p1)
If p1=="say" then
SayString ("This is a test function with an optional parameter")
Else
SayString ("This is a test function with an optional parameter, but user 
not
use it")
EndIf
EndFunction
When I trry inserting it into a script without adding any info on it
parameter and compile, script manager said this function required 1
parameter.
Using the latest Jaws 18.0
Cuong
----------------
Dang Manh Cuong
The Assistive technology specialist
Sao Mai Vocational and assistive center for the blind
52/22 Huynh Thien Loc St., Hoa Thanh ward, Tan Phu dist., HCM, Vietnam.
Tel: +8428 7302-4488
E-mail: vanphong@xxxxxxxxxxxxxxxxxx; congnghe@xxxxxxxxxxxxxxxxxx
Facebook: https://www.facebook.com/saomaicenterfortheblind
Website: http://www.trungtamsaomai.org; http://www.saomaicenter.org ;
Mobile
/ Zalo: +84 902-572-300
E-mail: dangmanhcuong@xxxxxxxxx; cuong@xxxxxxxxxxxxxxxxxx
Skype name: dangmanhcuong
facebook: http://facebook.com/dangmanhcuong
Twitter: @ManhCuongTech
----- Original Message ----- 
From: "Doug Lee" <doug.lee@xxxxxxxxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Thursday, April 12, 2018 11:23 PM
Subject: [jawsscripts] Re: Function with optional parameters


That can be tricky in the general case. Try to make your optionals such
that a non-empty value means alter default behavior and an empty one
equates to False or do nothing special. Then things like if !p3 are
enough. The
getVariantType function may help in more difficult cases.

On Thu, Apr 12, 2018 at 11:18:16AM -0500, Snowman wrote:
I have never used Optional much.
But, in jaws script, how does the code inside a function determine 
whether
an optional parameter has been supplied or not?


+--------------------------------------------------------------------------+
Listen to The Snowman on MushroomFM.com, Saturday evenings, 8PM Eastern
time.
60's and 70's tunes, and gently conservative talk.

----- Original Message ----- 
From: "Doug Lee" <doug.lee@xxxxxxxxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Wednesday, April 11, 2018 11:12 PM
Subject: [jawsscripts] Re: Function with optional parameters


int function myFunc(int p1, optional int p2, string s)

The word "optional" comes before the first optional parameter. All that
follow are then considered optional.

On Thu, Apr 12, 2018 at 10:56:52AM +0700, Dang Manh Cuong wrote:
To all listers
Does Jaws support script writer to create a function contains an optional
parameter? For example, I created a function with 2 or 3 parameters, but 
1
or 2 of them is required. If it could do, please show me how.
Any help would be  appreciated.
Cuong
----------------
Dang Manh Cuong
The Assistive technology specialist
Sao Mai Vocational and assistive center for the blind
52/22 Huynh Thien Loc St., Hoa Thanh ward, Tan Phu dist., HCM, Vietnam.
Tel: +8428 7302-4488
E-mail: vanphong@xxxxxxxxxxxxxxxxxx; congnghe@xxxxxxxxxxxxxxxxxx
Facebook: https://www.facebook.com/saomaicenterfortheblind
Website: http://www.trungtamsaomai.org; http://www.saomaicenter.org
Mobile
/ Zalo: +84 902-572-300
E-mail: dangmanhcuong@xxxxxxxxx; cuong@xxxxxxxxxxxxxxxxxx
Skype name: dangmanhcuong
facebook: http://facebook.com/dangmanhcuong
Twitter: @ManhCuongTech
---
This email has been checked for viruses by AVG.
http://www.avg.com

__________???

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

-- 
Doug Lee, Senior Accessibility Programmer
Level Access
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

__________???

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

-- 
Doug Lee, Senior Accessibility Programmer
Level Access
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


__________???

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

-- 
Doug Lee, Senior Accessibility Programmer
Level Access
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


__________�

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

Other related posts: