AnsweredAssumed Answered

Apple script calculation error

Question asked by zinny on Apr 10, 2015
Latest reply on Apr 10, 2015 by FentonJones

Title

Apple script calculation error

Post

I am doing my first perform apple script step (which also happens to be my first apple script).

I am trying to grab the location of a quicktime file and then open the folder it is in using an apple script.

I can hard code the information into the "Native Script Application" option as below

openfolder "open this" offolder "Desktop" offolder "Reuben Macbook" offolder "Users" ofstartup diskofapplication "Finder"

and it works find but I need to be able to find the folders of different quicktimes and when I replicate the statement exactly in a calculation it comes up with 

A """ can't go after this property

and Unknown error - 2470

I have tried putting the calculation directly into the apple script script step, sending it as a variable and calculating it as a global field and then linking the calculation to that but all cases the errors are the same

So here is my calculation

"open folder \""& GetValue (test::filepathasreturn;ValueCount ( test::filepathasreturn ) -1 ) & "\" of folder \""& GetValue (test::filepathasreturn;ValueCount ( test::filepathasreturn ) - 2) & "\" of folder \"Reuben Macbook\" of folder \"Users\" of \"startup disk\" of application \"Finder\""

My solution is to substitute the / in the path name with a hard return (currently as the field FILEPATHASRETURN so I can see it) and then get the last value -1 and the last value -2 as my variable folders (the last value is the quicktime name). All the others are hardcoded because in the final solution they will not be changing.

so the filepath in my test looks like this

mac:/Macintosh HD/Users/Reuben Macbook/Desktop/open this/ADVENTURE.mp4

 

My final calculation looks like this

open folder "open this" of folder "Desktop" of folder "Reuben Macbook" of folder "Users" of "startup disk" of application "Finder"

but I get the error codes - what am I doing wrong?

Thanks so much for any responses

Outcomes