I raised an issue here, but just in case somebody knows here. Do you know how to automate some tasks in OneNote using winim?
It looks like a python's minimal example goes like:
import win32com.client
onObj = win32com.client.gencache.EnsureDispatch('OneNote.Application.12')
result = onObj.GetHierarchy("",win32com.client.constants.hsNotebooks)
print(result)
I have tried:
import winim/com
comScript:
var obj = CreateObject("OneNote.Application.15")
obj.GetHierarchy("", 2) # hsNotebooks = 2
COM_FullRelease()
I get:
Error: unhandled exception: unsupported method: GetHierarchy [COMError]
Any idea?Thanks @adrianv,
I am not compiling to 32bits. But I tried some Excel and Word examples and they work fine (compiled in the same way).
I tried with OneNote.Application.12, OneNote.Application.15 and OneNote.Application. All of them fail.
GetHierarchy is still there because the python version works.
Regarding the last bullet, I missed it when I wrote the post. I will update it.
I think that it might be related with Late-/Early- bound IDispatch (which I don't understand). In the python example that I found, it uses .gencache.EnsureDispatch instead of Dispatch. I don't know if there is something equivalent in winim.