text 从Evernote Note(AppleScript)创建Internet位置文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 从Evernote Note(AppleScript)创建Internet位置文件相关的知识,希望对你有一定的参考价值。

property ptyScriptName : "Create Internet Location File from EN Note"
property ptyScriptVer : "2.0"
property ptyScriptDate : "2018-03-29"
property ptyScriptAuthor : "JMichaelTX"

(*
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REQUIRED:
  1.  macOS 10.11.6+
  2.  Mac Applications
      • Evernote Mac 6.11.1+
      • Finder
        
INSTALLATION:   See http://tinyurl.com/install-as

BUG/ISSUE REPORTS:
  •  Find any bugs/issues or have suggestions for improvement?
  • Contact me via PM in Evernote Forum or at blog.jmichaeltx.com/contact/

TAGS:  @Lang.AS @SW.EN @CAT.Files @CAT.Link @CAT.Notes @Auth.JMichaelTX

REF:  The following were used in some way in the writing of this script.
  1. Can't find reference
      I think I got this idea from someone in the Evernote Forum, but I can't find it now.
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*)
use framework "Foundation"
use framework "AppKit"
use scripting additions

try ---------------- TRY --------------------
  
  tell application "Evernote"
    
    set lstSelectedNotes to selection
    
    if lstSelectedNotes ≠ {} then
      
      set oNote to first item of lstSelectedNotes
      set strNoteTitle to title of oNote
      set strNoteLink to note link of oNote
      
      my createWebLocFile(strNoteLink, strNoteTitle)
      
      set scriptResults to "OK"
    end if
    
  end tell -- Evernote
  
  --------------- END TRY ---------------------------------
  
on error errMsg number errNum
  
  if errNum = -128 then ## User Canceled
    set errMsg to "[USER_CANCELED]"
  end if
  
  set scriptResults to "[ERROR]" & return & errMsg & return & return ¬
    & "SCRIPT: " & ptyScriptName & "   Ver: " & ptyScriptVer & return ¬
    & "Error Number: " & errNum
  
end try ---------------- END TRY/ERROR BLOCK ------------------------

--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ END OF MAIN SCRIPT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
on createWebLocFile(pstrNoteLink, pstrNoteTitle)
  (*  VER: 2.0    2018-03-29
---------------------------------------------------------------------------------
  PURPOSE:  Create Internet Location Files for Evernote Note Classic Link
  PARAMETERS:
    • pstrNoteLink    ┃ text  ┃ EN Note Classic Link
    • pstrNoteTitle  ┃ text  ┃ EN Note Title (will be file name)
  RETURNS:  nothing 
  AUTHOR:  JMichaelTX
—————————————————————————————————————————————————————————————————————————————————
*)
  local filePath, fileAlias
  
  set strPrompt to "Choose FOLDER For Note:  " & pstrNoteTitle
  tell application "Evernote" to set aliFolder to choose folder with prompt strPrompt
  
  tell application "Finder"
    
    set fileName to pstrNoteTitle & " [EN Note]"
    set aliFile to make new internet location file to pstrNoteLink at (aliFolder) with properties {name:fileName}
    
    set fileAlias to aliFile as alias
    set filePath to POSIX path of (fileAlias)
    
  end tell -- application "Finder"
  
  
  --- Set Path to Evernote Icon in Evernote App --
  set imagePath to "/Applications/Evernote.app/Contents/Resources/Evernote.icns"
  
  --- Set File Icon to Evernote Icon ---
  set theImage to (current application's NSImage's alloc()'s initWithContentsOfFile:imagePath)
  (current application's NSWorkspace's sharedWorkspace()'s setIcon:theImage forFile:filePath options:0)
  
  tell application "Finder"
    activate
    reveal aliFile
  end tell
  
end createWebLocFile
--~~~~~~~~~~~~~~~ END OF handler createWebLocFile ~~~~~~~~~~~~~~~~~~~~~~~~~

以上是关于text 从Evernote Note(AppleScript)创建Internet位置文件的主要内容,如果未能解决你的问题,请参考以下文章

Apple标签,Apple脚本和Evernote

text Evernote #memo

text Evernote资源指定#memo

Evernote Android API 坏了?共享文档的意图不再有效

text evernoteショートカットキー#memo

text AppleScript para copiar y pegar la imagen descargada en una nueva nota de Evernote,asignar etiq