Hi Back Chip: Well, so far you are doing quite well actually. The process of creating tutorials from scratch is quite time consuming as I found out creating tutorials for building websites using Visual Web Developer.I found that to keep things organized and heading in a direction without having to sit down and plan an entire course out the best method was to pick a single application and then demonstrate diferent technicals by employing them within that appplication. That way the structure of the course sort of defines itself and saves you alot of time. For example: Once you have discussed the basics you might pick an application to build a script for. Then each class would concern the steps to create the script from how to look at the DOM, WEEVent script or Jamal's analysis script, to using the WEFramework to start a script. Then pick the first thing that could use scripting of any kind and document the steps on how to script that little piece of code - perhaps a hello world speak statement when the application opens. That gives you an automatic step by step structure to build upon week after week with a definite starting point and an end point anytime after the initial hello world version. You could script something as simple as Notepad or as complex as VWD or whatever else you might be familiar with. I would suggest Office or Word but you know that those packages cost cash and users are not likely to have them or the same versions. You could pick anything, perhaps one of the various FTP or other utility programs that are free downloads or just ask for ideas from the gang. Anyway, that is my idea and what I found worked well for a huge and complex subject as you are tackling. I am not saying you should do it or not, it is just a suggestion on something that worked for me to save me allot of confusion and time with another complex and large tutorial series.
See you tonight!
Rick USA
----- Original Message ----- From: "Chip Orange" <lists3...@comcast.net>
To: <gw-scripting@gwmicro.com>
Sent: Sunday, March 27, 2011 9:45 AM
Subject: RE: tomorrow's online scripting class


Hi Rick,

It is a good idea, but exactly how organized do you think I am? I'm usually
working on those examples right up to class time!  Still, here they are
below as it stands right now:


' class #6 examples:  (3/27/2011)



' example 1 (this was example 5 last week, but not discussed or documented
properly)
' display a list of all the files in a given folder, whose name is passed in
as a parameter to this sub.
' This uses an object supplied by Windows, so it's available to any
programming environment: the scripting.filesystemobject.
' this object is documented at the site:
http://msdn.microsoft.com/en-us/library/6kxy1a51(VS.85).aspx

' below is a sub you can call from within your app; it's meant for you to
call it specifying a folder name as the parameter.

sub ShowFolderList(folderspec)
' folder spec is a string, passed in, which is the name of the folder.

Dim fso, f, f1, fc, s

Set fso = CreateObject("Scripting.FileSystemObject") ' creates an fileSystem
object, but it has no data
Set f = fso.GetFolder(folderspec) ' creates a folder object, holding the
data from the given folder
Set fc = f.Files ' creates a files object, which is a "collection" of file
objects, holding data from the folder
' (a collection is an object which is something like an array in that it
holds a list of objects;
' but all of them must be the same type, and you don't "dimension" the list
ahead of time to tell it how many objects there may be
' (which means there is no limit to how many are in the list)).


' now loop through all the files in the "collection",
' adding their names to a growing string, with a carriage return after each
name.

' you can use a special command to loop through collections, it is the "FOR
EACH ... NEXT" loop,
' and you don't have to use numbered indexes to get to each member of the
collection; instead, each member is put into a temporary loop control
variable.
' (note: the FOR EACH loop will also work just as well on arrays, but it
does count on every element in the array having some data).


s = ""
For Each f1 in fc
' f1 is the temporary loop control variable,
' and holds the current file object from the collection the loop is
currently processing.
 s = s & f1.name & vbCR
' adds the name from the current file object to the string of file names
being built and follows it with a carriage return
Next

msgBox "This directory has " & fc.count & " files:"  & vbcr & s
' collections almost always have a .count property

Set fso  = nothing
set f = nothing
Set fc  = nothing

End sub

' note that when working with collections, the order of their members might change (say a new file is added to a directory; it might appear as the first
collection member).
' This isn't true of arrays; it's assumed an element's numerical index in
the array will stay the same while working with the array.

' end of example 1


' example 2
' using a WE object model object (which are *all* built-in).

' main body


Dim myHotkey
' below uses a method of the built-in WE keyboard object to associate a
hotkey with a subroutine of your app
Set myHotkey = Keyboard.RegisterHotkey ("Control-Shift-1", "hotkeyHandler")
' it's important to know the result of the registerHotkey method (or
function) must be stored in a global variable or it will not work properly.

' the keyboard object is one of the "root level" objects; that is, not only is it built-in, but you do not have to go through any other object to get to
it.
' the "root level" objects are all the properties and methods of the
window-eyes application object (found in the app developers manual).
' "root level" objects are described and listed in the GW wiki article at:
http://www.gwmicro.com/mediawiki/index.php/So_you_want_to_write_a_script%3F

' end of main body


Sub hotkeyHandler()
' this sub is called when the hotkey is pressed.
' (this is very much like an event handler, but is called a "callback").

