Hi,
I can not figure out the following problem, but I am quite new to Applescript, so this might be a stupid question.
I want to delete empty folders and so far managed to identify them with the following script, which is mostly "copy&paste" from the internet:
What is not working is the delete part...
I tried
Which results in a "can not converted to integer error:
error "„Photos“ hat einen Fehler erhalten: folder id \"1ADB1EED-869A-429E-B688-84D6E56FEE2D/L0/020\" of folder id \"101C1EEB-96A5-45A6-87CD-72C813CB3BD4/L0/020\" of folder id \"88BC73E2-B297-4304-AE0E-7AC910FF6C00/L0/020\" kann nicht in Typ integer umgewandelt werden." number -1700 from folder id "1ADB1EED-869A-429E-B688-84D6E56FEE2D/L0/020" of folder id "101C1EEB-96A5-45A6-87CD-72C813CB3BD4/L0/020" of folder id "88BC73E2-B297-4304-AE0E-7AC910FF6C00/L0/020" to integ
That results in a "can not be read error:
error "„Photos“ hat einen Fehler erhalten: „folder id \"1ADB1EED-869A-429E-B688-84D6E56FEE2D/L0/020\"“ kann nicht gelesen werden." number -1728 from folder id "1ADB1EED-869A-429E-B688-84D6E56FEE2D/L0/020"
I tried some variations of the above, but I always get error -1700 or -1728
Probably this is only some small thing, but I can not figure it out. Maybe you have any ideas, what is going wrong?
Thanks for your help!
Alwis
I can not figure out the following problem, but I am quite new to Applescript, so this might be a stupid question.
I want to delete empty folders and so far managed to identify them with the following script, which is mostly "copy&paste" from the internet:
Code:
set allfolders to {}
set allalbums to {}
tell application "Photos"
set allalbums to the albums -- collect all albums
set allfoldernames to {}
set allalbumnames to {}
set allfolders to {}
set level to 0 -- nesting level of folders
set nextlevelFolders to the folders of folder "TestScript"
set currentLevelFolders to {}
repeat while (nextlevelFolders is not {})
set currentLevelFolders to nextlevelFolders
set nextlevelFolders to {}
repeat with fi in currentLevelFolders
tell fi
set ffolders to its folders
set falbums to its albums
set fcontainers to its containers
set nextlevelFolders to ffolders & nextlevelFolders
set allalbums to falbums & allalbums
end tell
if (fcontainers is {}) then
set folderName to the name of fi
log {"Folder is empty", folderName}
delete folder id fi
end if
end repeat
set allfolders to currentLevelFolders & allfolders
set level to level + 1
end repeat
What is not working is the delete part...
I tried
Code:
delete folder fi
Which results in a "can not converted to integer error:
error "„Photos“ hat einen Fehler erhalten: folder id \"1ADB1EED-869A-429E-B688-84D6E56FEE2D/L0/020\" of folder id \"101C1EEB-96A5-45A6-87CD-72C813CB3BD4/L0/020\" of folder id \"88BC73E2-B297-4304-AE0E-7AC910FF6C00/L0/020\" kann nicht in Typ integer umgewandelt werden." number -1700 from folder id "1ADB1EED-869A-429E-B688-84D6E56FEE2D/L0/020" of folder id "101C1EEB-96A5-45A6-87CD-72C813CB3BD4/L0/020" of folder id "88BC73E2-B297-4304-AE0E-7AC910FF6C00/L0/020" to integ
Code:
delete folder id (fi's id)
That results in a "can not be read error:
error "„Photos“ hat einen Fehler erhalten: „folder id \"1ADB1EED-869A-429E-B688-84D6E56FEE2D/L0/020\"“ kann nicht gelesen werden." number -1728 from folder id "1ADB1EED-869A-429E-B688-84D6E56FEE2D/L0/020"
I tried some variations of the above, but I always get error -1700 or -1728
Probably this is only some small thing, but I can not figure it out. Maybe you have any ideas, what is going wrong?
Thanks for your help!
Alwis