I’ve come up on another issue I’m wondering if you could help with. When I run the following:
use FileTagsLib : script "FileTagsLib"
use scripting additions
set listOfTags to "DID IT WORK?"
set fileOrPosixPath to POSIX path of (choose file)
--set fileOrPosixPath to "/Users/gavin/Desktop/Desktop on 05.18.16/Screen Shot 2016-05-04 at 7.57.54 AM.png"
display dialog fileOrPosixPath
tell FileTagsLib to addTags:listOfTags forItem:fileOrPosixPath
I get the following error:
“Result:
error “The operation couldn’t be completed. (OSStatus error -8050.)” number -2700 from «script “FileTagsLib”» to item”
In other words, if I specify the location it works fine, if I ask for it it doesn’t work. As far as I can tell with display dialog, it seems to be the same. Could you help me with the phrasing?
As far as I know, listOfTags is supposed to be a list but you define it as a string.
Would be useful to use :
set listOfTags to {“DID IT WORK?”}
Yvan KOENIG running El Capitan 10.11.4 in French (VALLAURIS, France) lundi 9 mai 2016 22:07:24
Yes. I suppose it should be a list as it is referred to that, but I wasn’t looking for it to be a list yet, I just wanted to see if it worked while changing as little of the original code as possible.
I wrote because here, after setting the variable to a list, the script worked flawlessly.
I tested with :
use FileTagsLib : script "FileTagsLib"
use scripting additions
set listOfTags to {"DID IT WORK?"}
set fileOrPosixPath to POSIX path of (choose file)
set oldListOfTags to FileTagsLib's returnTagsFor:fileOrPosixPath
log oldListOfTags
--set fileOrPosixPath to "/Users/gavin/Desktop/Desktop on 05.18.16/Screen Shot 2016-05-04 at 7.57.54 AM.png"
display dialog fileOrPosixPath
tell FileTagsLib to addTags:listOfTags forItem:fileOrPosixPath
set newListOfTags to FileTagsLib's returnTagsFor:fileOrPosixPath
The events log was :
tell application "Script Editor"
choose file
end tell
(*Violet*)
tell application "Script Editor"
display dialog "/Users/userName/Desktop/4Shane.scpt"
end tell
Résultat :
{"Violet", "DID IT WORK?"}
And of course, when I tested with the variable defined as a string I got :
tell application "Script Editor"
choose file
end tell
(*Violet*)
tell application "Script Editor"
display dialog "/Users/userName/Desktop/4Shane.scpt"
Résultat :
error "L'opération n'a pas pu s'achever. (OSStatus erreur -8050)." number -2700 from «script "FileTagsLib"» to item
Yvan KOENIG running El Capitan 10.11.4 in French (VALLAURIS, France) mardi 10 mai 2016 10:06:19
I see now. That’s embarrassing - like you said, I added the parenthesis and It worked. I didn’t understand you were referring to that aspect of the code. I even tried adding commas to the individual words and adding the parenthesis, but without the quotation marks. Thank you for spelling it out for me.