JAWS Scripting Tip: Optional Parameters

JAWS is a screen reader developed by Freedom Scientific. It includes a scripting language that allows users to customize the behavior of JAWS.

Many programming languages such as C++, C#, and Modern JavaScript support the concept of optional function parameters for which you supply a default value for the parameter. In C++ this might be done as follows.

std::wstring GetFavoriteNumberMessage(int64_t number = 42)
{
    std::wstringstream message;
    message
        << L"Hello. My favorite number is "
        << number
        << L". What is your favorite number?\n";
    return message.str();
}

See source on godbolt.org.

The JAWS scripting language supports optional parameters using the optional keyword, as follows.


string function GetFavoriteNumberMessage(optional int number)
  var string message = FormatString(
    "Hello. My favorite number is %1. What is your favorite number?",
     number)
  return message
endFunction

However, there is no direct method of assigning a default value for the optional parameter. If you were to call the function is as without specifying a value for the number parameter the number will be inserted into the returned message as an empty string. This is most likely not the desired behavior.

When the caller does not specify the value of an optional parameter, it does not resolve to 0 or false within the function; this is a common misconception. Instead the unspecified parameter resolves to nullptr. The misconception that the unspecified parameter resolves to 0 or false is a result of the fact that when nullptr is typecast to an int the result is 0 or false. However, if the unspecified parameter is typecast to a string the result is an empty string. This is why in the above example the number will be inserted into the returned message as an empty string; the number parameter is typecast to a string by the FormatString function. If the unspecified parameter did resolve to 0 or false within the function it would be inserted to the returned message as 0!

This problem can be resolved as follows.

string function GetFavoriteNumberMessage(optional int number)
    if (!DidCallerSpecifyTheValueOfTheParameter(number))
      number = 42
    endIf
    var string message = FormatString(
      "Hello. My favorite number is %1. What is your favorite number?",
      number)
    return message
endFunction

Unfortunately, there is no DidCallerSpecifyTheValueOfTheParameter function in the JAWS scripting language, so do not bother looking it up. However, there is a function that can achieve the same goal.

Behind the scenes all variables in the JAWS scripting language are VARIANTs (yes we are aware that there are modern alternatives that are vastly superior but the JAWS scripting language is very old; it has its roots in the JAWS macro language that was included in JAWS for DOS). One benefit of a VARIANT is it supports the concept of a VARTYPE or variant type. Furthermore, there is a VT_EMPTY variant type. Finally, there is a rarely used GetVariantType built-in script function that “determines the type of a variable”.

Thus, it is possible to assign a default value for an optional parameter as follows.

string function GetFavoriteNumberMessage(optional int number)
    if (GetVariantType(number) == VT_EMPTY)
      number = 42
    endIf
    var string message = FormatString(
      "Hello. My favorite number is %1. What is your favorite number?",
      number)
    return message
endFunction

Note that some people may think this is unnecessary because it is enough to rely on the perceived unspecified parameter resolves to 0 or false behavior. This is wrong for two reasons.

  • As I have already pointed this perceived behavior is not what is actually happening. The unspecified parameter actually resolves to nullptr.
  • In many cases, even if the perceived unspecified parameter resolves to 0 or false behavior may not be what is desired.

Every other programming language that supports the concept of optional parameters; such as C++, C#, and Modern JavaScript ; allows the value of the optional parameters to be explicitly defined. The purpose of the following code block is to add the same capabilities to optional parameters in the JAWS Scripting Language.

if (GetVariantType(number) == VT_EMPTY)
  number = 42
endIf

This is the only way to assign a non nullptr value for an optional parameter in the JAWS Scripting Language. You should consider doing this even for parameters where the default value is 0 or nullptr because explicitly specifying the value of your default parameters rather that making people who read your code guess what the behavior will be is just being polite.

Note that using this technique is absolutely necessary when overriding a built-in script function such as the SayObjectTypeAndText function in your scripts. The default value of the includeContainerName is true, not false. Failure to do this when overriding the SayObjectTypeAndText function will change the behavior of your function from the default resulting in hard to find bugs.

More advice on how to organize an article

