Hi
have asked this on astroart forum and not got very far
Then thought this may be the best option - SHARPCAP
is it possible to interact with an external dll from the script language - the reason I ask is I would like to control my Hitecastro power hub - specifically the dew heaters from scripting - I have done a little research but it is 5 years since I did any serious programming with windows and com etc so forgive my simple questions.
Hitecastro supply a dll and quote
Using mhpCOM.
mhpCOM can be used with any programming or scripting language which
supports COM interop. Examples are the .net languages from Microsoft. Visual
Basic.net, Visual C# .net and Visual C++ can be downloaded freely from the
Microsoft Visual Studio Express site. Many other languages and tools will also
be eminently suitable. Scripting languages such as VBScript or JavaScript can
also leverage the functionality of mhpCOM.
an example use from vbscript would be
Dim mhp
Set mhp = CreateObject(“mhpCOM.mhpCOM”)
or
Dim mhp
Set mhp = CreateObject(“mhpCOM.mhpCOM”)
mhp.Heater 3, 75
My question is
Is this easy from scripting?
If not what do I need to get into to achieve this?
Any other question that I cant think of due to my ignorance!?
many thanks
Keith Butterworth
Scripting and external dll
- admin
- Site Admin
- Posts: 13319
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Scripting and external dll
Hi Keith,
I think what you need is...
I'm fairly sure the first 3 lines are correct - the last is my guess based on your sample code - it may need tweaking.
cheers,
Robin
I think what you need is...
Code: Select all
from System import Activator
from System import Type
mhp = Activator.CreateInstance(Type.GetTypeFromProgID("mhpCOM.mhpCOM"))
mhp.Heater(3,75)
cheers,
Robin
-
- Posts: 38
- Joined: Tue Feb 14, 2017 7:53 pm
Re: Scripting and external dll
Thanks for replying - I will try that out after updating and installing necessary dll
Cheers Keith Butterworth
Cheers Keith Butterworth
-
- Posts: 38
- Joined: Tue Feb 14, 2017 7:53 pm
Re: Scripting and external dll
Hi no joy when I tried the commands
I got an error message which I have attached - I tried 1 or 2 variations of the syntax and always had the same error
.
The first 2 commands were accepted.
When I tried the smart context sensitive menus on the command it didn't seem to have picked anything up !?
Any suggestions
I got an error message which I have attached - I tried 1 or 2 variations of the syntax and always had the same error
.
The first 2 commands were accepted.
When I tried the smart context sensitive menus on the command it didn't seem to have picked anything up !?
Any suggestions
- Attachments
-
- screenshot.png (283.32 KiB) Viewed 4129 times
- admin
- Site Admin
- Posts: 13319
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Scripting and external dll
Hi,
it looks like the code
is not returning a valid object - that means that either the mhpCOM.mhpCOM string is incorrect or the DLL providing that object hasn't been registered correctly.
The following code demonstrates the basic technique with a COM object that will be correctly registered on your system
This wlll show a folder browser window.
You may find that registering your dll for COM helps fix your original problem - from an administrative command prompt run
Robin
it looks like the code
Code: Select all
Type.GetTypeFromProgID("mhpCOM.mhpCOM")
The following code demonstrates the basic technique with a COM object that will be correctly registered on your system
Code: Select all
from System import Activator
from System import Type
test = Activator.CreateInstance(Type.GetTypeFromProgID("Shell.Application"))
test.BrowseForFolder(0, "hello", 0)
You may find that registering your dll for COM helps fix your original problem - from an administrative command prompt run
Code: Select all
regsvr32 "<full path to your mhpcom.dll>"
-
- Posts: 38
- Joined: Tue Feb 14, 2017 7:53 pm
Re: Scripting and external dll
Robin
again thanks for your help
I will try your test code that should work and go from there
cheers
Keith
again thanks for your help
I will try your test code that should work and go from there
cheers
Keith