The GW-Scripting list is a discussion list for information regarding the development and use of Window-Eyes scripts. Any subscriber of the GW-Scripting list has the ability to post on-topic messages.
From:
Chip OrangeSubject:
a VBScript development environmentDate:
Sun, Dec 12, 2010 8:32:49 pmHi all,
I know this is tooting my own horn here, but I wanted to mention again that
for those who prefer scripting in VBScript, and who own any version of MS
Word, I have a script named MS Office which makes MS Word into a complete
window eyes development environment. It has features such as allowing you
to define all your variables with types, so that the intellisense option
will always give you a list of properties and methods each time you press
the dot key as you are entering or editing a line, and if you're typing an
expression involving an enumerated constant, it will also bring up a list of
possible constant values to choose from each time it's appropriate.
It does this by initially converting your VBScript to VBA, and then keeping
a VBA version for you to edit in the Word VBA development environment, and
creating a .vbs version from the VBA when it's time to publish your script.
It provides a global hotkey for you to bring up a list of your scripts to be
edited at any time, and it will start Word, and place you into the VBA
environment, with your script opened, after you use the global hotkey and
make your choice from the list of scripts.
Besides intellisense the VBA development environment has an object browser,
hotkeys for moving to the next and previous procedures, and a search and
replace function which can be limited to the current sub or function if
desired. It also does a syntax check on each line as you enter it, alerting
you to any errors. If you've ever worked in visual studio, you'll recognize
the environment immediately, as it's a simplified version.
Below is a short segment of some code from my MS Word script, just to show
you what VBScript with types can look like (it looks just like VB).
Remember that each time I pressed the dot key in the code below, I was given
a list of properties and methods to choose from, and I only had to type the
first couple of letters and press tab.
You can add any object type to the declarations portion of the environment
(it comes with window eyes already defined). It makes my scripting
enormously easier not having to look up everything. I also provide a list
of VBA environment hotkeys, in a Word document which is automatically
displayed when you use the global hotkey to open a script.
--------
Function textDialogEventHandler(dlg As Dialog, dlgEvent As DialogEvent, id
As String, _
ctrl As Control) As Boolean
' dialog event handler for the text shapes and frames dialog
Dim lst As Listbox
Dim edt As EditBox
Dim s As Shape ' Word object
Dim i, j As Integer
Dim f As Frame ' Word object
Dim descript
Dim staText As Static
Dim hasText As Boolean
textDialogEventHandler = False
Select Case id
Case "lst"
' the listbox of shapes and framed text
' intellisense automatically brings up a list of constants after typing the
equals sign below
If dlgEvent = listboxSelectionChange Then
' selection has changed, so update the related controls such as the editbox
of text
i = ctrl.SelectedItem
updateTextRelatedControlsFor (i)
textDialogEventHandler = True
Exit Function
End If
Case "btnGoTo"
' go to selected item
If dlgEvent = buttonClicked Then
Set lst = dlg.Control("lst")
i = lst.SelectedItem
j = relatedIndex(i)
Dim r As range
If isAShape(i) Then
' it's a shape/textbox
Set r = wordApp.ActiveDocument.shapes(j).TextFrame.TextRange
r.Select
wordApp.Selection.Collapse wdCollapseStart
I know this is tooting my own horn here, but I wanted to mention again that
for those who prefer scripting in VBScript, and who own any version of MS
Word, I have a script named MS Office which makes MS Word into a complete
window eyes development environment. It has features such as allowing you
to define all your variables with types, so that the intellisense option
will always give you a list of properties and methods each time you press
the dot key as you are entering or editing a line, and if you're typing an
expression involving an enumerated constant, it will also bring up a list of
possible constant values to choose from each time it's appropriate.
It does this by initially converting your VBScript to VBA, and then keeping
a VBA version for you to edit in the Word VBA development environment, and
creating a .vbs version from the VBA when it's time to publish your script.
It provides a global hotkey for you to bring up a list of your scripts to be
edited at any time, and it will start Word, and place you into the VBA
environment, with your script opened, after you use the global hotkey and
make your choice from the list of scripts.
Besides intellisense the VBA development environment has an object browser,
hotkeys for moving to the next and previous procedures, and a search and
replace function which can be limited to the current sub or function if
desired. It also does a syntax check on each line as you enter it, alerting
you to any errors. If you've ever worked in visual studio, you'll recognize
the environment immediately, as it's a simplified version.
Below is a short segment of some code from my MS Word script, just to show
you what VBScript with types can look like (it looks just like VB).
Remember that each time I pressed the dot key in the code below, I was given
a list of properties and methods to choose from, and I only had to type the
first couple of letters and press tab.
You can add any object type to the declarations portion of the environment
(it comes with window eyes already defined). It makes my scripting
enormously easier not having to look up everything. I also provide a list
of VBA environment hotkeys, in a Word document which is automatically
displayed when you use the global hotkey to open a script.
--------
Function textDialogEventHandler(dlg As Dialog, dlgEvent As DialogEvent, id
As String, _
ctrl As Control) As Boolean
' dialog event handler for the text shapes and frames dialog
Dim lst As Listbox
Dim edt As EditBox
Dim s As Shape ' Word object
Dim i, j As Integer
Dim f As Frame ' Word object
Dim descript
Dim staText As Static
Dim hasText As Boolean
textDialogEventHandler = False
Select Case id
Case "lst"
' the listbox of shapes and framed text
' intellisense automatically brings up a list of constants after typing the
equals sign below
If dlgEvent = listboxSelectionChange Then
' selection has changed, so update the related controls such as the editbox
of text
i = ctrl.SelectedItem
updateTextRelatedControlsFor (i)
textDialogEventHandler = True
Exit Function
End If
Case "btnGoTo"
' go to selected item
If dlgEvent = buttonClicked Then
Set lst = dlg.Control("lst")
i = lst.SelectedItem
j = relatedIndex(i)
Dim r As range
If isAShape(i) Then
' it's a shape/textbox
Set r = wordApp.ActiveDocument.shapes(j).TextFrame.TextRange
r.Select
wordApp.Selection.Collapse wdCollapseStart




