Copy link to clipboard
Copied
Hello
My solution for remove selected photo
local catalog = LrApplication.activeCatalog()
local photos = catalog:findPhotos {
searchDesc = {
criteria = "pick",
operation = "==",
value = -1
}
}
catalog:withWriteAccessDo('with', function( )
local collection = catalog:getCollections()
collection:removePhotos( photos )
end, {timeout = 30})
But nothing happening when I execute code.
Please help me! What is wrong with this code?
Copy link to clipboard
Copied
[This post contains formatting and embedded images that don't appear in email. View the post in your Web browser.]
local collection = catalog:getCollections()
collection:removePhotos( photos )
The method catalog:getCollections() doesn't exist. There is catalog:getChildCollections(), but it returns an array of collections, not a single collection.
I'm guessing you're not using a debugger, since if you were, you'd see an error message like:
Without a debugger, LR sometimes displays Lua errors, sometimes not.
You should use either my Debugging Toolkit or the Zerobrane IDE. Zerobrane IDE is a full-featured IDE for Lua, but my Debugging Toolkit better handles LR's specific tasking architecture.
Copy link to clipboard
Copied
Thank you for your advice! I will try to use your Debugging Toolkit.
| The method catalog:getCollections() doesn't exist.
It is strange because I get this function from official docs
| Access the functions and properties from the object. Retrieve the objects for all the collections by
| calling LrCatalog.getCollections().
Copy link to clipboard
Copied
"It is strange because I get this function from official docs"
I just filed a bug report about that -- thanks for calling it out: