[jawsscripts] Re: " Error of creating my own script"

  • From: Jackie McBride <abletec@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Wed, 12 Aug 2009 15:17:05 -0700

Mostafa:

Let me also see if I can add to what Don so ably said.

compile: this is a term used by just about every programming language.
Computers don't understand the words, if, then else, saystring, etc.
What they do understand is 1's & 0's. Well that's pretty rough stuff.
So there's a sort of middle step called machine language. It, too, is
not easy for programmers to write. When u compile a script, it takes
the statements u make like
typeString("Mostafa")
& converts it to machine language that the computer can understand.

A function can be either built into the programming language or
created by the user. In the case of jaws, if it isn't activated by a
keystroke, it's a function. This is totally simplified, but here's
code for a function that I created, therefore, it's called a
"user-defined function":

void function MyName ()
say("my name is Mostafa", ot_message)
endFunction

script test ()
MyName()
endScript

The script test does nothing but calls the function myName by using
the function's name, followed by a left & right parentheses pair. The
code immediatly jumps to the function myName(). Your name will be
spoken, & the script will quit.

The word void preceding the name of the function means it does not
return anything. We'll get to that in a minute.

Another word for parameter is also argument. Let's take this rather
simplistic script/function pair & expand it a bit further.

void function MyName (string name) ;this is called a function declaration

