Hi there,
Is it possible to write a script that removes all images from a numbers document?
I am working with a document that contains some company logos - it would be great if there was a way to delete anything that ends in .png or .jpg?
Hi there,
Is it possible to write a script that removes all images from a numbers document?
I am working with a document that contains some company logos - it would be great if there was a way to delete anything that ends in .png or .jpg?
(*
for macScripter
Remove images whose name ends with ".jpg", ".jpeg", ".png"
CAUTION: it doesn't remove images inserted in cells.
I don't know how to get pictures pasted in cells.
Yvan KOENIG (VALLAURIS, France)
2017/04/18 17:19:35
*)
tell application "Numbers" to tell document 1
repeat with s from 1 to count sheets
tell sheet s
repeat with i from (count every image) to 1 by -1
set itsName to file name of image i
if (itsName ends with ".jpg") or (itsName ends with ".jepg") or (itsName ends with ".png") then delete image i
end repeat
end tell # sheet s
end repeat
end tell
Yvan KOENIG running Sierra 10.12.4 in French (VALLAURIS, France) mardi 18 avril 2017 17:39:27
Thanks for the reply Yvan,
Unfortunately that script isn’t working. I’m getting a “cant get image 1 of table 1 of sheet 1 of document 1” error
Would behave better if you remove the instruction
tell table 1
which is not in my script :rolleyes:
Yvan KOENIG running Sierra 10.12.4 in French (VALLAURIS, France) mardi 18 avril 2017 19:14:25
HAH! Oh yes.
Works perfectly, now I’ve followed the instructions properly!
Thanks Yvan