0

I want to export embedded media from Apple Numbers to Path with AppleScript. It should only export media like embedded PDF;PNG;JPG;audiorecord from the current Table from the active Sheet. I dont want a package from all media. All media should remain in there specific datatype in one directory.

At this time i can count the media, get there names... but i cant export those

1 Answers1

1

I can suggest one possible solution for saved .numbers documents.

-- Choose "numbers" file
set numbersFile to choose file of type "numbers"

-- Choose destination folder
set destinationFolder to (choose folder) as Unicode text

-- Get temporary items folder references
set tempFolder to path to temporary items folder from user domain

-- Unzip to temporary items folder, then Move to destination folder
do shell script "/usr/bin/unzip -o -d " & ¬
    quoted form of (POSIX path of tempFolder) & ¬
    space & ¬
    quoted form of (POSIX path of numbersFile)
try
    tell application "Finder" to ¬
        move files of folder "Data" of folder (tempFolder as Unicode text) to ¬
            folder destinationFolder replacing yes
end try
Robert Kniazidis
  • 1,760
  • 1
  • 7
  • 8
  • thanks for the solution, but i would need a solution which consider the active table in the active document (there are a lot of tables in one document). Thanks anyway – Nicolai Glock Feb 22 '23 at 12:02
  • The media items in the Numbers.app are elements of the sheet, as well as the tables. So, I don't understand **why you say about table's media items**. The tables itself is iWork items of the sheet as well as images, videos, lines and so on. – Robert Kniazidis Feb 22 '23 at 12:43
  • Okay but if i had a structure like this: document1 , table1 with media1, media 2, table2 with media1, media2 , and i have focused table 1 , i would get 4 media and not 2 didn’t i ? – Nicolai Glock Feb 22 '23 at 13:07
  • It seems to you that you have this structure. The media (iWork items) is simply drawn (by Numbers.app, on fly) on the tables (which are iWork items as well). You can identify that the certain media is drawn on certain table only by comparing position of them on the sheet. – Robert Kniazidis Feb 23 '23 at 12:41