Re: Fruit basket program in Window-Eyes scripting language

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Wed, 9 Jul 2008 16:43:59 -0400 (EDT)

A Window-Eyes script package is an archive in Windows .cab format with a
.wepm extension instead.  Below are the FruitBasket.vbs and
FruitBasket.xml files contained in the package.

Jamal

[Content of FruitBasket.vbs]

' Fruit Basket
' Version 1.1
' May 8, 2008
' Public domain by Jamal Mazrui

' Main routine
Option Explicit

ClientInformation.ScriptVersion = "1.1"
ClientInformation.ScriptDescription = "Fruit Basket 1.1 by Jamal Mazrui"
ClientInformation.ScriptHelp =
Strings("FruitBasket.xml").Item("Help_Text")

Dialog "FruitBasket.xml", "dlg", "HandleEvents"

' Worker routines
Function HandleEvents(oDlg, sEvent, sControl, oControl)
Dim iFruit
Dim oEdit, oListBox
Dim sFruit

HandleEvents = False
Select Case sEvent
Case buttonClicked
Set oEdit = oDlg.Control("edFruit")
Set oListbox = oDlg.Control("lstBasket")

If sControl = "btnAdd" Then
' sFruit = Trim(oEdit.Text)
sFruit = Trim(oEdit.Line(2))
If Len(sFruit) = 0 Then
MsgBox "No fruit to add!", 0, "Alert"
Else
oListBox.Add sFruit
iFruit = oListbox.Count
oListBox.FocusedIndex = iFruit
oEdit.Text = ""
End If
ElseIf sControl = "btnDelete" Then
iFruit = oListbox.FocusedIndex
If iFruit = 0 Then
MsgBox "No fruit to delete!", 0, "Alert"
Else
oListbox.Delete(iFruit)
If iFruit > oListbox.Count Then iFruit = iFruit - 1
oListBox.FocusedIndex = iFruit
End If
ElseIf sControl = "btnClose" Then
oDlg.Close
End If
HandleEvents = True
End Select
End Function

[End of FruitBasket.vbs]

[Content of FruitBasket.xml]
<wescriptui>
<dialog id='dlg' modal='yes'>Fruit Basket
<group>
<group>
<static shortcut='F'>Fruit:</static>
<editbox id='edFruit'></editbox>
<static shortcut='B'>Basket:</static>
<listbox id='lstBasket'></listbox>
</group>
<group justify='center'>
<button id='btnAdd' default='yes' widthclass='button'
shortcut='A'>Add</button>
<button id='btnDelete' widthclass='button' shortcut='D'>Delete</button>
<button id='btnClose' system='cancel' widthclass='button'
shortcut='C'>Close</button>
</group>
</group>
</dialog>

<strings>
<string id='Help_Text'>
This is a simple but nontrivial GUI program using the Window-Eyes
scripting capability. It is designed to meet the specifications of a fruit
basket program at
http://FruitBasketDemo.AlacornComputer.com

A dialog has several controls that interact at runtime.  An editbox is for
adding a fruit, e.g., apple.  A listbox serves as a basket for storing the
fruit.  Buttons are for adding a fruit (the default), deleting one, or
closing the dialog.

The fruit basket project has been a means for blind programmers to
illustrate how a GUI program is developed in a particular language.  The
same design specification enables the programs to be compared, both in
terms of the code needed, e.g., complexity and length, and in terms of the
resulting behavior, e.g., accessibility and performance.
</string>
</strings>
</wescriptui>

[End of FruitBasket.xml]

On Wed, 9 Jul 2008, Octavian Rasnita wrote:

> Date: Wed, 9 Jul 2008 23:16:14 +0300
> From: Octavian Rasnita <orasnita@xxxxxxxxx>
> Reply-To: programmingblind@xxxxxxxxxxxxx
> To: programmingblind@xxxxxxxxxxxxx
> Subject: Re: Fruit basket program in Window-Eyes scripting language
>
> I don't use Window Eyes, but I've seen that this program is a binary code
> that don't offer the source code.
> How can we see the source code?
>
> Octavian
>
> ----- Original Message -----
> From: "Jamal Mazrui" <empower@xxxxxxxxx>
> To: <programmingblind@xxxxxxxxxxxxx>; <program-l@xxxxxxxxxxxxx>
> Sent: Wednesday, July 09, 2008 6:10 PM
> Subject: Fruit basket program in Window-Eyes scripting language
>
>
> > http://gwmicro.com/scripts/Fruit_Basket
> >
> > This is a simple but nontrivial GUI program using the Window-Eyes
> > scripting capability. It is designed to meet the specifications of a fruit
> > basket program at
> > http://FruitBasketDemo.AlacornComputer.com
> >
> > A dialog has several controls that interact at runtime. An editbox is for
> > adding a fruit, e.g., apple. A listbox serves as a basket for storing the
> > fruit. Buttons are for adding a fruit (the default), deleting one, or
> > closing the dialog.
> >
> > The fruit basket project has been a means for blind programmers to
> > illustrate how a GUI program is developed in a particular language. The
> > same design specification enables the programs to be compared, both in
> > terms of the code needed, e.g., complexity and length, and in terms of the
> > resulting behavior, e.g., accessibility and performance.
> >
> > This fruit basket program requires Window-Eyes 7.0 beta 1, which is freely
> > available at
> > http://gwmicro.com
> >
> > Window-Eyes scripts can be written in any language that supports COM
> > automation.  This one is written in VBScript.  Almost any dialog can be
> > defined using the XML schema called wescriptui.  FruitBasket.xml defines
> > the controls with a syntax that involves no need for specific pixel
> > coordinates for location or size.
> >
> > As Far as I know, a fruit basket program is not possible with the
> > built-in features of any other screen reader.  Feel free to ask questions.
> >
> > Jamal
> >
> > __________
> > View the list's information and change your settings at
> > //www.freelists.org/list/programmingblind
> >
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: