1

Hi everyone, I have a problem with this simple code I grabbed from the internet (it's just a small extract):

Dim chsr As Object
Dim id As String
Dim m_scope As Telescope

On Error GoTo noascom
Set chsr = New DriverHelper.Chooser
chsr.DeviceType = "Telescope"
you can remember the telescope ID and set it to give you the last one used
id = chsr.Choose(id)  
Set m_scope = CreateObject(id) '<--- <--- <---- <---- <---- <----'
' connect to the telescope'
m_scope.Connected = True

Although it works with telescope simulator, with MeadeEx.Telescope driver it gives the "error 13 - type mismatch" at highlighted line. Can anyone find the problem?

flag
THe basic problem is then, this one line script will fail: Set T = CreateObject("MeadeEx.Telescope") is that correct? – Bob Denny Mar 5 at 3:59
yes you got it! I try to explain better the problem: on my pc (windows xp) I can try only the simulator (I don't have any ASCOM compliant telescope), and it works with this code. I e-mailed the software to a friend (windows vista) who has that meade telescope and he found this error. I did't expect a "type mismatch error" because if the code is correct on my pc, how is it possible that it's not correct on his one? – andreaconsole Mar 5 at 15:52
update: if my friend uses the simulator, the code works also on his pc. So what is the difference? Is it a problem with Meade driver? – andreaconsole Mar 6 at 0:09

2 Answers

2

I don't believe this is necessarily a problem with the driver. I have duplicated the problem using a VB6 client and the V1 AstroPhysics telescope driver. The problem seems to be in the type definition for the object returned from CreateObject ("My_Telescope_Name"). If the return is stored in a variable of type 'Object', it works fine. But if the return is stored in a variable typed as AscomInterfacesLib.ITelescope, the type mismatch error occurs. In other words:

' This works 
Dim oMyScope as Object
Set oMyScope = CreateObject ("MyOldDriver")

' This will generate a VB type mismatch in a VB6 client
Dim oMyScope as AscomInterfacesLib.ITelescope
Set oMyScope = CreateObject ("MyOldDriver")

I'm using the fully-qualified name of 'ITelescope' just for clarity. I'm running on the Ascom 5.5 platform, and the V1 AP driver installation preceded that upgrade. I suspect many apps don't use the 'ITelescope' type as it is now defined in the 'Ascom Master Interfaces' type library of Platform 5.5, so this could explain why many of them (e.g. PHD) still work ok with the older drivers. Hope this helps to track down the problem.

link|flag
thank you very much! You found the solution! – andreaconsole Apr 8 at 22:12
1

Based on the info in the comments to the question, this is a problem with the driver. I will guess that it is due to the ',' being the decimal point in your Windows OS "locale" definition. Does your friend run on the same language/locale? If so, then the fix might be to edit the saved info for the driver.

Only if you are on a language that used ',' decimal point: If you are on ASCOM 5.5 (I hope :-)) open the Profile Explorer and navigate to the info for the Meade Telescope and Focuser. Look through the values stored there and see if any have a '.' for the decimal point. If so change the '.' to a ','. Now try the driver. If that doesn't work, go back and change things back to the way they were.

link|flag
As an extension of Bob's answer, yes - this must be a problem with the MeadeEx driver. The code snippet above has no 'type information', everything is late bound and dynamic. So the code above should work whatever the type returned by CreateObject. The error must, therefore, be in the driver. Unfortunately the error messages in VB can be a little unhelpful at times. – Tim Long Mar 6 at 12:08
thank you, Bob and Tim! Unfortunately the solution proposed seems not to work. I can not understand, however, why the driver works with other programs, i.e. PHD guiding software :S – andreaconsole Mar 6 at 14:45
Andrea - Does PHD use the ASCOM driver? Or does it have internal LX200 control code maybe? – Bob Denny Mar 7 at 12:26
yes, it uses ASCOM driver. And also other software like PemPro or Equalign seems to use this driver successfully... who knows? – andreaconsole Mar 7 at 13:49
Andrea: Just to be certain, please create a file called test.vbs and in it put the following Set X = CreateObject("MeadEx.Telescope") Save the file and double-click it. What happens? – Bob Denny Mar 7 at 21:25
show 2 more comments

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.