Advertisement
Guest User

backup evernote

a guest
Jan 10th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. Backup automatico ogni settimana (applescript):
  3.  
  4. -- FONTE https://discussion.evernote.com/topic/80581-backup-individual-notebooks-with-this-applescript/
  5.  
  6. with timeout of (30 * 60) seconds
  7.  
  8.  
  9. tell application "Finder"
  10.  
  11. set dateString to (current date) as text -- get the date
  12. set {year:y, month:m, day:d} to (current date)
  13. set newDatestring to (y * 10000 + m * 100 + d) as text
  14.  
  15. --
  16. set baseBackupFolder to "/Users/YOURDESTINATIONPATH/BK-evernote/"
  17. set setBackupfolder1 to baseBackupFolder as POSIX file
  18.  
  19.  
  20.  
  21. set dataOggi to (newDatestring) as text
  22.  
  23. make new folder at setBackupfolder1 with properties {name:dataOggi}
  24.  
  25.  
  26. set setBackupfolder to baseBackupFolder & dataOggi & "/" as POSIX file
  27.  
  28. -- confirm valid path exists
  29.  
  30. if setBackupfolder exists then
  31.  
  32. else
  33.  
  34. display dialog "The backup path you set does not exist. Please go to line 3, set a valid path and re-run this script." giving up after 99999999
  35.  
  36. error number -128
  37.  
  38. end if
  39.  
  40. set backupFolder to setBackupfolder as text
  41.  
  42. end tell
  43.  
  44.  
  45.  
  46. -- activate evernote
  47.  
  48. tell application "Evernote"
  49.  
  50. activate
  51.  
  52.  
  53.  
  54. -- wait for evernote to come to the front
  55.  
  56. tell application "Finder"
  57.  
  58. set frontAppname to "whatever"
  59.  
  60. repeat while frontAppname is not "Evernote"
  61.  
  62. tell application "System Events" to set frontAppname to name of first process where frontmost is true
  63.  
  64. end repeat
  65.  
  66. delay 1 -- wait a little more
  67.  
  68. end tell
  69.  
  70.  
  71.  
  72. -- do the backup
  73.  
  74. set allNotebooks to every notebook
  75.  
  76. repeat with currentNoteBook in allNotebooks
  77.  
  78. set notebookName to (the name of currentNoteBook)
  79.  
  80. set allNotes to every note in notebook notebookName
  81.  
  82. if every note in notebook notebookName exists then -- proceed if notebook is not empty
  83.  
  84.  
  85. (*
  86. set exportFilename to (backupFolder & notebookName & " - Backed up on " & newDatestring & ".enex")
  87. *)
  88. set exportFilename to (backupFolder & notebookName & ".enex")
  89.  
  90. export allNotes to exportFilename
  91.  
  92. end if
  93.  
  94. end repeat
  95.  
  96.  
  97.  
  98. -- confirmation dialog
  99.  
  100. display dialog "The backup of your Evernote notebooks is complete." buttons {"View Backup Folder", "OK"} default button 2 giving up after 99999999
  101.  
  102. if the button returned of the result is "View Backup Folder" then
  103.  
  104. tell application "Finder"
  105.  
  106. activate
  107.  
  108. open backupFolder
  109.  
  110. end tell
  111.  
  112. end if
  113.  
  114.  
  115.  
  116. end tell
  117.  
  118. end timeout
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement