Giter Site home page Giter Site logo

onenote-to-markdown's Introduction

onenote-to-markdown's People

Contributors

avanlex avatar darthwalsh avatar erezak avatar stephengrice avatar winterreisender avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

onenote-to-markdown's Issues

Does not work with "OneNote for Windows 10"

Problem

There are two types of OneNote applications a user can have installed on their PC:

  1. OneNote
  2. OneNote for Windows 10

When using "OneNote for Windows 10" and running convert.py, the application will throw the following message !!!Error!!! Hint: Make sure OneNote is open first..

TODO

  • Create some sort of error checking to detect different application types
    • An better solution would be to add functionality for both types of OneNote application types

Running convert3.ps1 sees COM error...

I opened the OneNote.
Then I just run the .\convert3.ps1 in the repo.

After a while, I saw below error.

New-Object : Retrieving the COM class factory for component with CLSID {DC67E480-C3CB-49F8-8232-60B0C2056C8E} failed
due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005
(CO_E_SERVER_EXEC_FAILURE)).
At C:\D\sources2\onenote-to-markdown\convert3.ps1:7 char:12
+ $OneNote = New-Object -ComObject OneNote.Application
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [New-Object], COMException
    + FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand

You cannot call a method on a null-valued expression.
At C:\D\sources2\onenote-to-markdown\convert3.ps1:9 char:1
+ $OneNote.GetHierarchy("", [Microsoft.Office.InterOp.OneNote.Hierarchy ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Retrieving the COM class factory for component with CLSID {DC67E480-C3CB-49F8-8232-60B0C2056C8E} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

onenote-to-markdown> .\convert3.ps1

`
New-Object : Retrieving the COM class factory for component with CLSID {DC67E480-C3CB-49F8-8232-60B0C2056C8E} failed due to the following error: 80080005 Server
execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
At C:\Notebooks\Polytek\onenote-to-markdown\convert3.ps1:7 char:12

  • $OneNote = New-Object -ComObject OneNote.Application
  •        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ResourceUnavailable: (:) [New-Object], COMException
    • FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand

You cannot call a method on a null-valued expression.
At C:\Notebooks\Polytek\onenote-to-markdown\convert3.ps1:9 char:1

  • $OneNote.GetHierarchy("", [Microsoft.Office.InterOp.OneNote.Hierarchy ...
  •   + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
    

`

Image embeddings problem

I used the script on win11 with the intention to import my older OneNote-notes in Obsidian.
It worked well, except for the images.

Obsidian doesn't recognize for example:
![](media/image1.png){width="9.604166666666666in" height="0.34375in"}

image

  • the image-names aren't unique, i got the image-names like "image001" again and again for each folder which I think creates problems when linking in Obsidian.

Just as a personal feedback :) thanks for creating and sharing the script

Unable to find type [Microsoft.Office.InterOp.OneNote.HierarchyScope].

Hello Using powershell7 with onenote for windows 10 and am receiving the following error (see below). I have set my policy to unrestricted and installed python3 and Pandoc , my os is Win10 pro

InvalidOperation: C:\Users\username\onenote-to-markdown\convert3.ps1:9
Line |
9 | โ€ฆ erarchy("", [Microsoft.Office.InterOp.OneNote.HierarchyScope]::hsPage โ€ฆ
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unable to find type [Microsoft.Office.InterOp.OneNote.HierarchyScope].

Thank you

Converter Failing on a Page

I'm getting this error:

!!WARNING!! Page Failed: C:\Users\jason\Desktop\OneNoteExport\Jason_K_s_Notebook\Health\015_Enneagram_Personality_Result___Type_4w3.md
!!WARNING!! Page Failed: C:\Users\jason\Desktop\OneNoteExport\Jason_K_s_Notebook\Health\016_Five_Minute_Journal___Daily_Journal_Techniques_and_Tips.md
!!WARNING!! Page Failed: C:\Users\jason\Desktop\OneNoteExport\Jason_K_s_Notebook\Health\017_Vaccination_Card_3_shots.md
Traceback (most recent call last):
  File "C:\Users\jason\GitHub\onenote-to-markdown\convert.py", line 121, in <module>
    handle_element(onenote, child)
  File "C:\Users\jason\GitHub\onenote-to-markdown\convert.py", line 101, in handle_element
    handle_element(onenote, c2, os.path.join(path, safe_str(elem.attrib['name'])), i)
  File "C:\Users\jason\GitHub\onenote-to-markdown\convert.py", line 103, in handle_element
    hier2 = onenote.GetHierarchy(elem.attrib['ID'], win32.constants.hsPages, "")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jason\AppData\Local\Temp\gen_py\3.11\F2A7EE29-8BF6-4A6D-83F1-098E366C709Cx0x1x0\IApplication.py", line 63, in GetHierarchy
    return self._ApplyTypes_(1610743808, 1, (24, 0), ((8, 1), (3, 1), (16392, 2)), 'GetHierarchy', None,bstrStartNodeID
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jason\GitHub\onenote-to-markdown\.venv\Lib\site-packages\win32com\client\__init__.py", line 572, in _ApplyTypes_
    self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.com_error: (-2147023174, 'The RPC server is unavailable.', None, None)
!!!Error!!! Hint: Make sure OneNote is open first.

OneNote is open but something causes it to close causing the RPC error. Nothing gets written the desktop either.

There needs to be some error handling. I'm reviewing the youtube video and seeing if I need to clear anything. I'm using OneNote for Windows 11 and everything is updated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.