MsgBox "Hello World!"
End Sub

' end of example 2


' example 3
' shows an event handler.
' this uses the WE built-in SPEECH object, and it's onSpeak event.

' Determines if the selected synthesizer is the DECtalk Access32
(Window-Eyes), and if so
' prepends the phrase "DECtalk Says:" to the string about to be spoken.

' main body



ConnectEvent Speech, "OnSpeak", "OnSpeak"

' end of main body



Function OnSpeak(originalString)
' event handler for the onSpeak event.

OnSpeak = originalString
' returns the original string (so it will be spoken), in case it's not
dec-talk speaking

If Synthesizer.Description = "DECtalk Access32 (Window-Eyes)" Then
       OnSpeak = "DECtalk Says: " & originalString
End If

End Function
' Now, every string spoken when the DECtalk Access32 (Window-Eyes)
synthesizer is selected
' will begin with "DECtalk Says."


' end of example 3


' example 4
' shows an event handler using the QUEUE method.
' this uses the same event as example 3, but it needs to do something which
takes a little time;
' and this is not allowed in an event-handler, so you must use the "QUEUE"
method, to cause the time-consuming portion to be executed later.

' main body

dim onSpeakID

onSpeakID = ConnectEvent (Speech, "OnSpeak", "OnSpeak")
' onSpeakID now holds an identifier for this event handling which can be
used to stop handling this event by passing it to the DISCONNECT method.

' end of main body



Function OnSpeak(originalString)
' event handler for the onSpeak event.
' it looks for lines which mention Chip Orange, and if found, writes them to
the end of a file.

OnSpeak = originalString
' returns the original string (so it will be spoken), in case it's not
dec-talk speaking
IF inStr(UCase(originalString), "CHIP ORANGE") then
' this line mentions Chip Orange
' need to write this line to the end of a file, but that would take too long
in an event handler,
' so delay a sub for execution later, in a separate thread, to do this.
 queue "saveString", originalString
end if

End Function



sub saveString(theLine)
' appends this string to the end of a specific file
' this gets executed by the queue method, so it happens a fraction of a
second later, and sort of in a separate program, not where and when the
command is placed.

dim oText, oFS


Set oFS = CreateObject("Scripting.FileSystemObject") ' creates an fileSystem
object, but it has no data
Set oText = oFS.OpenTextFile("c:\temp\lines.txt", 8, False) ' 8 is the
appending mode of opening
oText.WriteLine (theLine) ' appends the line to the file
oText.close

set oText = nothing
set oFS = nothing

end sub


' end of example 4





-----Original Message-----
From: RicksPlace [mailto:ofbgm...@mi.rr.com]
Sent: Sunday, March 27, 2011 7:49 AM
To: gw-scripting@gwmicro.com
Subject: Re: tomorrow's online scripting class

Hi Chip: The classes are going fine. My only idea would be to release the
sample code or documents one day prior to the class on your site. That way
we could load them up, read through them to formulate questions in our mind and do a little browsing of the Windoweyes Documentation prior to the class.

It would also allow us to ask questions or allow you to comment on code in a
particular line of code or group of lines of code.
If everyone has the same code blocks and line numbers in their editors we
could alt tab to the code samples and step through them one line at a time
with you as you describe what is going on.
That is just a thought and I might bring it up tonight or you can mention it
or just tell me if not a good idea so I don't bring it up or whatever...
I'm easy and grayteful you are doing this for us and just want to be
helpful.
Rick USA
----- Original Message -----
From: "Chip Orange" <lists3...@comcast.net>
To: <gw-i...@gwmicro.com>; <gw-scripting@gwmicro.com>
Sent: Saturday, March 26, 2011 6:05 PM
Subject: tomorrow's online scripting class


Hi all,

just an FYI that in tomorrow's online scripting class, we'll be moving
away from basic VBScript programming, and into object-oriented
programming, using window-eyes objects for examples, and discussing
the differences between the window-eyes VBScript environment and the
standard VBScript environment.

we're beginning to cover all of the window-eyes objects, and examples
which show how they're used, and how a scripter would go about solving
various types of problems.

Anyone wishing to participate in the live online TeamTalk class can
drop me an email for the scripting.tt file to be used with TeamTalk at
7 pm on Sunday evenings, EDT.

Those who wish to follow the class using the recordings can obtain the
audio archives from the site at:

http://acorange.home.comcast.net/scripting

there's also an RSS link there for those who use podcasting agrogators.

It's my opinion however, especially as we move out of standard
VBScript, and into WE specific scripting, that everyone will get more
out of the classes if you show up to the live sessions and ask
questions.  You're welcome to ask your favorite script author if
he/she will take a session and talk about a topic of interest.


I'd appreciate hearing from those who are following the audio
archives/podcasts as to how well you're finding the classes: are we going
too fast or too slow, etc.

thanks.

Chip
acora...@comcast.net





Reply via email to