Jump to content
  • 1

BUG: Create New Tag with AppleScript Does Not Set Parent Property


JMichaelTX

Idea

  • Level 5*

BUG:  Create New Tag with AppleScript Does Not Set Parent Property

 

Using the AppleScript code provided by Evernote at Mac Wrangle Evernote with AppleScript, creating (making) a new tag with the Parent property does not work correctly.  The tag is created, but the Parent property is not set.

 

I think this is caused by creating the Parent tag and the Child tag in the same AppleScript session.  Apparently when the Child tag is created, the reference to the Parent tag is not really available yet.

 

In the code below,  the "AppleScriptTag1" is the Parent tag, and "AppleScriptTag2" is the Child tag.

 

Steps to Reproduce:  Run this code (provided by Evernote)

 

EN-Mac-6.3-AS-Create-Tags-Issue.png

 


Screenshot of EN Mac 6.3 Tag view after running script:

 

EN-Mac-6.3-Tags-View.png

Link to comment

5 replies to this idea

Recommended Posts

Will this be resolved? I still see the problem with the simple AppleScript:

 

tell application id "com.evernote.evernote"

    if (not (tag named "AppleScriptTag1" exists)) then

        make tag with properties {name:"AppleScriptTag1"}

        -- create a sub-tag

        make tag with properties {name:"AppleScriptTag2", parent:tag named "AppleScriptTag1"}

    end if

end tell

 

Regards

 

Beatrix Willius

Link to comment
  • Level 5*
On 12/11/2015 at 3:37 AM, JMichaelTX said:

BUG:  Create New Tag with AppleScript Does Not Set Parent Property

Using the AppleScript code provided by Evernote at Mac Wrangle Evernote with AppleScript, creating (making) a new tag with the Parent property does not work correctly.  The tag is created, but the Parent property is not set.

Confirming that this BUG still exists in Evernote 6.11.1 (455059) on macOS 10.11.6.

This script will fail to set the parent property of the newly created tag:

```applescript
tell application "Evernote"
  
  set tagChildToCreateStr to "TEST.Child"
  set tagParToCreateStr to "TEST.Par"
  
  --- CREATE TAGS ---
  
  if (not (tag named tagParToCreateStr exists)) then
    
    --- CREATE PARENT TAG ---
    set oTagPar to make tag with properties {name:tagParToCreateStr}
    
    -- CREATE CHILD TAG ---
    set oTagChild to make tag with properties {name:tagChildToCreateStr, parent:oTagPar}
  end if
  
  --- VERIFY TAG ---
  
  set oTag to tag named tagChildToCreateStr
  set tagParName to name of parent of oTag
  -->Generates Error:  Evernote got an error: Can’t get parent of tag "TEST.Child".
  
  log tagParName
  
end tell
```

Screenshot of Results from Script Debugger 6

2017-12-15_15-35-55.png.2178dbc261024b302d7a64eb0a3bde3b.png

However, if I assign the parent tag AFTER both tags were created in a prior session, then it works:

```applescript
tell application "Evernote"
  
  set tagChildToCreateStr to "TEST.Child"
  set tagParToCreateStr to "TEST.Par"
  
  set oTagChild to tag named tagChildToCreateStr
  
  --- NOW ADD PARENT TAG AFTER ORIGINAL TAG WAS CREATED IN PREVIOUS SESSION ---
  set parent of oTagChild to tag named tagParToCreateStr
  
  set oTagPar to parent of oTagChild
  set tagParName to name of oTagPar
  
  log tagParName
  
end tell
```

Screenshot of Results from Script Debugger 6

2017-12-15_15-44-06.png.97508b75a845b4046e1c00e35c64b1cc.png

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...