Well, that makes about as much sense as using Let rather then Set.
The MSDN documentation says that Set, "sets a reference to an object."
The MSDN documentation says that Let, "assigns (sets) the value of a
property."
Someone over there needs flogged a bit. The only drawback I can see from
the solution below is if the private variable could take either an
object or non-object, but if you're doing that, perhaps you need flogged
as well.
The solution for the toolkit is to bypass Let and Set altogether and
instead make the property a public variable, then do type checking when
that variable is used.
Aaron
On 4/21/2010 12:28 AM, Doug Lee wrote:
This is a weird one, and I'm not sure what sorts of side effects might
happen with this, but you can make it work by adding a Property Let.
You do need both Property Let and Property Set, interestingly enough.
It remains to be tested what effect this has on trying to let/set that
property from the VBScript side.
The following version will print "FileSystemObject," proving that the
property set actually worked.
<job id="SharedObjectExample">
<script language="VBScript">
Class MyClassDefinition
Private theObject
Public Sub Class_Initialize()
Set theObject = Nothing
End Sub
Public Property Get KeyStrings()
Set KeyStrings = theObject
End Property
Public Property Set KeyStrings(stringObj)
Set theObject = stringObj
End Property
Public Property Let KeyStrings(stringObj)
Set theObject = stringObj
End Property
Public Property Get ObjType()
ObjType = TypeName(theObject)
End Property
End Class
Function CreateMyClass()
Set CreateMyClass = New MyClassDefinition
End function
</script>
<script language="JScript">
x = CreateMyClass();
fsObj = new ActiveXObject("Scripting.FileSystemObject");
x.KeyStrings = fsObj
WScript.Echo(x.ObjType)
</script>
</job>
On Tue, Apr 20, 2010 at 05:09:58PM -0400, Aaron Smith wrote:
This problem appears to be unrelated to Window-Eyes. Using WSF, I can
demonstrate this problem between VBScript and JScript without
Window-Eyes involved:
<job id="SharedObjectExample">
<script language="VBScript">
Class MyClassDefinition
Private theObject
Public Sub Class_Initialize()
Set theObject = Nothing
End Sub
Public Property Get KeyStrings()
Set KeyStrings = theObject
End Property
Public Property Set KeyStrings(stringObj)
Set theObject = stringObj
End Property
End Class
Function CreateMyClass()
Set CreateMyClass = New MyClassDefinition
End function
</script>
<script language="JScript">
x = CreateMyClass();
fsObj = new ActiveXObject("Scripting.FileSystemObject");
x.KeyStrings = fsObj
</script>
</job>
Run this, as you will get the same "Object doesn't support this
property or method" on the line x.KeyStrings = fsObj.
VBscript to VBScript works. JScript to JScript works. VBScript to
JScript works. But JScript to VBScript does not.
Fortunately, I can work around this issue in the toolkit, and will do
so in a future version.
Aaron
On 4/19/2010 4:25 PM, Cory Samaha wrote:
Ok, thanks much.
From: Aaron Smith [[1]mailto:[email protected]]
Sent: Monday, April 19, 2010 4:20 PM
To: [2][email protected]
Subject: Re: accessing the GW Toolkit from JScript
Cory,
I can now duplicate what you're talking about. Let me do some
investigation.
Aaron
On 4/19/2010 4:03 PM, Cory Samaha wrote:
Aaron,
When I do print(Utilities.TypeName(x)); I get HotkeyManagerClass and
when I do print(Utilities.TypeName(theStrings)); I get Dictionary
From: Aaron Smith [[3]mailto:[email protected]]
Sent: Monday, April 19, 2010 3:55 PM
To: [4][email protected]
Subject: Re: accessing the GW Toolkit from JScript
Cory,
What do you get back if you use the Window-Eyes TypeName method, like
this:
print(Utilities.TypeName(x));
Aaron
On 4/19/2010 3:49 PM, Cory Samaha wrote:
Ah, got it. Now I'm back to the same message Error: Object doesn't
support this property or method. Below is the output of what I typed
in Immed.
x = SharedObjects("com.GWMicro.GWToolkit.HotkeyManager").NewDialog();
x.IniFileName = "blah.ini";
x.IniSectionName = "hotkeys";
theStrings = strings("AIM.xml");
print(typeof(theStrings));
object
x.KeyStrings = theStrings;
Error: Object doesn't support this property or method
From: Aaron Smith [[5]mailto:[email protected]]
Sent: Monday, April 19, 2010 3:40 PM
To: [6][email protected]
Subject: Re: accessing the GW Toolkit from JScript
Sorry, I was going from memory. Use theStrings rather than myStrings,
as myStrings is already defined in the Immed script.
Aaron
On 4/19/2010 2:59 PM, Cory Samaha wrote:
Aaron,
When I do typeof(myStrings); I get back that it's of type object. Did
you say this ran fine for you in immed? I was trying this in a
jScript .js file that I was writing, but just to compare I just tried
launching the hotkey manager in immed as well and didn't have much
luck there either. As soon as I tried to execute the line that says
x.KeyStrings = myStrings; I get the following
immed.js - Microsoft JScript runtime error
Line 187 Column 5
'undefined' is null or not an object
< 0x800A138F>
So either way, both typing this out in immed or from a regular .js
file that I run from the WE script manager, I can't get this to work.
-Cory
From: Aaron Smith [[7]mailto:[email protected]]
Sent: Monday, April 19, 2010 9:07 AM
To: [8][email protected]
Subject: Re: accessing the GW Toolkit from JScript
Cory,
What do you get for the type of myStrings?
Aaron
On 4/19/2010 8:52 AM, Cory Samaha wrote:
Aaron,
I tried
x.KeyStrings = myStrings; and I get
Object doesn't support this property or method
< 0x800A01B6>
In fact, I first tried this without the parentheses and when I was
unsuccessful I moved on to including parentheses.
-Cory
From: Aaron Smith [[9]mailto:[email protected]]
Sent: Monday, April 19, 2010 8:45 AM
To: [10][email protected]
Subject: Re: accessing the GW Toolkit from JScript
Cory,
KeyStrings is a property, not a method, so you don't need the
parenthesis. The following works for me in Immed:
x = SharedObjects("com.GWMicro.GWToolkit.HotkeyManager").NewDialog();
x.INIFileName = "blah.ini";
x.INISectionName = "Hotkeys";
myStrings = Strings("blah.xml");
x.KeyStrings = myStrings;
Aaron
On 4/18/2010 5:29 AM, Cory Samaha wrote:
Greetings all,
What is the accepted approach for accessing the GW Toolkit from a
Window-Eyes hosted JScript script? In the following lines of code, I'm
trying to launch the hotkey manager. I haven't gotten to add keys yet, I
just want to make sure I can launch it first. The following produces an
error. Note that myStrings is a variable previously defined and I have
confirmed that it works as it should.
var hotkeyManager =
SharedObjects("com.GWMicro.GWToolkit.HotkeyManager").newDialog();
hotkeyManager.INIFileName = iniFileName;
hotkeyManager.INISectionName = "Hotkeys";
hotkeyManager.KeyStrings() = myStrings;
I'm getting an error on the line that says hotkeyManager.KeyStrings() =
myStrings; which says
Cannot assign to a function result
< 0x800A138B>
In the GW toolkit documentation examples which use VBScript syntax, I've
seen places where keyStrings() is used both with and without parentheses
after it. I know that VBScript is less picky about the inclusion of
parentheses, but just in case, I tried that line omitting the parentheses as
in the following line.
hotkeyManager.KeyStrings = myStrings;
Now I get the following error.
Object doesn't support this property or method
< 0x800A01B6>
So, obviously there is some syntax I'm not getting right. Has anyone ever
tried to do this? Any thoughts?
Thanks,
Cory
--
Aaron Smith
Product Support Specialist * Web Development
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com
To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.
--
Aaron Smith
Product Support Specialist * Web Development
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com
To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.
--
Aaron Smith
Product Support Specialist * Web Development
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com
To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.
--
Aaron Smith
Product Support Specialist * Web Development
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com
To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.
--
Aaron Smith
Product Support Specialist * Web Development
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com
To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.
--
Aaron Smith
Product Support Specialist * Web Development
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com
To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.
References
1. mailto:[email protected]
2. mailto:[email protected]
3. mailto:[email protected]
4. mailto:[email protected]
5. mailto:[email protected]
6. mailto:[email protected]
7. mailto:[email protected]
8. mailto:[email protected]
9. mailto:[email protected]
10. mailto:[email protected]
--
Aaron Smith
Product Support Specialist * Web Development
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com
To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.