SjoerdV / ConvertOneNote2MarkDown

Ready to make the step to Markdown and saying farewell to your OneNote, EverNote or whatever proprietary note taking tool you are using? Nothing beats clear text, right? Read on!
GNU General Public License v3.0
196 stars 113 forks source link

What's going wrong here? (apart from the Markdown markup) #5

Closed ghost closed 3 years ago

ghost commented 3 years ago
PS C:\Users\Toontje\ConvertOneNote2MarkDown> .\ConvertOneNote2MarkDown.ps1
Enter the (preferably empty!) folder path (without trailing backslash!) that will contain your resulting Notes structure. ex. 'c:\temp\notes': ~/export

Ton @ Sites - Company Inc

    Directory: C:\Users\Toontje\export

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         7/7/2020   5:09 PM                Ton_@_Sites_-_Company_Inc
==============
## Customers
## Tech
--------------
### Quick Notes

    Directory: C:\Users\Toontje\export\Ton_@_Sites_-_Company_Inc

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         7/7/2020   5:09 PM                Quick_Notes
#### Lab
Error while publishing file 'Lab' to docx: Exception calling "Publish" with "4" argument(s): "Exception from HRESULT: 0x80042006"
pandoc.exe: ~/export\Ton_@_Sites_-_Company_Inc\Quick_Notes\Lab.docx: openBinaryFile: does not exist (No such file or directory)
Get-Content : Cannot find path 'C:\Users\Toontje\export\Ton_@_Sites_-_Company_Inc\Quick_Notes\Lab.md' because it
does not exist.
At C:\Users\Toontje\ConvertOneNote2MarkDown\ConvertOneNote2MarkDown.ps1:192 char:19
+ ...           ((Get-Content -path "$($fullexportpathwithoutextension).md" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\Ton Ma...ck_Notes\Lab.md:String) [Get-Content], ItemNotFoundEx
   ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

Error while renaming image file path references for file 'Lab': You cannot call a method on a null-valued expression.
#### Company Wifi
Error while publishing file 'Company Wifi' to docx: Exception calling "Publish" with "4" argument(s): "Exception from HRESULT: 0x80042006"
pandoc.exe: ~/export\Ton_@_Sites_-_Company_Inc\Quick_Notes\Company_Wifi.docx: openBinaryFile: does not exist (No such file or directory)
Get-Content : Cannot find path 'C:\Users\Toontje\export\Ton_@_Sites_-_Company_Inc\Quick_Notes\Company_Wifi.md'
because it does not exist.
At C:\Users\Toontje\ConvertOneNote2MarkDown\ConvertOneNote2MarkDown.ps1:192 char:19
+ ...           ((Get-Content -path "$($fullexportpathwithoutextension).md" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\Ton Ma...\Company_Wifi.md:String) [Get-Content], ItemNotFoundEx
   ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

Error while renaming image file path references for file 'Company Wifi': You cannot call a method on a null-valued expression.
#### JOIN WEBEX MEETING
Error while publishing file 'JOIN WEBEX MEETING' to docx: Exception calling "Publish" with "4" argument(s): "Exception from HRESULT: 0x80042006"
pandoc.exe: ~/export\Ton_@_Sites_-_Company_Inc\Quick_Notes\JOIN_WEBEX_MEETING.docx: openBinaryFile: does not exist (No such file or directory)
Get-Content : Cannot find path 'C:\Users\Ton
Machielsen\export\Ton_@_Sites_-_Company_Inc\Quick_Notes\JOIN_WEBEX_MEETING.md' because it does not exist.
At C:\Users\Toontje\ConvertOneNote2MarkDown\ConvertOneNote2MarkDown.ps1:192 char:19
+ ...           ((Get-Content -path "$($fullexportpathwithoutextension).md" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\Ton Ma...EBEX_MEETING.md:String) [Get-Content], ItemNotFoundEx
   ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

Error while renaming image file path references for file 'JOIN WEBEX MEETING': You cannot call a method on a null-valued expression.
--------------
### Personal
d-----         7/7/2020   5:09 PM                Personal
#### Home network
Error while publishing file 'Home network' to docx: Exception calling "Publish" with "4" argument(s): "Exception from HRESULT: 0x80042006"
pandoc.exe: ~/export\Ton_@_Sites_-_Company_Inc\Personal\Home_network.docx: openBinaryFile: does not exist (No such file or directory)
Get-Content : Cannot find path 'C:\Users\Toontje\export\Ton_@_Sites_-_Company_Inc\Personal\Home_network.md'
because it does not exist.
At C:\Users\Toontje\ConvertOneNote2MarkDown\ConvertOneNote2MarkDown.ps1:192 char:19
+ ...           ((Get-Content -path "$($fullexportpathwithoutextension).md" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\Ton Ma...Home_network.md:String) [Get-Content], ItemNotFoundEx
   ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

Error while renaming image file path references for file 'Home network': You cannot call a method on a null-valued expression.
ghost commented 3 years ago

BTW, great initiative. I really need this to move away from OneNote.

SjoerdV commented 3 years ago

“~/export” Is not a valid path... please type a full and existing absolute path as target

ghost commented 3 years ago

When using c:\export i get the same:

PS C:\Users\Toontje\ConvertOneNote2MarkDown> .\ConvertOneNote2MarkDown.ps1
Enter the (preferably empty!) folder path (without trailing backslash!) that will contain your resulting Notes structure. ex. 'c:\temp\notes': ~/export

Ton @ Sites - Company Inc

    Directory: C:\Users\Toontje\export

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         7/7/2020   5:09 PM                Ton_@_Sites_-_Company_Inc
==============
## Customers
## Tech
--------------
### Quick Notes

    Directory: C:\Users\Toontje\export\Ton_@_Sites_-_Company_Inc

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         7/7/2020   5:09 PM                Quick_Notes
#### Lab
Error while publishing file 'Lab' to docx: Exception calling "Publish" with "4" argument(s): "Exception from HRESULT: 0x80042006"
pandoc.exe: ~/export\Ton_@_Sites_-_Company_Inc\Quick_Notes\Lab.docx: openBinaryFile: does not exist (No such file or directory)
Get-Content : Cannot find path 'C:\Users\Toontje\export\Ton_@_Sites_-_Company_Inc\Quick_Notes\Lab.md' because it
does not exist.
At C:\Users\Toontje\ConvertOneNote2MarkDown\ConvertOneNote2MarkDown.ps1:192 char:19
+ ...           ((Get-Content -path "$($fullexportpathwithoutextension).md" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\Ton Ma...ck_Notes\Lab.md:String) [Get-Content], ItemNotFoundEx
   ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

Error while renaming image file path references for file 'Lab': You cannot call a method on a null-valued expression.
#### Company Wifi
Error while publishing file 'Company Wifi' to docx: Exception calling "Publish" with "4" argument(s): "Exception from HRESULT: 0x80042006"
pandoc.exe: ~/export\Ton_@_Sites_-_Company_Inc\Quick_Notes\Company_Wifi.docx: openBinaryFile: does not exist (No such file or directory)
Get-Content : Cannot find path 'C:\Users\Toontje\export\Ton_@_Sites_-_Company_Inc\Quick_Notes\Company_Wifi.md'
because it does not exist.
At C:\Users\Toontje\ConvertOneNote2MarkDown\ConvertOneNote2MarkDown.ps1:192 char:19
+ ...           ((Get-Content -path "$($fullexportpathwithoutextension).md" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\Ton Ma...\Company_Wifi.md:String) [Get-Content], ItemNotFoundEx
   ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

Can it be the @ sign that is causing the problem?

I also have a bunch of these errors:

Error while renaming image file path references for file 'Vanalles': You cannot call a method on a null-valued expression.
0
Error while publishing file 'Lab' to docx: Exception calling "Publish" with "4" argument(s): "Class not registered

Class not registered
"
Error while renaming image file path references for file 'Lab': You cannot call a method on a null-valued expression.
Error while publishing file 'Company Wifi' to docx: Exception calling "Publish" with "4" argument(s): "Class not registered

Class not registered
"
Error while renaming image file path references for file 'Company Wifi': You cannot call a method on a null-valued expression.
Error while publishing file 'JOIN WEBEX MEETING' to docx: Exception calling "Publish" with "4" argument(s): "Class not registered

Class not registered
"
Error while renaming image file path references for file 'JOIN WEBEX MEETING': You cannot call a method on a null-valued expression.
Error while publishing file 'Home network' to docx: Exception calling "Publish" with "4" argument(s): "Class not registered

Class not registered
"
Error while renaming image file path references for file 'Home network': You cannot call a method on a null-valued expression.
Error while publishing file 'Bettercap2' to docx: Exception calling "Publish" with "4" argument(s): "Class not registered

Any ideas? I really want to get this to work.

SjoerdV commented 3 years ago

Hi @Toontje I still see the path '~/export' being used as your input parameter in your log, this will not work. use 'c:\export' and make sure the folder exists.

Could you please read the documentation again and make use of the other issues present in this repository. BTW all issues have been solved some way or another. The script in itself just works but maybe your system has security restrictions or compatibility issues preventing Windows10, Powershell, Pandoc, Word and OneNote form working together correctly. I do hope you figure it out.

ghost commented 3 years ago

Got it. Need to install Word as well.

johnkyle4 commented 3 years ago

Yes, see these other Issues - #3 and #4 - "Class Not Registered" error will happen if you don't have MS Word installed. Also, you have to run both OneNote and PowerShell as Administrator or you will get errors

martinandersen3d commented 3 years ago

Yes, see these other Issues - #3 and #4 - "Class Not Registered" error will happen if you don't have MS Word installed. Also, you have to run both OneNote and PowerShell as Administrator or you will get errors

@SjoerdV Please add to the REAMDE, that both need to run as Administrator. it works now, when BOTH run as admin. Thanks for a nice script :D