The Upcoming changes to Google Drive sync clients page is another excellent example of how not to organize an article.

The section How Backup and Sync users can start using Drive for desktop begins as follows: “To get started with Drive for desktop, you can move your accounts and settings from Backup and Sync to Google Drive for desktop”. At this point the more impatient readers will have already started screaming at the author of this page because no information at all on how to get started was provided. Just above this paragraph is a link to “download Drive for Desktop” so you can assume that by the time your reader gets to this point on the page they have downloaded the software and they are continuing to read the page in order to find out what to do next.

To be more precise, at this point the reader has two questions that they are eager to learn the answer to.

  1. Do I uninstall Backup and Sync first?
  2. Or do I just install Drive for Desktop without first uninstalling Backup and Sync?

In the sentence “To get started with Drive for desktop, you can move your accounts and settings from Backup and Sync to Google Drive for desktop” you have not provided an answer to that question. You have instead annoyed the hell out of your reader. The reader is now screaming “But exactly how do I get started” at the top of their lungs.

The second sentence does not make matters any better: “During the process, you’ll review and confirm the settings for the folders on your computer you’re backing up and syncing with the cloud through Backup and Sync”. The reader is now two thirds of the way through the paragraph and they still have no idea what the answers to the above two questions are.

The final sentence does provide an answer to the question but only indirectly: “Backup and Sync will be automatically uninstalled after you’ve moved your accounts to Drive for desktop”. This sentence implies the answers to the two questions are as follows.

  1. Do I uninstall Backup and Sync first?: No
  2. Or do I just install Drive for Desktop without first uninstalling Backup and Sync?: Yes

The problem is that the impatient reader may have rage quit reading the page before getting this fare because of the issues with the first two sentences in the paragraph. I know that the first time I read this page, while I did manage to restrain myself from screaming, I did rage quit reading the page before I got to this critical sentence. It was not until I returned to the page the following day that I was able to answer my questions.

If a single sentence were added to the start of this paragraph things would be much better for the impatient reader: “You do not need to uninstall Backup and Sync before installing Drive for desktop”.

If the How Backup and Sync users can start using Drive for desktop section were rewritten as follows, this page would be far more useful and far easier to read.

How Backup and Sync users can start using Drive for desktop

You do not need to uninstall Backup and Sync before installing Drive for desktop. To get started with Drive for desktop simply run the Google Drive for desktop installer, GoogleDriveSetup.exe. After the installation of Drive for desktop completes a Move accounts to Drive for desktop form will be displayed to allow you to move your accounts and settings from Backup and Sync to Google Drive for desktop. During the process, you’ll review and confirm the settings for the folders on your computer you’re backing up and syncing with the cloud through Backup and Sync. Backup and Sync will be automatically uninstalled after you’ve moved your accounts to Drive for desktop.

Advice on how to organize an article

The article What causes the ‘Your Hardware Settings Have Changed’ issue on Windows 10? is very poorly organized.

In the introduction the article explains two possible causes of the issue. This introduction is well written and provides useful, and relevant, information.

After the introduction is a Note heading. The first paragraph in this section begins as follows: “If the given solutions don’t work for you, you will have to stop Windows from updating your device drivers”.

At this point many readers will begin screaming at you in rage because you have not said a single word about how to solve the problem, you just explained what is causing the problem.

Next comes several paragraphs that explain how to “stop Windows from updating your device drivers”.

This Note section ends with the ominous warning: here be dragons. The problem is that the impatient reader who is desperately trying to get their laptop working again may never even get this far because they may have followed the instructions on how to “stop Windows from updating your device drivers” and seeing that the issue has gone away closed the web page.

It is only if you continue scrolling down the page past the ominous warning that you find the solutions. Of course some readers will never see the solution because they stopped reading after following the instructions to “stop Windows from updating your device drivers”.

This article should have been organized as follows.

  1. Causes
  2. Solutions
  3. If the given solutions don’t work for you…

The way the article is presented just pisses the reader off. It may also cause them to try the alternative without ever being aware that the article actually does suggest solutions.

Don’t be like Kevin. Please use a logical order for your articles.

The start of a journey to become my true self.

