[jawsscripts] selecting a script from a list & running it

  • From: "Paul Magill" <magills@xxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Mon, 27 Jul 2009 17:55:23 +1000

Hi all,

A short while ago, someone asked about a script that could present a list of 
scripts, from which 1 could be selected & run.

I had forgotten that I had previously set up samples of how this is done, 
but have now come across them. See below.

These are simple examples to show how, and not intended as final products.

Note1: in the first example, if a function name is provided, & is not 
suffixed by a dollar sign when run, I believe it will work, but it has been 
too long to remember for sure.

Note2:  in the second example, it would be much more reliable to set up the 
descriptions as constants, thus avoiding any typing errors causing problems.


* Both of the scripts below will present a list of scripts from which you 
can select one to run.

The first is easier to code, and is my preferred option because it is easier 
to maintain, but the second one allows nicer reading of the choices as they 
do not have to actually be the names of the script that are to be run.


Script RunAScript ()
VAR

INT  Choice,
STRING  ListOfScripts,
STRING  SelectedScript

; note that each item below is the exact name of the script, with no spaces 
and no parenthesis.
LET ListOfScripts = "ScriptFileName"
+ "|AdjustJAWSVerbosity"
+ "|ChangeSettings"

; this puts up the list to choose from
LET Choice = DlgSelectItemInList (ListOfScripts, "Select a script", False, 
1)



; this gets the name of the script to be run
LET SelectedScript = StringSegment (ListOfScripts, "|", Choice)

; this runs the chosen script. Note that a dollar sign must be added to the 
front of the name when calling scripts this way
ScheduleFunction ("$" + SelectedScript, 0)

EndScript




Script RunAScript2 ()

VAR
INT  Choice,
STRING  ListOfScripts,
STRING  SelectedScript

; note that you can use any description you like. It does not have to be the 
name of the script that is to be run.
LET ListOfScripts = "Say the Script File Name"
+ "|Set JAWS Verbosity"
+ "|Change the Settings"

; this puts up the list to choose from
LET Choice = DlgSelectItemInList (ListOfScripts, "Select a script", False, 
1)

; this gets the name of the script to be run
LET SelectedScript = StringSegment (ListOfScripts, "|", Choice)

; the if statement checks for each option, and runs the appropriate script
IF (SelectedScript == "Say the Script File Name") THEN
PerformScript ScriptFileName ()
ELIF (SelectedScript == "Set JAWS Verbosity") THEN
PerformScript AdjustJAWSVerbosity ()
ELIF (SelectedScript == "Change the Settings") THEN
PerformScript ChangeSettings ()
ENDIF
EndScript

Regards,
Paul from Aust



__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

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

Other related posts:

  • » [jawsscripts] selecting a script from a list & running it - Paul Magill