say("name, ot_message)
endFunction

script test ()
MyName("my name is Mostafa") ;what's in the parentheses is a parameter
endScript

Note the changes. The first change is that the parentheses that
surround the function myName are no longer empty, but contain the
words (string name). This tells the compiler to expect that a value is
going to be given to that function, that it is a string, & that it's
called name. the 2nd change occurs in the script, where, again, the
parentheses surrounding the function's name are no longer empty but
contain the quoted string ("my name is Mostafa"). That value is known
as a parameter or argument.

Now, let's take this still rather simplistic code & decorate it a
little further.

string function MyName () ;this is called a function declaration

return "my name is mostafa"

endFunction

script test ()

var
string name

let name = MyName()
say(name, ot_message)
endScript

This time, the word string before the name of the function myName
tells u that the function is going to give back or return a string.
The script test declares a variable (which is just a name of something
that can change) of type string that I called name when it says var
string name. The statement let name = myName() says that I want to
take what the MyName() function returned & store it in the variable
called name. It then calls the function myName() & the function tells
the script that the value to be returned is "my name is mostafa". That
value is then spoken & the script ends.

This is not an easy concept. You'll need to understand it though in
order to script or do most any programming languages effectively. If
you've ever done algebra, then the concept of variables is similar,
e.g., x & y can mean anything depending on the equasion.

Parameters are separated by commas, so, the Jaws say function contains
2 parameters, that is, what u want spoken & something called the
output mode. Thus, in the statement say("my name is Mostafa",
ot_message) say is the name of the function, its 2 parameters are the
quoted string "my name is Mostafa" & the output mode of ot_message.

Well that's all for now, folks. I think it's probably more than
enough, actually.

Good luck beginning scripters!

On 8/12/09, Donald Marang <donald.marang@xxxxxxxxx> wrote:
> I will see if I can provide more clarification on these basic terms for JAWS
> Scripting:
>
> Compile = Convert human understandable code (JSS scripts) to computer
> understandable code (JSB binary)
>
> Synopsis =announcing the script purpose in brief
>
> Parameters = Values to be passed to a function or possibly returned back if
> passed by reference
>
> Function = similar to a script but it is not assigned to a keystroke and a
> function can accept parameters and return a value
>
> Learning scripting can be difficult enough.  in your case, I am guessing
> that you are attempting to master two languages at once!  Good luck.
>
> Don Marang
>
>
> ----- Original Message -----
> From: "mostafa almahdy" <mostafa.almahdy@xxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Wednesday, August 12, 2009 10:01 AM
> Subject: [jawsscripts] Re: " Error of creating my own script"
>
>
>> HI folks:
>> I've created my basic script  successfully  in twice, unless I' have
>> some questions may regarding this particular issue:
>> at time before last, I' attempted  to create  it once again  and it
>> also was showing me the following error:
>> Unexpected word  and  separate   an certain text: such as the date and
>> time of  that written, unless when I'm clearing that up, it's fixing
>> it  in brilliantly  and  compiling successfully.
>> also, in  my try  the secondth, it has separated  my name  as an
>> Unexpected word, when I' cleared that up, it's was going  on  and
>> complete the compile.
>> note:
>> I've not wrote any date or time and cleared my name and it were
>> compiles successfully!!.
>> isn't requires or   necessary  to  included  those couple of lines?
>> Please describe that to me.
>> further, I' wish to  conform the following  expressions  of scripting,
>> to make sure that I'm understanding them correctly.
>> I'll type the expression first and than follow it by quick definition.
>> Compile:
>> gathering   required informations to complete.
>> Synopsis. .
>> announcing the script purpose in briefly.
>> Parameters.
>> an spoken message by providing particular keystroke combination.
>> function.
>> similarly to the script unless it doesn't  assign to keystroke.
>> that's  my own efforts of defining couple of stuff.
>> Hopefully that I'll be correct in some of them.
>> Please if someone know  any  session of  scripting  tutorials that
>> can I' participate in, notify me and I' shall  manage my own.
>> any suggest or recommend, that's tremendously would be appreciated!!.
>> mostafa muhammad taric almahdy.
>> Egyptian citizen.
>> skype account:
>> my_speaker
>>
>>
>>
>>
>>
>>
>> On 8/12/09, Paul Magill <magills@xxxxxxxxxxx> wrote:
>>> Hi mostafa,
>>>
>>> You may also find it useful to set punctuation to all, in the
>>> configuration
>>> manager for the script manager.
>>>
>>> I have done this so I can hear all punctuation, which helps to find
>>> unwanted
>>> punctuation such as in your example.
>>>
>>> Good luck,
>>> Paul from Aust
>>>
>>>
>>> ----- Original Message -----
>>> From: "mostafa almahdy" <mostafa.almahdy@xxxxxxxxx>
>>>
>>>
>>> Hello to each other:
>>> for quite period of long time, I've been participated  to many
>>> tutorials particularly on the scripting issue.
>>> I've known and believed that each  technical  skill should takes it's
>>> time to educate  it correctly and accurately,    and   I' believe
>>> that's  the  practical method  is  the best way  of practicing   and
>>> following along.    recently I' attempt to create my own script  for
>>> training or  exercising purposes.
>>> when I' almost have dun it, it shows the following error  when I'm
>>> struggling to compile in order to save  it and finish up.
>>> the error is the following line:
>>> unexpected word followed by ok button.
>>> the script subject has posted in the  section below:
>>>
>>>
>>>
>>> ; Script files for notepad , version X, for windows XP
>>> ; for JAWS10.0.1154
>>> ; by Mostafa Almahdy-11-8-2009
>>>
>>>
>>> Script TypeMyName() ()
>>> TypeString ("Mostafa Almahdy")
>>>
>>>
>>> EndScript
>>>
>>>
>>> I' just thought  that's  something  unexposed  when I'm trying to type
>>> the first Parameter of this certain basic script.
>>> it says  unexpectedwhen I'm trying to do that.
>>> any suggest or recommend, that's tremendously would be appreciated!!!.
>>> mostafa muhammad taric almahdy.
>>> Egyptian citizen.
>>> skype account:
>>>
>>> __________
>>> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>>>
>>> View the list's information and change your settings at
>>> http://www.freelists.org/list/jawsscripts
>>>
>>>
>>
>>
>> --
>> Sincerely.
>> best regard
>> It's always hope that give's meaning to life.
>> ___________
>> __________�
>> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>>
>> View the list's information and change your settings at
>> http://www.freelists.org/list/jawsscripts
>>
>
> __________
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> http://www.freelists.org/list/jawsscripts
>
>


-- 
Change the world--1 deed at a time
Jackie McBride
Check out my homepage at:
www.abletec.serverheaven.net
& please join my fight against breast cancer
<http://teamacs.acsevents.org/site/TR?px=1790196&pg=personal&fr_id=3489>
__________�
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

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

Other related posts: