Hey thanks, Ron.
When I came into the office this morning, I found an apparent later
version of this test script and it has the actual concepts you write
about here. So you may have very well explained this once before but my
stuff at home didn't reflect this great wisdom. My test script works
fine where it uses both $Application and $Speech. I added one reference
to ClientInformation and the description shows up in the WE Script
Manager so I guess this perl stuff can go off to the races now. I want
to incorporate your OnError handler in any of my future scripts to cover
those otherwise hidden errors. Though over the weekend, I did see some
of the perl script related errors showing up in the WE error dialog. So
maybe that area has improved some over the past eight months or so.
I might keep some of the win32 API stuff around for posting simple
dialogues inf/when the WE dialogues can't be established or when I'm too
lazy to build a custom one.
Ron Parker wrote:
Yes, any ActiveScript language should have those three objects
predefined. How you access them may depend on the language. VBScript
has them defined, too; it's just that when we define them, we also ask
VBScript to define all of their members as well, so instead of writing
Application.Version you can just write Version.
Win32::OLE works just fine in internal scripts, too. It just doesn't
provide access to ClientInformation.
In regular Perl, in an external script, you would use Win32::OLE like
Steve did, but you'd need to call ClientIdentify so that Window-Eyes can
create and associate an appropriate ClientInformation object.
ClientIdentify doesn't do anything in internal scripts, because
Window-Eyes does different things when it starts up external scripts
than it does when it starts up internal ones.
Jamal Mazrui wrote:
Are such variables defined automatically for other Active Script
languages, e.g., Active Python? What if someone is coding in regular
Perl, will Win32::OLE work?
Jamal
On Mon, 23 Feb 2009, Ron
Parker wrote:
Date: Mon, 23 Feb 2009 11:07:19 -0500
From: Ron Parker <[email protected]>
Reply-To: [email protected]
To: [email protected]
Subject: Re: Using PerlScript
A few notes:
- You should not need to use Win32::OLE if you're using ActiveState
PerlScript. When your script runs, it should already have three objects
defined in $Application, $Speech, and $Script. $Application is the one
you want to use wherever you're currently using $we.
- If you do create a new WindowEyes.Application object rather than using
the predefined $Application, you will indeed find that ClientInformation
is undefined. Use the Application object that's provided, and it'll be
hunky-dory.
- The second parameter to RegisterHotkey is the name - and only the name
- of the function or subroutine to be called; in this case that should
be "hello" rather than "hello()".