Applescript / FM15 / El Capitan

Discussion created by EricBrown on Jul 25, 2016

Ok, here's an interesting question regarding Applescript.  I've got a script that references a number of Applescript subscripts stored in the Applescript library. The applescripts are built to automate actions in Logic Pro X. In one subscript that is called, it has Logic Pro open a music bin, select a temporary music file and delete it. Before the upgrade to El Cap and newest version of Logic Pro X, it worked correctly. Now, testing after updates it does not perform the deletion step.


I've copied the Applescript out of the library subscript file and ran it by itself in Script Editor: SUCCESS

I've copied the Applescript into a native FM applescript and set a trigger button and tested: SUCCESS

I try to run from the original script: FAILURE

I broke the original FM perform applescript into chunks and put this section in its own Applescript: FAILURE


The Applescript doesn't reference any variables that would be missing or wrong. It simply opens the window, finds the row with the specified name and then deletes that row. Everything performs correctly up until the deletion (which in Logic Pro X is <delete track>, as <delete> only deleted the reference in the bin and not the file ). 


Any suggestions as to why this would run correctly by itself in FM and in Script Editor but not referenced from the primary script that runs 14/15 Applescripts correctly.


Here is the portion of the script (it's nothing amazing):


tell application "Logic Pro X"


  tell application "System Events"

  tell process "Logic Pro X"

  set frontmost to true

  keystroke "8" using command down -- Open Music bin

  do shell script "sleep 1" -- pause 1 second before proceeding

  select (first row of outline 1 of scroll area 1 of group 3 of group 1 of window 1 whose value of text field 1 contains "tmp2") -- select TMP file

  do shell script "sleep 3" -- longer pause as the select takes a second to perform

key code 51 using command down -- delete track (failing to execute)

  do shell script "sleep 1"

  keystroke return -- confirm delete

  do shell script "sleep 1"

  keystroke return

do shell script "sleep 1"

  end tell

  end tell

end tell