The long and winding road, taken 14 years ago, 4 km from Dodburn, Scottish Borders, Great Britain.

I am a trans woman. I have been living as a woman for sixteen years. It has been almost sixteen years since I last wore men’s clothing.

And yet I have not begun the gender transitioning process.

I finally decided to begin the gender transitioning process at the end of last year. On December 30, 2020 I did some research to determine how to go about it. I found a document on my health insurance provider’s website containing the following information: “Hormone therapy is usually initiated upon referral from a qualified mental health professional … competent in behavioral health and gender dysphoria treatment”. I also learned that my insurance provider provides various telehealth options for Sexual Orientation and Gender Identity Counseling.

So, on December 31, 2020 I scheduled an appointment with a service called MDLIVE for January 20, 2021 at 1:00 PM CST.

The appointment on January 20, 2021 was a disappointment. At the beginning of the appointment I was asked what my goals are. When I mentioned that my ultimate goal was to begin HRT I was informed the MDLIVE cannot assist with that. The therapist suggested I contact my insurance provider to request information on how to go about starting HRT.

So later that day I used the chat feature of my health insurance provider’s website to request information on how to go about starting HRT. The response was devastating: “I apologize yet Hormone replacement therapy is not a covered benefit under your medical plan since it is considered as experimental, investigation and unproven.”

I was devastated.

Fortunately my health insurance provider has this new program in which they assign their customers a Nurse Case Manager.

I was contacted by two Nurse Case Managers today.

The first Nurse Case Manager I was assigned is not familiar with Gender Dysphoria. When I mentioned to her that I am a trans woman and I am planning on starting HRT soon I was reassigned to another Nurse Case Manager who is familiar with Gender Dysphoria.

My Nurse Case Manager is named Spring.

I mentioned to Spring that I had been informed that hormone replacement therapy is not a covered benefit and she reassured me that Hormonal therapy is covered under their “Treatment of Gender Dysphoria” policy. She sent me their Gender Dysphoria Policy document.

In the document the following services are listed as “Medically necessary treatment for an individual with gender dysphoria”.

  • Behavioral health services
  • Hormonal therapy
  • Gender Reassignment Surgery (with some exceptions) including “Male to female reconstructive genital surgery”.

Unfortunately some services that are deemed to be “not medically necessary service” are not covered. This includes the following.

  • Facial Feminization
  • Breast augmentation
  • Voice therapy

I have requested a referral to an endocrinologist from my Primary Care physician. They have referred me to Texas Diabetes & Endocrinology and I should be contacted by them next week. Spring confirmed that Texas Diabetes & Endocrinology accepts my health insurance and they are considered to be an in-network provider.

In other words, I am finally becoming my true self at the age of 44. I am so happy.

It has taken me many years and a great deal of pain to get to this point.

When I was a child my parents did everything they could to beat masculinity into me (see Do not try to force boys to be masculine. You will only break them.). They kept me from even realizing that there was an option to being a man. This is why I emphasize with what Vanyel Ashkevron went through in the book Magic’s Pawn: Valdemar: The Last Herald Mage; in this book Vanyel’s weapons master and father went to great lengths to keep Vanyel from realizing that homosexual relationships were possible.

I was married, to a woman, before I ever heard the word transgender.

When I finally accepted that I am transgendered, it ruined my marriage. The first thing my wife said to me was “I did not marry a woman.” She then accused me of marrying her under false pretenses.

It has been a long, winding, and extremely painful road. Everyone in my life who should have helped me instead put up road blocks. But I am finally here.

My response to a recent tweet by @realDonaldTrump.

Today @realDonaldTrump tweeted the following.

Donald J. Trump
@realDonaldTrump
At 10:00 P.M. on Election Evening, we were at 97% win with the so-called “bookies”.

This tweet has 146.8K Likes.

The problem is that this was in fact expected and is not evidence of fraud or proof that the election results are invalid for the following reasons which I will explain in the simplest way possible.

  1. There is a currently a deadly worldwide pandemic.
  2. Voting in person during a pandemic is a health risk.
  3. Many states responded to the pandemic by encouraging Vote by Mail.
  4. In many states the law required that counting of vote by mail ballots not begin until after the election.
  5. You told your supporters that vote by mail is prone to fraud despite having no proof. Thus many of your supporters chose to vote in person despite the pandemic related health risk.
  6. Democrats encouraged to stay healthy and vote by mail. Thus many democrats did the sane thing and chose to Vote by Mail.

