Jump to content

terencino

Level 2
  • Content Count

    16
  • Joined

  • Last visited

Community Reputation

3 Neutral

About terencino

  1. I noticed on Windows 10 Evernote latest stable version 6.9.7.6770, all the words I spellcheck turn up in the Downloads folder of all places, in a file called Custom Dictionary.txt. Opening the file shows all the added words all crammed together in alphabetical order with a checksum at the end that changes after every addition. Just for fun I shut down Evernote and moved the custom dictionary files to another folder, then started Evernote again. You guessed it: all the red underlines reappeared in all my notes. However reinstating the custom dictionary back to the Downloads folder breaks the spellchecking system - words are not added to the old custom dictionary, and a new dictionary is not generated either. I had to reinstall Evernote, and add all the words back to the dictionary again. Same issue with the latest beta 6.10.1.6801 So if you're like me and routinely delete the contents of the Downloads folder, make sure you preserve the Custom Dictionary files.
  2. OK. Thanks for your patience, and sorry for all the questions but I need to determine what type of notes you have eg tasks, emails, notes, journal, posts etc. The macro is looking for a Note-type item in the default Notes folder, but it appears that it needs to be looking for something else in your Database folders. Can you recall how you created a new note in any of your Database folders? It could be that the Database folder is a user-created folder, as are the sub-folders. When folders are created, Outlook asks what type of items will be in that folder (as shown in attached picture), and only allows that type of item. If I can find that out, I'll modify a couple of lines of the macro, and we'll go from there. To get a picture, you might use Windows Snipping Tool provided with Windows 7 onwards. Type Snip in the Windows search box and it should show up. It will help you select an area and convert that into a JPG or other format that you can upload here.
  3. Earlier in this thread, you said: To help me visualise your setup, can you send me a picture of those notes, and the folders they are in? Have I incorrectly assumed the notes are Outlook Notes, in standard Outlook Notes folders? The location, format and type is important for coding...
  4. It seems to have found the Notes folder though, maybe there are no notes in there? Did you move your Outlook Notes somewhere else? If you select Folders in the Navigation view, it should show all of the folders, including the Notes folder as shown in the pictures below?
  5. Ok delete the c as Range, I forgot to clear that out from the Excel code
  6. Your Outlook Notes have many properties, one of them is CreationTime (ie the date and time the Outlook Note was created). The VBA script converts it to text in the format required, then passes it to ENScript as /c date. This adds the original creation date of the note to the new note in Evernote. The default folders are those associated with the default Outlook account in Account Settings. I recall you have the notes set up in a number of PST files? If so, just add them all to your account and select Set as Default in turn and run the macro for each PST. ie go to Outlook > Tools menu > Account Settings > Account Settings > Data Files tab and add them all there, select the first PST the Notes in which you want to convert to Evernote, then select Set as Default. Then OK through all of the dialogs, restart Outlook, then run the macro. The Access option was a fallback, so looks like that's out and the Outlook VBA macro is the way to go. Here is the code below, just open Outlook Alt+F11 to open VB Editor, right-click on VBAProject.OTM in the left panel and Insert a new module. Then paste this code, which as you can see is very much like the Excel macro except for the addition of some Outlook lines. Just replace variables enLocation, enNotebook, enNoteFileLocation with what you were using before, set up your first PST as described above, test it out and let me know how you go! ' Windows API function declarations. Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, ByVal dwProcId As Long) As Long Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long Private Declare Function WaitForSingleObject Lib "kernel32.dll" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Private Declare Function GetExitCodeProcess Lib "kernel32.dll" (ByVal hProcess As Long, ByRef lpExitCodeOut As Long) As Integer ' Synchronously executes the specified command and returns its exit code. ' Waits indefinitely for the command to finish, unless you pass a ' timeout value in seconds for `timeoutInSecs`. ' SyncShell developed by mklement0 from http://stackoverflow.com/questions/8902022/wait-for-shell-to-finish-then-format-cells-synchronously-execute-a-command Private Function SyncShell(ByVal cmd As String, _ Optional ByVal windowStyle As VbAppWinStyle = vbMinimizedFocus, _ Optional ByVal timeoutInSecs As Double = -1) As Long Dim pid As Long ' PID (process ID) as returned by Shell(). Dim h As Long ' Process handle Dim sts As Long ' WinAPI return value Dim timeoutMs As Long ' WINAPI timeout value Dim exitCode As Long ' Invoke the command (invariably asynchronously) and store the PID returned. ' Note that this invocation may raise an error. pid = Shell(cmd, windowStyle) ' Translate the PIP into a process *handle* with the ' SYNCHRONIZE and PROCESS_QUERY_LIMITED_INFORMATION access rights, ' so we can wait for the process to terminate and query its exit code. ' &H100000 == SYNCHRONIZE, &H1000 == PROCESS_QUERY_LIMITED_INFORMATION h = OpenProcess(&H100000 Or &H1000, 0, pid) If h = 0 Then Err.Raise vbObjectError + 1024, , _ "Failed to obtain process handle for process with ID " & pid & "." End If ' Now wait for the process to terminate. If timeoutInSecs = -1 Then timeoutMs = &HFFFF ' INFINITE Else timeoutMs = timeoutInSecs * 1000 End If sts = WaitForSingleObject(h, timeoutMs) If sts <> 0 Then Err.Raise vbObjectError + 1025, , _ "Waiting for process with ID " & pid & _ " to terminate timed out, or an unexpected error occurred." End If ' Obtain the process's exit code. sts = GetExitCodeProcess(h, exitCode) ' Return value is a BOOL: 1 for true, 0 for false If sts <> 1 Then Err.Raise vbObjectError + 1026, , _ "Failed to obtain exit code for process ID " & pid & "." End If CloseHandle h ' Return the exit code. SyncShell = exitCode End Function Public Sub ConvertToEvernote() ' Response to required_username on Evernote Forums ' https://discussion.evernote.com/topic/103802-importing-notebooks-through-pdf/#comment-453125 ' ENScript.exe commands and options from http://dev.evernote.com/doc/articles/enscript.php#enscript Dim retval, c As Range, fso As Object, enNoteFile As Object Dim outNotesFolder As MAPIFolder, outNote As NoteItem Set outNotesFolder = Application.GetNamespace("MAPI").GetDefaultFolder(FolderType:=olFolderNotes) Set fso = CreateObject("Scripting.FileSystemObject") enLocation = "C:\Users\tharvey\AppData\Local\Apps\Evernote\Evernote\ENScript.exe" enNotebook = "Quotes" enNoteFileLocation = "C:\EN\Note.txt" For Each outNote In outNotesFolder.Items enTitle = outNote.Subject 'title of the new note enNoteText = outNote.Body 'text of the new note enNoteCreated = Replace(Format(outNote.CreationTime, "yyyy/mm/dd hh:mm:ss"), "-", "/") Set enNoteFile = fso.CreateTextFile(enNoteFileLocation, True, True) 'create the note text file enNoteFile.Write enNoteText 'write the note text enNoteFile.Close ' Debug.Print enTitle & vbCrLf & enNoteText & vbCrLf & enNoteCreated ' Use ENScript.exe to create note exitCode = SyncShell(enLocation & " createNote /n " & Chr(34) & enNotebook & Chr(34) & " /i " & Chr(34) & enTitle & Chr(34) & " /s " & enNoteFileLocation & " /c " & Chr(34) & enNoteCreated & Chr(34), vbHide) Next Set outNotesFolder = Nothing Set fso = Nothing Set enNoteFile = Nothing End Sub
  7. I'm glad it works! Although it adds the notes to Evernote while I'm watching on my PC, maybe it is some difference in the versions... One of the ENScript options is creation date as shown below, so it is possible to add that to your Evernote note. /c date - Specifies the note creation date and time using the format "YYYY/MM/DD hh:mm:ss". If omitted, the current time is used. While the CSV export from Outlook doesn't include the creation date, it is available via Outlook VBA. I've already ported the Excel macro to Outlook and it runs perfectly (for me anyway) on the notes in the default Outlook Notes folder, bringing in the creation date to the Evernote note as well. Alternatively, if you wanted to stay with the Excel/CSV approach, you could create a new CSV file with the creation date, by connecting to Outlook using Access, import the notes to a table in Access, and exporting that to an Excel or CSV file.
  8. Ha yes I got carried away. Interesting diversion for me though. Hopefully the Windows macro will help out the OP
  9. Well I had a first pass at a version for Mac but taking a lot longer due to no native Import Folders functionality in Evernote for Mac. I am using Veritrope's Evernote import folder script, however it uses the text file name as the note title, not the first line in the text file like Evernote for Windows. Adding the files manually one by one seems to go OK, but loading them quickly by the macro or dropping a heap of files on the folder seems not to work, converting only one note or crashing Evernote. I've probably set it up incorrectly or it's having issues with my versions of OSX or Evernote. Otherwise the Excel VBA script below works OK in terms of selecting the import folder and creating the files. Sub UpdateEvernoteImportFolderForMac() ' Response to required_username on Evernote Forums, converting CSV to notes in Evernote via Excel VBA ' https://discussion.evernote.com/topic/103802-importing-notebooks-through-pdf/#comment-453125 and https://discussion.evernote.com/topic/103961-evernote-and-excel/#comment-453675 ' based on Evernote import folders concept from DTLow, converted from Windows to Mac ' using Evernote Import Folder from Justin Lancey at http://veritrope.com/evernote-desktop-folder/ ' folder selection function adapted from Ron de Bruin article Select Folder with VBA/Macscript in Mac Office at http://www.rondebruin.nl/mac/mac017.htm ' adapted write-to-file code from CuberChase at http://stackoverflow.com/questions/15183416/vba-save-cell-contents-to-text-file-in-a-specific-location-on-mac Dim c As Range enImportFolder = macSelectFolder() 'select the Evernote import folder If enImportFolder = "" Then Exit Sub For Each c In ActiveSheet.UsedRange.Columns(1).Cells enNote = FreeFile i = i + 1 Open enImportFolder & "Note_" & Format(i, "00000") & ".txt" For Output As #enNote Print #enNote, c.Value & vbCrLf & c.Offset(0, 1).Value 'write the note title & text Close #enNote ' Evernote should pick up the file via Import Folders now Next End Sub Function macSelectFolder() Dim folderPath As String Dim RootFolder As String Dim scriptstr As String On Error Resume Next RootFolder = MacScript("return (path to desktop folder) as String") 'Or use RootFolder = "Macintosh HD:Users:YourUserName:Desktop:TestMap:" 'Note : for a fixed path use : as seperator in 2011 and 2016 If Val(Application.Version) < 15 Then scriptstr = "(choose folder with prompt ""Select the folder""" & _ " default location alias """ & RootFolder & """) as string" Else scriptstr = "return posix path of (choose folder with prompt ""Select the folder""" & _ " default location alias """ & RootFolder & """) as string" End If folderPath = MacScript(scriptstr) On Error GoTo 0 macSelectFolder = folderPath End Function
  10. OK I wondered what happened to your post DTLow. I'm always open to different or better ways to get results, and your suggestion was a much better way of doing this I'm sure this macro won't work on the Mac, because there is no equivalent to the scripting library (for FileSystemObject). I'll see if I can modify to suit though. Here is the Excel for Windows version Sub UpdateEvernoteImportFolder() ' Response to required_username on Evernote Forums ' https://discussion.evernote.com/topic/103802-importing-notebooks-through-pdf/#comment-453125 ' using Evernote import folders idea from DTLow Dim c As Range, fso As Object, ENNoteFile As Object Set fso = CreateObject("Scripting.FileSystemObject") For Each c In ActiveSheet.UsedRange.Columns(1).Cells i = i + 1 ENFile = "C:\EN\" & "File_" & Format(i, "00000") & ".txt" Set ENNoteFile = fso.CreateTextFile(ENFile, True, True) 'create the note text file ENNoteFile.Write c.Value & vbCrLf & c.Offset(0, 1).Value 'write the note title & text ENNoteFile.Close ' Evernote should pick up the file via Import Folders now Next Set fso = Nothing End Sub
  11. Thank you DTLow! I've learned about Import Folders today. Much more efficient for this purpose. I've set the note folder in the attached macro as C:\EN, set that up in Explorer or just change the macro to suit, run the macro to create the separate note files, then set Evernote to watch that folder in Evernote > Tools > Import Folders..., add C:\EN, and set the required notebook. Evernote just adds the new or changed notes, which are organised as shown in the screen clip below. I'm sure I can use Import Folders for some of my own requirements, thanks again DTLow forum2.xlsm
  12. What I would do next is to build the entire command line to add a new note via ENScript, and run that from the command prompt. That might indicate where the problem is. I expect it is just a syntax issue. The command line looks like this: C:\>C:\full_path_to_ENScript.exe createNote /n "Notebook name" /i "Note title" /s "C:\Note Text.txt"
  13. Great, can you let me know the entries you made for the variables below? ENLocationENNotebook ENNoteFileLocation
  14. Hi Jimmy Bionic, I just came upon your post and having only recently gone through the two-factor authentication (2FA for short) process myself, maybe I can help. It looks like you will need to set it up with Google Authenticator initially, but after that you can change the 2FA settings on the web version of Evernote to use text messages to your primary phone instead. Then you can delete the Google Authenticator. In thinking about why they have set it up this way, is it possible Evernote has an exclusive agreement with Google? For example you can also login using your Google account but not Facebook or LinkedIn or any other OAuth provider. I also noted that logging into Evernote with my Google account conveniently bypasses the 2FA, which seems a bit counter-intelligent... Can I ask why you don't want to use Google Authenticator? I prefer Microsoft Authenticator myself, it just has an Approved button to press instead of a code that needs to be typed in, and the magic of a well-designed User Experience takes care of it all. Also thanks to you and Gazumped for your humour and patience with the process, it made me laugh
  15. OK so Save to Evernote won't work for you. I was backtracking through your previous queries and found one of your CSV files on Importing notebooks through PDF. I converted that to an XLSM with a macro to move through the CSV entries and add them as new notes in a Notebook called Quotes. This works fine on my PC, I don't think there is anything that Excel 2007 can't handle so hopefully will work for you too. The bulk of the code adds synchronous execution to the good old Shell command, it was developed by a guru on Stack Overflow, and I just added the ConvertToEvernote macro. Before you use it you will need to modify the following variables: ENLocation = "C:\Users\tharvey\AppData\Local\Apps\Evernote\Evernote\ENScript.exe" (need the full path to your version of Evernote, can find in the shortcut to the application) ENNotebook = "Quotes" (set up a notebook in Evernote with the preferred name and change this to match) ENNoteFileLocation = "C:\EN\Note.txt" (this is just a temporary file so can be located anywhere preferably on your local drive) Let me know how you go. By the way do you have any plans to change from Office 2007? forum.xlsm
×
×
  • Create New...