Jump to content
  • 1
JMichaelTX

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

Idea

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

Share this post


Link to post

5 replies to this idea

Recommended Posts

  • 0

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

Share this post


Link to post
  • 0
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

  • Thanks 1

Share this post


Link to post
  • 0
On 12/16/2017 at 6:19 AM, trixiwill said:

Thanks! This works fine. I misunderstood the sequence.

Yes, there is a workaround, but the BUG still exists.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...