Thus the inevitable result is that at the end of the day the election results appeared to favor Donald Trump because the legal vote by mail ballots had not been counted yet.

Even Attorney General William Barr, a well known supporter of Donald Trump, has said that “to date, we have not seen fraud on a scale that could have effected a different outcome in the election.”

How to make it difficult to find online test results.

Many doctor’s offices have moved access to medical records online. For example, my doctor’s office emailed me today to tell me that my COVID-19 test results are available and I should go online to view them.

I need to know for certain what the results are because I have a surgery scheduled for next Monday that I would have to cancel if I have COVID-19. Whoever designed the website seems determined to make it as difficult as possible to obtain test results.

The page is designed so that on the left side of the page there are the following tabs.

  • Patient Account
  • Patient Appointments
  • Documents
  • Review Medical Record
  • Message a Provider
  • Contact Us

So far, so good. The obvious place to search for test results is the Review Medical Record tab and if it is not there, the Documents tab.

So, I clicked on the Review Medical Record and I see it is divided into the following child tabs.

  • Patient Summary
  • Allergies
  • Immunizations
  • Medical History
  • Medications
  • Orders
  • Problem List

Nothing in that list gives any indication where to find Results.

So, I clicked on the Documents tab. It has one child tab, the Community Resources tab.

Again, no indication where to find Results.

I finally found the Results after I started clicking on every single tab and child tab; there were over 50.

The Results were located in the Orders child tab of the Review Medical Record tab.

If the Orders child tab was named Results I could have found that I do not have COVID-19 in 30 seconds. As it is, it took me 30 minutes!

Why the Trump administration ordered hospitals to bypass the C.D.C. when reporting COVID-19 information

Just in case you were wondering why the Trump administration ordered hospitals to bypass the Centers for Disease Control and Prevention and send all COVID-19 patient information to a central database in Washington, it was so the they can manipulate the numbers.

They want to deceive us into believing that the United States has the “Lowest Mortality Rate” from COVID-19.

Do not believe his lies; we have the seventh highest mortality rate in the world!

Sources:

Trump was not right about Hydroxychloroquine!

Speech bubble containing the word “blah.”

Before you believe bold headlines such as the following, you need to consider the source.

The Media Sabotage of Hydroxychloroquine Use for COVID-19: Doctors Worldwide Protest the Disaster.

Media and Big Pharma are in lockstep to suppress a cheap, life-saving Covid-19 therapy in order to reap pandemic-sized profits

This drivel was published on https://www.globalresearch.ca/ which is “a Canadian conspiracy website” that was founded by Michel Chossudovsky who is currently the President of GlobalResearch and professor emeritus of economics at the University of Ottawa.

For more see Media Bias/Fact Check — Global Research and Centre for Research on Globalization.

On the existence of deities and the nature of religion.

Symbols from various world religions. Source: Wikipedia.
Symbols from various world religions. Source: Wikipedia.

I once believed that there are no deities. Then I finally discovered the shocking truth, every deity that has ever been the subject of worship actually exists.

A religion is nothing more or less than a collection of religious texts, a group of priests and priestesses, and a network of places of worship.

These items can be described in non religious terms.

  • The religious texts are works of philosophy that happen to include tales; some of these tales discuss the history of the philosophy, or at least they claim to discuss the history of the philosophy, and other tales enhance and build upon and explain the philosophy.
  • The priests and priestesses are teachers that teach the philosophy.
  • The places of worship are schools that teach the philosophy.

The deity is therefore nothing more or less than the core concept that lies at the heart of the religion.

A religion is not meant to be static. It is meant to be a living, breathing, ever changing organism. It is the duty of all true followers of a religion to try to improve the religion for the betterment of man.

This is what is wrong with Christianity. It is no longer a living, breathing, ever changing organism. It is a putrid corpse.