Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating Com Object
#1
I'm trying to convert this AHK script to QM code. It mimics a Dragon voice command when the user presses a hotkey.

F1::
DgnEngine:= ComObjCreate("Dragon.DgnEngineControl")
DgnEngine.Register(0)
DgnEngine.RecognitionMimic("select next paragraph")

I know how to do the keyboard hook part and if I understand correctly I don't have to register DgnEngine in QM. So would the first line then be something like?:
Code:
Copy      Help
._create("Dragon.DgnEngineControl")

And what about the RecognitionMimic part, is there an equivalent to this in QM?

Thanks.
#2
check com libraries first
on qm window click Tools then COM Libraries
it will open this window
   
check to see if its listed there if its not will most likely need to register it.
May need to copy the type library to qm folder
if it's listed then select it in the list and then click
Insert declaration from list button
it will insert the typelib code in your function
if the word after typelib is black then need to compile first (Ctrl+Shift+R)
then you can see the library and its functions when you type a period.
example using excel

Function ExampleExcel
Code:
Copy      Help
typelib Excel {00020813-0000-0000-C000-000000000046} 1.6

Excel.Application exApp
exApp._getactive
;or
;exApp._getfile
;or
;exApp._create
#3
Also possible without type libraries.

example with Excel
Macro Macro24
Code:
Copy      Help
IDispatch d._create("Excel.Application")
d.Visible=1
3
d.Quit()

example with Dragon
Macro Macro24
Code:
Copy      Help
IDispatch DgnEngine._create("Dragon.DgnEngineControl")
DgnEngine.Register(0)
DgnEngine.RecognitionMimic("select next paragraph")
#4
Thank you both! This is very helpful. And it's working :-)


Forum Jump:


Users browsing this thread: 1 Guest(s)