Keynote - Movie Export Droplet with ProRes 4444 @ 1920 x 1080

The disease of many experienced programmers is that they cannot convey the essence to inexperienced in a simple way. I hope most like the English interface, just like me. Although I perfectly know Russian, Greek, Georgian.

For example, if you use a simple programming language, then the above scripts can be reduced to this. Just compare with your monsters:


tell application id "com.apple.systemevents" to tell process "Keynote"
	
	set frontmost to true
	tell menu bar 1 to tell menu bar item "File" to tell menu 1
		tell menu item "Export To" to tell menu 1 to click menu item "Movie…"
	end tell
	
	delay 0.1
	tell window 1 to tell sheet 1
		set value of 1st text field whose help is "Type how many seconds to wait between slides." to "10"
		set value of 1st text field whose help is "Type how many seconds to wait between builds." to "8"
		
		tell (1st pop up button whose help is "Choose a size for the movie.")
			perform action "AXShowMenu"
			delay 0.1
			click menu item "Custom..." of menu 1
		end tell
		set value of 1st text field whose help is "Type the width you want for the movie." to "1920"
		set value of 1st text field whose help is "Type the height you want for the movie." to "1080"
		
		click (1st radio button whose title is "Apple ProRes 4444")
		delay 0.1
		click button "Next…"
	end tell
	
end tell

Here is your original script without GUI scripting. I fixed in it 2 errors and it works now.

  1. For the movie export format you have 4 constants: small, medium, large, native size. They respond to 360p, 540p, 720p, native size. You should use always KeyNote’s constant (for exapmple, instead of 720p you should use large. The compiler automatically changes it to italic 720p, but now it is what should be. (That is, it is other, proper 720p). If you do not make changes in the script in future, it remains correct. If you change the script, always put large again, to fix the issue again. This was first error.

  2. Correct UTI of keyNote document is “com.apple.iwork.keynote.sffkey” and not “com.apple.iwork.keynote.key”. This was second error.

  3. Filtering process is simpler (see here). Handler checkForIdentifier no need at all.

  4. No need Posix files, Posix paths and do shell scripts…

Your fixed script (I use native size, you can use small, medium, large instead):


property destinationFolder : (path to desktop folder)

on run
	-- TRIGGERED WHEN USER LAUNCHES DROPLET. PROMPT FOR PRESENTATION FILE(S):
	set theItems to (choose file of type "com.apple.iwork.keynote.sffkey" with prompt "Pick the Keynote presentation(s) to export to movie:" with multiple selections allowed)
	open theItems
end run

on open theItems
	-- TRIGGERED WHEN USER DRAGS ITEMS ONTO THE DROPLET
	display dialog "This droplet will export dragged-on Keynote presentation files as movies" & return & return & "The movies will be encoded to MPEG format using H.264 compression." with icon 1
	set filesToProcess to {}
	-- filter the dragged-on items for Keynote presentation files
	repeat with anItem in theItems
		tell application id "com.apple.systemevents" to set anUTI to type identifier of anItem
		if anUTI is "com.apple.iwork.keynote.sffkey" then set the end of the filesToProcess to anItem
	end repeat
	if filesToProcess is {} then
		activate
		display alert "INCOMPATIBLE ITEMS" message "None of the items were Keynote presentations."
	else
		-- process the presentations
		my exportPresentationsToMovies(filesToProcess)
	end if
end open

on exportPresentationsToMovies(thePresentations)
	tell application "Keynote"
		activate
		if playing is true then tell front document to stop
		try
			repeat with aPresentation in thePresentations
				open aPresentation
				set the documentName to name of the front document
				set destinationFile to my deriveFileNameForNewFileInFolder(documentName, destinationFolder)
				with timeout of 1200 seconds -- 20 minutes
					export front document to file destinationFile as QuickTime movie with properties {movie format:native size}
				end timeout
				close front document saving no
				display notification documentName with title "Keynote Movie Export"
			end repeat
		on error errorMessage
			activate
			display alert "EXPORT ERROR" message errorMessage
			error number -128
		end try
	end tell
end exportPresentationsToMovies

on deriveFileNameForNewFileInFolder(sourceItemBaseName, targetFolderHFSAlias)
	-- Routine that derives a none-conflicting file name
	set targetName to ((targetFolderHFSAlias & sourceItemBaseName) as text) & ".m4v"
	try
		alias targetName
	on error
		return targetName
	end try
	set n to 1
	repeat
		set targetName to ((targetFolderHFSAlias & sourceItemBaseName) as text) & "(" & n & ").m4v"
		try
			alias targetName
			set n to n + 1
		on error
			return targetName
		end try
	end repeat
end deriveFileNameForNewFileInFolder

I apologizes but you are wrong.

On my machine, keynote documents are given the UTI “com.apple.iwork.keynote.key”.
Look at the file :
“Keynote.app:Contents:Info.plist”

You will learn that
Keynote Presentation document may be :
com.apple.iwork.keynote.key – package
com.apple.iwork.keynote.sffkey – flat file
com.apple.iwork.keynote.key-tef – package
com.apple.iwork.keynote.kpf – package

You may run the script below to check that.

set theApp to path to application id "com.apple.iWork.Keynote"
set thePlist to ((theApp as text) & "Contents:Info.plist") as «class furl»
set answer to choose from list {"Xcode", "BBEdit"} with title "Choose the application to open the plist" with prompt "Xcode: look at the properties “Document types” " & linefeed & "BBEdit: look at keys “UTTypeConformsTo”"
if answer is false then error number -128
set opener to item 1 of answer as text
tell application opener to open thePlist

On my side I never see com.apple.iwork.keynote.kpf items
and my memory tell me that com.apple.iwork.keynote.key-tef are grabbed from docs generated under iOS (but it may be a wrong souvenir).

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 25 mars 2020 10:55:39

Thanks for the info. I have only flat file presentations on my Mac. So, I can’t test the last script with other UTIs. If it works, then we can provide the list of UTIs in choose file dialog, and we can check if the file’s identifier is in the UTIs list in the on open handler.

When I posted a code asking for com.apple.iwork.keynote.key UTI, it’s what I had as files available here.
I knew the com.apple.iwork.keynote.sffkey one but I forgot to insert it in the list passed to choose file.
Below is your completed script


property destinationFolder : (path to desktop folder)
property permittedUTIs : {"com.apple.iwork.keynote.key", "com.apple.iwork.keynote.sffkey", "com.apple.iwork.keynote.key-tef", "com.apple.iwork.keynote.kpf"} -- ADDED

on run
	-- TRIGGERED WHEN USER LAUNCHES DROPLET. PROMPT FOR PRESENTATION FILE(S):
	set theItems to (choose file of type permittedUTIs with prompt "Pick the Keynote presentation(s) to export to movie:" with multiple selections allowed) -- EDITED
	open theItems
end run

on open theItems
	-- TRIGGERED WHEN USER DRAGS ITEMS ONTO THE DROPLET
	display dialog "This droplet will export dragged-on Keynote presentation files as movies" & return & return & "The movies will be encoded to MPEG format using H.264 compression." with icon 1
	set filesToProcess to {}
	-- filter the dragged-on items for Keynote presentation files
	repeat with anItem in theItems
		tell application id "com.apple.systemevents" to set anUTI to type identifier of anItem
		if anUTI is in permittedUTIs then set the end of the filesToProcess to anItem -- EDITED
	end repeat
	if filesToProcess is {} then
		activate
		display alert "INCOMPATIBLE ITEMS" message "None of the items were Keynote presentations."
	else
		-- process the presentations
		my exportPresentationsToMovies(filesToProcess)
	end if
end open

on exportPresentationsToMovies(thePresentations)
	tell application "Keynote"
		activate
		if playing is true then tell front document to stop
		try
			repeat with aPresentation in thePresentations
				open aPresentation
				set the documentName to name of the front document
				set destinationFile to my deriveFileNameForNewFileInFolder(documentName, destinationFolder)
				with timeout of 1200 seconds -- 20 minutes
					export front document to file destinationFile as QuickTime movie with properties {movie format:native size}
				end timeout
				close front document saving no
				display notification documentName with title "Keynote Movie Export"
			end repeat
		on error errorMessage
			activate
			display alert "EXPORT ERROR" message errorMessage
			error number -128
		end try
	end tell
end exportPresentationsToMovies

on deriveFileNameForNewFileInFolder(sourceItemBaseName, targetFolderHFSAlias)
	-- Routine that derives a none-conflicting file name
	set targetName to ((targetFolderHFSAlias & sourceItemBaseName) as text) & ".m4v"
	try
		alias targetName
	on error
		return targetName
	end try
	set n to 1
	repeat
		set targetName to ((targetFolderHFSAlias & sourceItemBaseName) as text) & "(" & n & ").m4v"
		try
			alias targetName
			set n to n + 1
		on error
			return targetName
		end try
	end repeat
end deriveFileNameForNewFileInFolder

I applied it upon a “com.apple.iwork.keynote.key” file.

VLC executed the created m4v file without problem.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 25 mars 2020 11:40:25

Cool :slight_smile:

It would be fine to get feedback from users having documents with UTI com.apple.iwork.keynote.key-tef or com.apple.iwork.keynote.kpf

This way, helpers like us would be aware of behaviors which they can’t test.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 25 mars 2020 13:05:27

Hello Yvan!

Any fix on this? I got mixed up with the code from KniazidisR.

Thank you.

How many slides has your presentation? I tested with 4 slides using my GUI script. The duration of created movie was 20 seconds. When I set values manually it creates movie with duration = 4 seconds. Indeed, it is very strange. It seems to me that setting to 1 second doesn’t work, and remains default value = 5 seconds per slide!!!

The solution founded.

Mm, yes. I barely figured it out … It turns out that you first need to focus the text field. Otherwise, Keynote ignores the new values:


set movieName to "myNewKeynoteMovie"

tell application id "com.apple.systemevents" to tell process "Keynote"
	
	set frontmost to true
	tell menu bar 1 to tell menu bar item "File" to tell menu 1
		tell menu item "Export To" to tell menu 1 to click menu item "Movie…"
	end tell
	
	delay 0.1
	tell window 1 to tell sheet 1
		
		tell (1st text field whose help is "Type how many seconds to wait between slides.")
			set focused to true -- ADDED
			set value to "1"
		end tell
		tell (1st text field whose help is "Type how many seconds to wait between builds.")
			set focused to true -- ADDED
			set value to "0"
		end tell
		delay 1
		
		tell (1st pop up button whose help is "Choose a size for the movie.")
			perform action "AXShowMenu"
			delay 0.1
			click menu item "Custom..." of menu 1
		end tell
		set value of 1st text field whose help is "Type the width you want for the movie." to "1920"
		set value of 1st text field whose help is "Type the height you want for the movie." to "1080"
		
		click (1st radio button whose title is "Apple ProRes 4444")
		delay 0.1
		click button "Next…"
	end tell
	
	delay 1
	click text field 1 of sheet 1 of window 1
	keystroke movieName & return -- naming the movie
	delay 1
	repeat while sheet 1 of window 1 exists -- show creating movie progress
		delay 0.1
	end repeat
	
end tell

English is not used by everybody.

Here is a “partially” localized version.

----------------------------------------------------------------
use AppleScript version "2.5"
use framework "Foundation"
use scripting additions
----------------------------------------------------------------

set thisLocale to current application's NSLocale's currentLocale()
set langX to thisLocale's localeIdentifier as string --> "fr_FR"
set lang2 to thisLocale's languageCode as text --> "fr"
set sys2 to (system attribute "sys2") as integer
tell application "Keynote"
	set x to "1543.title"
	set loc to localized string x from table "MainMenu"
	if loc = x then
		if sys2 < 14 then
			if lang2 = "ar" then
				set loc to "تصدير إلى"
			else if lang2 = "ca" then
				set loc to "¿¿¿"
			else if lang2 = "cs" then
				set loc to "Exportovat do"
			else if lang2 = "da" then
				set loc to "¿¿¿"
			else if lang2 = "de" then
				set loc to "¿¿¿"
			else if lang2 = "el" then
				set loc to "Εξαγωγή σε"
			else if lang2 = "en_AU" then
				set loc to "Export To"
			else if lang2 = "en_GB" then
				set loc to "Export To"
			else if lang2 = "en" then
				set loc to "Export To"
			else if lang2 = "es_419" then
				set loc to "Exportar a"
			else if lang2 = "es" then
				set loc to "Exportar a"
			else if lang2 = "fi" then
				set loc to "¿¿¿"
			else if lang2 = "fr_CA" then
				set loc to "Exporter vers"
			else if lang2 = "fr" then
				set loc to "Exporter vers"
			else if lang2 = "he" then
				set loc to "ייצא אל"
			else if lang2 = "hi" then
				set loc to "इसमें एक्सपोर्ट करें"
			else if lang2 = "hr" then
				set loc to "Eksportiraj u"
			else if lang2 = "hu" then
				set loc to "Exportálás"
			else if lang2 = "id" then
				set loc to "Ekspor Ke"
			else if lang2 = "it" then
				set loc to "¿¿¿"
			else if lang2 = "ja" then
				set loc to "¿¿¿"
			else if lang2 = "ko" then
				set loc to "다음으로 내보내기"
			else if lang2 = "ms" then
				set loc to "Eksport Ke"
			else if lang2 = "nl" then
				set loc to "Exporteer naar"
			else if lang2 = "no" then
				set loc to "¿¿¿"
			else if lang2 = "pl" then
				set loc to "Eksportuj do"
			else if lang2 = "pt_PT" then
				set loc to "Exportar Para"
			else if lang2 = "pt" then
				set loc to "Exportar Para"
			else if lang2 = "ro" then
				set loc to "Exportă în format"
			else if lang2 = "ru" then
				set loc to "¿¿¿"
			else if lang2 = "sk" then
				set loc to "¿¿¿"
			else if lang2 = "sv" then
				set loc to "¿¿¿"
			else if lang2 = "th" then
				set loc to "ส่งออกไปยัง"
			else if lang2 = "tr" then
				set loc to "¿¿¿"
			else if lang2 = "uk" then
				set loc to "¿¿¿"
			else if lang2 = "vi" then
				set loc to "Xuất ra"
			else if lang2 = "zh_CN" then
				set loc to "导出为"
			else if lang2 = "zh_HK" then
				set loc to "輸出至"
			else if lang2 = "zh_TW" then
				set loc to "輸出至"
			else
				set loc to "Export To"
			end if
		else -- Mojave or higher
			set loc to "Export to"
		end if
	end if
	set exportTo_loc to loc
	
	-- set x to "1787.title"
	-- set loc to localized string x from table "MainMenu" -- doesn't cover the entire range
	if lang2 = "ar" then
		set loc to "فيلم…"
	else if lang2 = "ca" then
		set loc to "Vídeo…"
	else if lang2 = "cs" then
		set loc to "Film…"
	else if lang2 = "da" then
		set loc to "Film…"
	else if lang2 = "de" then
		set loc to "Film …"
	else if lang2 = "el" then
		set loc to "Ταινία…"
	else if lang2 = "en_AU" then
		set loc to "Movie…"
	else if lang2 = "en_GB" then
		set loc to "Movie…"
	else if lang2 = "en" then
		set loc to "Movie…"
	else if lang2 = "es_419" then
		set loc to "Video…"
	else if lang2 = "es" then
		set loc to "Vídeo…"
	else if lang2 = "fi" then
		set loc to "Elokuva…"
	else if lang2 = "fr_CA" then
		set loc to "Vidéo…"
	else if lang2 = "fr" then
		set loc to "Vidéo…"
	else if lang2 = "he" then
		set loc to "סרטון…"
	else if lang2 = "hi" then
		set loc to "फ़िल्म…"
	else if lang2 = "hr" then
		set loc to "Film…"
	else if lang2 = "hu" then
		set loc to "Film…"
	else if lang2 = "id" then
		set loc to "Film…"
	else if lang2 = "it" then
		set loc to "Filmato…"
	else if lang2 = "ja" then
		set loc to "ムービー…"
	else if lang2 = "ko" then
		set loc to "동영상…"
	else if lang2 = "ms" then
		set loc to "Filem…"
	else if lang2 = "nl" then
		set loc to "Film…"
	else if lang2 = "no" then
		set loc to "Film…"
	else if lang2 = "pl" then
		set loc to "Film…"
	else if lang2 = "pt_PT" then
		set loc to "Filme…"
	else if lang2 = "pt" then
		set loc to "Filme…"
	else if lang2 = "ro" then
		set loc to "Film…"
	else if lang2 = "ru" then
		set loc to "Фильм…"
	else if lang2 = "sk" then
		set loc to "Film…"
	else if lang2 = "sv" then
		set loc to "Film…"
	else if lang2 = "th" then
		set loc to "ภาพยนตร์…"
	else if lang2 = "tr" then
		set loc to "Film…"
	else if lang2 = "uk" then
		set loc to "Фільм…"
	else if lang2 = "vi" then
		set loc to "Phim…"
	else if lang2 = "zh_CN" then
		set loc to "影片…"
	else if lang2 = "zh_HK" then
		set loc to "影片⋯"
	else if lang2 = "zh_TW" then
		set loc to "影片⋯"
	else
		set loc to "Movie…"
	end if
	set movieDots_loc to loc
	
	set x to "kn.exportQuickTime.goToNextSlideAfterField"
	set exportQuickTimeGoToNextSlideAfterField_loc to localized string x from table "TMAToolTips"
	
	set x to "kn.exportQuickTime.goToNextBuildAfterField"
	set exportQuickTimeGoToNextBuildAfterField_loc to localized string x from table "TMAToolTips"
	
	set x to "260.title"
	set loc to localized string x from table "KNMacExportQuickTimeFormatOptionsView"
	if loc = x then
		if sys2 < 14 then
			if lang2 = "ar" then
				set loc to "مخصص..."
			else if lang2 = "ca" then
				set loc to "Personalitzar…"
			else if lang2 = "cs" then
				set loc to "Vlastní…"
			else if lang2 = "da" then
				set loc to "Speciel…"
			else if lang2 = "de" then
				set loc to "Eigene …"
			else if lang2 = "el" then
				set loc to "Προσαρμογή…"
			else if lang2 = "en_AU" then
				set loc to "Custom..."
			else if lang2 = "en_GB" then
				set loc to "Custom..."
			else if lang2 = "en" then
				set loc to "Custom..."
			else if lang2 = "es_419" then
				set loc to "Personalizar…"
			else if lang2 = "es" then
				set loc to "Personalizar…"
			else if lang2 = "fi" then
				set loc to "Muokattu…"
			else if lang2 = "fr_CA" then
				set loc to "Personnaliser…"
			else if lang2 = "fr" then
				set loc to "Personnaliser…"
			else if lang2 = "he" then
				set loc to "מותאם אישית…"
			else if lang2 = "hi" then
				set loc to "कस्टम..."
			else if lang2 = "hr" then
				set loc to "Po izboru..."
			else if lang2 = "hu" then
				set loc to "Egyéni..."
			else if lang2 = "id" then
				set loc to "Khusus..."
			else if lang2 = "it" then
				set loc to "Personalizzata…"
			else if lang2 = "ja" then
				set loc to "カスタム…"
			else if lang2 = "ko" then
				set loc to "사용자화..."
			else if lang2 = "ms" then
				set loc to "Tersuai…"
			else if lang2 = "nl" then
				set loc to "Aangepast..."
			else if lang2 = "no" then
				set loc to "Tilpasset…"
			else if lang2 = "pl" then
				set loc to "Własna…"
			else if lang2 = "pt_PT" then
				set loc to "Personalizar…"
			else if lang2 = "pt" then
				set loc to "Personalizar…"
			else if lang2 = "ro" then
				set loc to "Personalizat…"
			else if lang2 = "ru" then
				set loc to "Настроить…"
			else if lang2 = "sk" then
				set loc to "Vlastné…"
			else if lang2 = "sv" then
				set loc to "Anpassat..."
			else if lang2 = "th" then
				set loc to "กำหนดเอง…"
			else if lang2 = "tr" then
				set loc to "Özel..."
			else if lang2 = "uk" then
				set loc to "власний варіант…"
			else if lang2 = "vi" then
				set loc to "Tùy chỉnh..."
			else if lang2 = "zh_CN" then
				set loc to "自定…"
			else if lang2 = "zh_HK" then
				set loc to "自訂⋯"
			else if lang2 = "zh_TW" then
				set loc to "自訂⋯"
			else
				set loc to "Custom…"
			end if
		else -- Mojave or higher
			set loc to "Custom..."
		end if
	end if
	set customDots_loc to loc
	
	set x to "kn.exportQuickTime.formatCustomWidthField"
	set exportQuickTimeFormatCustomWidthField_loc to localized string x from table "TMAToolTips"
	
	set x to "kn.exportQuickTime.formatCustomHeightField"
	set exportQuickTimeFormatCustomHeightField_loc to localized string x from table "TMAToolTips"
	
	set x to "kn.exportQuickTime.formatPopUp"
	set exportQuickTimeFormatPopUp_loc to localized string x from table "TMAToolTips"
	
	set x to "Next" & character id 92 & "U2026"
	set nextDots_loc to localized string x from table "TSApplication"
	
end tell

set movieName to "myNewKeynoteMovie"

tell application id "com.apple.systemevents" to tell process "Keynote"
	
	set frontmost to true
	tell menu bar 1 to tell menu bar item 3 to tell menu 1
		tell menu item exportTo_loc to tell menu 1 to click menu item movieDots_loc
	end tell
	
	delay 0.1
	tell window 1 to tell sheet 1
		
		tell (1st text field whose help is exportQuickTimeGoToNextSlideAfterField_loc)
			set focused to true -- ADDED
			set value to "1"
		end tell
		tell (1st text field whose help is exportQuickTimeGoToNextBuildAfterField_loc)
			set focused to true -- ADDED
			set value to "0"
		end tell
		delay 1
		
		tell (1st pop up button whose help is exportQuickTimeFormatPopUp_loc)
			perform action "AXShowMenu"
			delay 0.1
			click menu item customDots_loc of menu 1
		end tell
		set value of 1st text field whose help is exportQuickTimeFormatCustomWidthField_loc to "1920"
		set value of 1st text field whose help is exportQuickTimeFormatCustomHeightField_loc to "1080"
		
		click (1st radio button whose title is "Apple ProRes 4444") -- isn't localized
		delay 0.1
		click button nextDots_loc
	end tell
	
	delay 1
	click text field 1 of sheet 1 of window 1
	keystroke movieName & return -- naming the movie
	delay 1
	repeat while sheet 1 of window 1 exists -- show creating movie progress
		delay 0.1
	end repeat
	
end tell

I’m busy to enhance the cases where there is a test after the call to localized string because these tests don’t treat every cases.

As you may see several strings are missing.
At this time I didn’t found them.
The links between the property which I named lang2 is right for most cases.
For languages grabbing their string in a lproj named like en_GB.lproj,
I am unable to build the exact link.
I tried to install and activate some of them (like “pt” Portuguese from Brazil and “pt_PT”
Portuguese from Portugal) but on my machine they were given the same couples:

set langX to thisLocale's localeIdentifier as string --> "pt_FR"
set lang2 to thisLocale's languageCode as text --> "pt"

So I didn’t understood how the system link them to the correct spelling.

If someone knows the correct incantation, I am interested.

I apologize if I introduced typos when I inserted the strings belonging to languages which I totally ignore.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 26 mars 2020 22:25:15

When I said that I love the English interface, I did not want to offend others. Anyone can choose the interface they need from your script and the script will be as concise as English. Special thanks for the Greek interface.

NOTE: if you created the correspondence of the language and the value in the form of records at the beginning of the script, then your script can be greatly reduced.

I say this because this is not the first time I have seen this bad practice of hard-coded verification of conditions for truth:


set langRecord to {ar:"مخصص...", ca:"Personalitzar…"}

set lang2 to "ar"

set the clipboard to langRecord
set langRecordAsList to the clipboard as list

repeat with i from 1 to count langRecordAsList by 2
	if lang2 is item i of langRecordAsList then
		set loc to item (i + 1) of langRecordAsList
		exit repeat
	end if
end repeat

return loc

This my script is equivalent to the following your code. And you need it twice… Imagine that a programmer needs to sort out 250 languages or more, and not 40 as here …:


if lang2 = "ar" then
               set loc to "مخصص..."
           else if lang2 = "ca" then
               set loc to "Personalitzar…"
           else if lang2 = "cs" then
               set loc to "Vlastní…"
           else if lang2 = "da" then
               set loc to "Speciel…"
           else if lang2 = "de" then
               set loc to "Eigene …"
           else if lang2 = "el" then
               set loc to "Προσαρμογή…"
           else if lang2 = "en_AU" then
               set loc to "Custom..."
           else if lang2 = "en_GB" then
               set loc to "Custom..."
           else if lang2 = "en" then
               set loc to "Custom..."
           else if lang2 = "es_419" then
               set loc to "Personalizar…"
           else if lang2 = "es" then
               set loc to "Personalizar…"
           else if lang2 = "fi" then
               set loc to "Muokattu…"
           else if lang2 = "fr_CA" then
               set loc to "Personnaliser…"
           else if lang2 = "fr" then
               set loc to "Personnaliser…"
           else if lang2 = "he" then
               set loc to "מותאם אישית…"
           else if lang2 = "hi" then
               set loc to "कस्टम..."
           else if lang2 = "hr" then
               set loc to "Po izboru..."
           else if lang2 = "hu" then
               set loc to "Egyéni..."
           else if lang2 = "id" then
               set loc to "Khusus..."
           else if lang2 = "it" then
               set loc to "Personalizzata…"
           else if lang2 = "ja" then
               set loc to "カスタム…"
           else if lang2 = "ko" then
               set loc to "사용자화..."
           else if lang2 = "ms" then
               set loc to "Tersuai…"
           else if lang2 = "nl" then
               set loc to "Aangepast..."
           else if lang2 = "no" then
               set loc to "Tilpasset…"
           else if lang2 = "pl" then
               set loc to "Własna…"
           else if lang2 = "pt_PT" then
               set loc to "Personalizar…"
           else if lang2 = "pt" then
               set loc to "Personalizar…"
           else if lang2 = "ro" then
               set loc to "Personalizat…"
           else if lang2 = "ru" then
               set loc to "Настроить…"
           else if lang2 = "sk" then
               set loc to "Vlastné…"
           else if lang2 = "sv" then
               set loc to "Anpassat..."
           else if lang2 = "th" then
               set loc to "กำหนดเอง…"
           else if lang2 = "tr" then
               set loc to "Özel..."
           else if lang2 = "uk" then
               set loc to "власний варіант…"
           else if lang2 = "vi" then
               set loc to "Tùy chỉnh..."
           else if lang2 = "zh_CN" then
               set loc to "自定…"
           else if lang2 = "zh_HK" then
               set loc to "自訂⋯"
           else if lang2 = "zh_TW" then
               set loc to "自訂⋯"
           else
               set loc to "Custom…"
           end if
       else -- Mojave or higher
           set loc to "Custom..."
       end if

You can create 1 text file LocalStrings.txt as database, and in it - records, for 10 basic (or more) locals. To each English TEXT should correspond 1 record. There are not so many English texts of UI elements, so this is quite real.

Putting English local in each record as 1st entry, you can determine always what English TEXT is this record for. Then you can simply copy the record and paste in the new created script when you need. This way you create step by step wonderful database, to reuse it multiply times.

Because searching some English text in the text file is not problem. Then, you can sell this database to other programmers as well. :lol: Or, to make a wide gesture - to give as I do. Take it, it’s not a pity.

NOTE: the most appropriate approach would be to create a separate LocalStrings.txt file for each specific application. Because the translation of the same English text can potentially differ from application to application. I think, it can even be automated.

The real problem is to be able to identify the language which is used.
How may we know if it’s “pt.lproj” or “pt_PT.lproj” which is used ?
According to that, some strings aren’t localized the same way.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 27 mars 2020 09:39:46

Yvan, I just haven’t done this yet, but the logic tells me that the application somehow determines which project to use. Most likely from some kind of plist file.

I know that you have been doing script localization for a long time. I need time to read your previous posts about this problem and think about it more seriously. If I find a solution, I will post it HERE.

I got it.

----------------------------------------------------------------
use AppleScript version "2.5"
use framework "Foundation"
use scripting additions
----------------------------------------------------------------

property |⌘| : a reference to current application

# List of the languages known by the application -- here the 39 ones known by iWork and by the system
set known to {"ar", "ca", "cs", "da", "de", "el", "en_AU", "en_GB", "en", "es_419", "es", "fi", "fr_CA", "fr", "he", "hi", "hr", "hu", "id", "it", "ja", "ko", "ms", "nl", "no", "pl", "pt_PT", "pt", "ro", "ru", "sk", "sv", "th", "tr", "uk", "vi", "zh_CN", "zh_HK", "zh_TW"}

# Grab the System's language setting
set currentLocale to |⌘|'s NSLocale's currentLocale()
set preferredLanguages to |⌘|'s NSLocale's preferredLanguages() as list
--> (*fr-FR, en-FR, de-FR, sv-FR, zh-Hans-FR*)
--> (*pt-PT, fr-FR, en-FR, de-FR, zh-Hans-FR, pt-BR, fr-CA*) -- use Portuguese from Portugal
--> (*pt-BR, pt-PT, fr-FR, en-FR, de-FR, zh-Hans-FR, fr-CA*) -- use Portuguese from Brazil
--> (*fr-CA, pt-BR, pt-PT, fr-FR, en-FR, de-FR, zh-Hans-FR*) -- use French from Canada

set countryCode to currentLocale's countryCode as text --> "FR" -- "FR"
set activeLanguage to item 1 of preferredLanguages
if activeLanguage ends with "-" & countryCode then set activeLanguage to text 1 thru -4 of activeLanguage
if activeLanguage is "pt-BR" then set activeLanguage to "pt" -- use pt.lproj
if activeLanguage is "zh-Hant-MO" then set activeLanguage to "zh_CN" -- use zh_CN.lproj
if activeLanguage is "zh-Hant-TW" then set activeLanguage to "zh_TW" -- use zh_TW.lproj
if activeLanguage is "no" then set activeLanguage to "nb" -- use nb.lproj
if activeLanguage contains "-" then set activeLanguage to my remplace(activeLanguage, "-", "_")
if activeLanguage is not in known then set activeLanguage to "en"
-- Now we have the key to know which string to use.


tell application "Keynote"
	set x to "1543.title"
	set loc to localized string x from table "MainMenu"
	if loc = x then
		if sys2 < 14 then
			if activeLanguage = "ar" then
				set loc to "تصدير إلى"
			else if activeLanguage = "ca" then
				set loc to "Exportar a"
			else if activeLanguage = "cs" then
				set loc to "Exportovat do"
			else if activeLanguage = "da" then
				set loc to "Eksporter til"
			else if activeLanguage = "de" then
				set loc to "Exportieren"
			else if activeLanguage = "el" then
				set loc to "Εξαγωγή σε"
			else if activeLanguage = "en_AU" then
				set loc to "Export To"
			else if activeLanguage = "en_GB" then
				set loc to "Export To"
			else if activeLanguage = "en" then
				set loc to "Export To"
			else if activeLanguage = "es_419" then
				set loc to "Exportar a"
			else if activeLanguage = "es" then
				set loc to "Exportar a"
			else if activeLanguage = "fi" then
				set loc to "Vie muodossa"
			else if activeLanguage = "fr_CA" then
				set loc to "Exporter vers"
			else if activeLanguage = "fr" then
				set loc to "Exporter vers"
			else if activeLanguage = "he" then
				set loc to "ייצא אל"
			else if activeLanguage = "hi" then
				set loc to "इसमें एक्सपोर्ट करें"
			else if activeLanguage = "hr" then
				set loc to "Eksportiraj u"
			else if activeLanguage = "hu" then
				set loc to "Exportálás"
			else if activeLanguage = "id" then
				set loc to "Ekspor Ke"
			else if activeLanguage = "it" then
				set loc to "Esporta come"
			else if activeLanguage = "ja" then
				set loc to "書き出す"
			else if activeLanguage = "ko" then
				set loc to "다음으로 내보내기"
			else if activeLanguage = "ms" then
				set loc to "Eksport Ke"
			else if activeLanguage = "nl" then
				set loc to "Exporteer naar"
			else if (activeLanguage = "no") or activeLanguage = "nb" then
				set loc to "Eksporter til"
			else if activeLanguage = "pl" then
				set loc to "Eksportuj do"
			else if activeLanguage = "pt_PT" then
				set loc to "Exportar Para"
			else if activeLanguage = "pt" then
				set loc to "Exportar Para"
			else if activeLanguage = "ro" then
				set loc to "Exportă în format"
			else if activeLanguage = "ru" then
				set loc to "Экспортировать в"
			else if activeLanguage = "sk" then
				set loc to "Exportovať ako"
			else if activeLanguage = "sv" then
				set loc to "Exportera till"
			else if activeLanguage = "th" then
				set loc to "ส่งออกไปยัง"
			else if activeLanguage = "tr" then
				set loc to "Şuraya Aktar"
			else if activeLanguage = "uk" then
				set loc to "Експортувати в"
			else if activeLanguage = "vi" then
				set loc to "Xuất ra"
			else if activeLanguage = "zh_CN" then
				set loc to "导出为"
			else if activeLanguage = "zh_HK" then
				set loc to "輸出至"
			else if activeLanguage = "zh_TW" then
				set loc to "輸出至"
			else
				set loc to "Export To"
			end if
		else -- Mojave or higher
			set loc to "Export to"
		end if
	end if
	set exportTo_loc to loc
end tell
-- or, faster:

if activeLanguage = "ar" then
	set loc to "تصدير إلى"
else if activeLanguage = "ca" then
	set loc to "Exportar a"
else if activeLanguage = "cs" then
	set loc to "Exportovat do"
else if activeLanguage = "da" then
	set loc to "Eksporter til"
else if activeLanguage = "de" then
	set loc to "Exportieren"
else if activeLanguage = "el" then
	set loc to "Εξαγωγή σε"
else if activeLanguage = "en_AU" then
	set loc to "Export To"
else if activeLanguage = "en_GB" then
	set loc to "Export To"
else if activeLanguage = "en" then
	set loc to "Export To"
else if activeLanguage = "es_419" then
	set loc to "Exportar a"
else if activeLanguage = "es" then
	set loc to "Exportar a"
else if activeLanguage = "fi" then
	set loc to "Vie muodossa"
else if activeLanguage = "fr_CA" then
	set loc to "Exporter vers"
else if activeLanguage = "fr" then
	set loc to "Exporter vers"
else if activeLanguage = "he" then
	set loc to "ייצא אל"
else if activeLanguage = "hi" then
	set loc to "इसमें एक्सपोर्ट करें"
else if activeLanguage = "hr" then
	set loc to "Eksportiraj u"
else if activeLanguage = "hu" then
	set loc to "Exportálás"
else if activeLanguage = "id" then
	set loc to "Ekspor Ke"
else if activeLanguage = "it" then
	set loc to "Esporta come"
else if activeLanguage = "ja" then
	set loc to "書き出す"
else if activeLanguage = "ko" then
	set loc to "다음으로 내보내기"
else if activeLanguage = "ms" then
	set loc to "Eksport Ke"
else if activeLanguage = "nl" then
	set loc to "Exporteer naar"
else if (activeLanguage = "no") or activeLanguage = "nb" then
	set loc to "Eksporter til"
else if activeLanguage = "pl" then
	set loc to "Eksportuj do"
else if activeLanguage = "pt_PT" then
	set loc to "Exportar Para"
else if activeLanguage = "pt" then
	set loc to "Exportar Para"
else if activeLanguage = "ro" then
	set loc to "Exportă în format"
else if activeLanguage = "ru" then
	set loc to "Экспортировать в"
else if activeLanguage = "sk" then
	set loc to "Exportovať ako"
else if activeLanguage = "sv" then
	set loc to "Exportera till"
else if activeLanguage = "th" then
	set loc to "ส่งออกไปยัง"
else if activeLanguage = "tr" then
	set loc to "Şuraya Aktar"
else if activeLanguage = "uk" then
	set loc to "Експортувати в"
else if activeLanguage = "vi" then
	set loc to "Xuất ra"
else if activeLanguage = "zh_CN" then
	set loc to "导出为"
else if activeLanguage = "zh_HK" then
	set loc to "輸出至"
else if activeLanguage = "zh_TW" then
	set loc to "輸出至"
end if
set export_loc to loc

#=====

on remplace(t, d1, d2)
	local oTIDs, l
	set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d1}
	set l to text items of t
	set AppleScript's text item delimiters to d2
	set t to l as text
	set AppleScript's text item delimiters to oTIDs
	return t
end remplace

#=====

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 27 mars 2020 12:18:59

I completed the script in my preceding message because I grabbed the missing strings.

To do that I ran the app in the 39 language it’s aware of.
I used the script below adapted from a Nigel Garvey’s one.
I dropped the code allowing us to choose what to do because applying to 39 versions is boring.

----------------------------------------------------------------
use AppleScript version "2.5"
use framework "Foundation"
use scripting additions
----------------------------------------------------------------

property ScriptTitle : "UI Properties"

property appName : "Keynote" -- Edit to fit your needs



-- By squaline (alias partron22?), emendelson, and Nigel Garvey.
-- http://macscripter.net/viewtopic.php?id=37674

-- Edited by Yvan KOENIG (VALLAURIS, France) vendredi 27 mars 2020  16:50:14

on main()
	
	# Grab the System's language setting
	set currentLocale to current application's NSLocale's currentLocale()
	set preferredLanguages to current application's NSLocale's preferredLanguages() as list
	--> (*fr-FR, en-FR, de-FR, sv-FR, zh-Hans-FR*)
	--> (*pt-PT, fr-FR, en-FR, de-FR, zh-Hans-FR, pt-BR, fr-CA*) -- use Portuguese from Portugal
	--> (*pt-BR, pt-PT, fr-FR, en-FR, de-FR, zh-Hans-FR, fr-CA*) -- use Portuguese from Brazil
	--> (*fr-CA, pt-BR, pt-PT, fr-FR, en-FR, de-FR, zh-Hans-FR*) -- use French from Canada
	
	set countryCode to currentLocale's countryCode as text --> "FR" -- "FR"
	set activeLanguage to item 1 of preferredLanguages
	try
		tell application appName to quit
	end try
	try
		delay 0.2
		tell application appName to activate -- to force it to use the newly selected language
		
		tell application "System Events"
			tell application process appName
				set frontmost to true
				(*
				set {windowExists, menuExists} to {front window exists, menu bar 1 exists}
				
				set {winstuff, menustuff} to {"(No window open)", "(No menu!)"}
				if outputType is "Window" then
					if (windowExists) then
						set winstuff to my listToText(entire contents of front window)
					else
						error number 3000
					end if
				else
					if (menuExists) then
						set menustuff to my listToText(entire contents of menu bar 1)
					else
						error number 3001
					end if
				end if
				*)
				
				set outputType to "Menu"
				set menustuff to my listToText(entire contents of menu bar 1)
			end tell
		end tell
	on error e number n
		tell application "System Events" to set frontmost of application process curApp to true
		tell application curApp to activate
		if n = 3000 then
			tell application curApp to display alert "No windows to gather data from!"
			
		else if n = 3001 then
			tell application curApp to display alert "No menu to gather data from!"
		end if
		error number -128
	end try
	
	set p2d to path to desktop as text
	set dest to (p2d & activeLanguage & ".rtf") as «class furl»
	tell application "TextEdit"
		activate
		set newDoc to make new document at the front
		save newDoc in dest
		if outputType is "Window" then
			set the text of the front document to winstuff
		else
			set the text of the front document to menustuff
		end if
		set WrapToWindow to text 2 thru -1 of (localized string "&Wrap to Window")
	end tell
	
	tell application "System Events"
		tell application process "TextEdit"
			tell menu item WrapToWindow of menu 1 of menu bar item 5 of menu bar 1
				if ((it exists) and (it is enabled)) then perform action "AXPress"
			end tell
		end tell
	end tell
	--tell application curApp to activate
	do shell script "open -b \"com.apple.textedit\""
	
end main

on listToText(entireContents) -- (Handler specialised for lists of System Events references.)
	try
		|| of entireContents -- Deliberate error.
	on error stuff -- Get the error message
	end try
	
	-- Parse the message.
	set astid to AppleScript's text item delimiters
	set AppleScript's text item delimiters to {"{", "}"} -- Snow Leopard or later.
	set stuff to text from text item 2 to text item -2 of stuff
	
	-- If the list text isn't in decompiled form, create a script containing the list in its source code, store it in the Temporary Items folder, and run "osadecompile" on it.
	if (stuff does not contain "application process \"") then
		try
			set scpt to (run script "script
	tell app \"System Events\"
	{" & stuff & "}
	end
	end")
		on error errMsg
			set AppleScript's text item delimiters to astid
			tell application (path to frontmost application as text) to display dialog errMsg buttons {"OK"} default button 1 with icon caution
			return errMsg
		end try
		set tmpPath to (path to temporary items as text) & "Entire contents.scpt"
		store script scpt in file tmpPath replacing yes
		set stuff to (do shell script "osadecompile " & quoted form of POSIX path of tmpPath)
		set stuff to text from text item 2 to text item -2 of stuff
	end if
	
	-- Break up the text, using "\"System Events\", " as a delimiter.
	set AppleScript's text item delimiters to "\"System Events\", "
	set stuff to stuff's text items
	-- Insert a textual "reference" to the root object at the beginning of the resulting list.
	set AppleScript's text item delimiters to " of "
	set beginning of stuff to (text from text item 2 to -1 of item 1 of stuff) & "\"System Events\""
	-- Reduce the remaining "reference" fragments to object specifiers, tabbed according to the number of elements in the references.
	set tabs to tab & tab & tab & tab & tab & tab & tab & tab
	set tabs to tabs & tabs
	set tabs to tabs & tabs -- 32 tabs should be enough!
	repeat with i from 2 to (count stuff)
		set thisLine to item i of stuff
		set lineBits to thisLine's text items
		-- Make sure any " of "s in element names aren't mistaken for those of the reference!
		set elementCount to 0
		set nameContinuation to false
		repeat with j from 1 to (count lineBits)
			set thisBit to item j of lineBits
			if ((not ((nameContinuation) or (thisBit contains "\""))) or ((thisBit ends with "\"") and (thisBit does not end with "\\\"")) or (thisBit ends with "\\\\\"")) then
				-- thisBit is either a complete nameless-element specifier or it ends the right way to be either a complete named one or the completion of a name.
				set nameContinuation to false
				set elementCount to elementCount + 1
				if (elementCount is 1) then set spec to text 1 thru text item j of thisLine
			else
				-- The next "bit" will be the continuation of a name containing " of ".
				set nameContinuation to true
			end if
		end repeat
		set item i of stuff to (text 1 thru (elementCount - 3) of tabs) & spec
	end repeat
	-- Coerce back to a single text, inserting line feeds between the items.
	set AppleScript's text item delimiters to linefeed
	set stuff to stuff as text
	set AppleScript's text item delimiters to astid
	
	return stuff
end listToText

main()

Yvan KOENIG (VALLAURIS, France) vendredi 27 mars 2020 16:51:55

Thanks for this KniazidisR! Did not know the issue was focusing the text field11

Yvan Koenig, I have combined part of KniazidisR’s code into yours. Now it seems to work. Durations are the same.


(*
-- code dropped because it doesn't apply when the app is used in French.
Apple forgot to insert the file: "Keynote.app:Contents:Resources:fr.lproj:MainMenu.strings". They put a MainMenu.nib file.
Happily, there is a clone available as :
"Keynote.app:Contents:Resources:fr_CA.lproj:MainMenu.strings"
On my copy I duplicated the file so now the code works.
Maybe the file is available in versions newer than 9.1
Same odd omission in Pages and Numbers
As the numbering of menu items doesn't change since several years, I choose to trigger the menu items by their index.

tell application "Keynote"
   set exportTo_loc to localized string "1543.title" from table "MainMenu" --> "Exporter vers"
end tell
*)

set indexFile to 3 -- index of menu "File" ("Fichier")
set indexExportTo to 14 -- index of menu item "Export To" ("Exporter vers")
set indexMovie to 3 -- index of menu item "Movie…" ("Vidéo…")

tell application id "com.apple.systemevents" to tell process "Keynote"
	set frontmost to true
	tell menu bar 1
		-- get name of menu bar items --> {"Apple", "Keynote", "Fichier", "Édition", "Insérer", "Diapositive", "Format", "Disposition", "Présentation", "Lecture", "Partager", "Fenêtre", "Aide"}
		-- get name of menu bar item indexFile --> "Fichier"
		tell menu bar item indexFile to tell menu 1
			-- get name of menu items --> {"Nouveau", "Créer à partir de la liste de thèmes…", "Ouvrir…", "Ouvrir un document récent", missing value, "Fermer", "Tout fermer", "Enregistrer", "Enregistrer sous…", "Dupliquer", "Renommer…", "Déplacer vers…", "Revenir à", "Exporter vers", missing value, "Réduire la taille du fichier…", "Avancé", missing value, "Définir un mot de passe…", missing value, "Modifier le thème…", "Enregistrer le thème…", missing value, "Imprimer…"}
			-- get name of menu item indexExportTo --> "Exporter vers"
			tell menu item indexExportTo to tell menu 1
				-- get name of menu items --> {"PDF…", "PowerPoint…", "Vidéo…", "GIF animé…", "Images…", "HTML…", "Keynote ’09…"}
				-- get name of menu item indexMovie --> "Vidéo…"
				click menu item indexMovie
			end tell -- menu item indexMovie
		end tell -- menu bar item indexFile
	end tell -- menu bar 1
	-- class of UI elements
	tell (first window whose subrole is "AXStandardWindow") -- EDITED
		
		class of UI elements --> {radio group, checkbox, static text, scroll area, scroll area, scroll area, button, button, button, menu button, toolbar, image, static text, sheet}
		
		
		tell sheet 1
			-- class of UI elements --> {static text, list, static text, pop up button, static text, text field, static text, static text, text field, static text, static text, static text, text field, static text, text field, radio button, radio button, static text, pop up button, static text, button, button, button}
			-- help of text fields --> {"Saisissez le nombre de secondes d’attente entre chaque diapositive.", "Saisissez le nombre de secondes d’attente entre chaque composition.", missing value, missing value} -- ADDED
			tell (1st text field whose help is "Type how many seconds to wait between slides.")
				set focused to true -- ADDED
				set value to "1"
			end tell
			tell (1st text field whose help is "Type how many seconds to wait between builds.")
				set focused to true -- ADDED
				set value to "0"
			end tell
			delay 0.1
			-- help of pop up button 1 --> "Choisissez le mode de lecture de la vidéo."
			-- help of pop up button 2 --> "Choisissez une taille pour la vidéo."
			tell pop up button 2
				its value --> "1024 x 768"
				click it
				repeat 50 times
					if exists menu 1 then exit repeat
					delay 0.2
				end repeat
				tell menu 1
					-- class of UI elements --> {menu item, menu item, menu item, menu item}
					-- name of menu items --> {"1024 x 768", "720p", "1080p", "Personnaliser…"}
					click menu item -1 -- Custom
				end tell
			end tell
			set checkBoxAvailable to (class of UI elements) contains checkbox --> {static text, list, static text, pop up button, static text, text field, static text, static text, text field, static text, static text, static text, text field, static text, text field, radio button, radio button, static text, pop up button, text field, static text, text field, static text, static text, checkbox, radio button, radio button, radio button, button, button, button}
			
			-- help of text field -2 --> "Saisissez la largeur voulue pour la vidéo."
			-- help of text field -1 --> "Saisissez la hauteur voulue pour la vidéo."
			-- value of text field -2 --> "1024"
			-- value of text field -1 --> "768"
			set value of text field -2 to "1920" -- must be a string
			set value of text field -1 to "1080" -- must be a string
			
			-- name of radio button -3 --> "Apple ProRes 422"
			-- name of radio button -2 --> "H.264"
			-- name of radio button -1 --> "Apple ProRes 4444"
			click radio button -1
			if checkBoxAvailable then
				-- name of checkbox 1 --> "Exporter avec des arrière-plans transparents"
				value of checkbox 1 --> 1
				
				-- set value of checkbox 1 to 1 -- enable it to check the box
				-- set value of checkbox 1 to 0 -- enable it to uncheck the box
			end if
			
		end tell -- sheet 1
		
	end tell
end tell -- System Events

Hello,

I have updated my OS to Monterey and I am using the latest version of Keynote 11.2.

It seems that now the script is broken.

The script will not select the Frame Rate and ProRes 4444.

Yvan Koenig, is it possible to update and fix this?

Thank you.

After much tinkering, I have mange to update the script for the latest Keynote

set indexFile to 3
set indexExportTo to 14
set indexMovie to 3

tell application id "com.apple.systemevents" to tell process "Keynote"
	set frontmost to true
	tell menu bar 1
		tell menu bar item indexFile to tell menu 1
			tell menu item indexExportTo to tell menu 1
				click menu item indexMovie
			end tell
		end tell
	end tell
	class of UI elements
	tell (first window whose subrole is "AXStandardWindow")
		class of UI elements
		tell sheet 1
			set value of text field 1 to "5" --> Go to next slide after
			set value of text field 2 to "2" --> Go to next build after
			
			tell pop up button 2
				its value
				click it
				repeat 50 times
					if exists menu 1 then exit repeat
					delay 0.2
				end repeat
				tell menu 1
					click menu item 3 --> Custom
				end tell
			end tell
			
			tell pop up button 3
				its value
				click it
				repeat 50 times
					if exists menu 1 then exit repeat
					delay 0.2
				end repeat
				tell menu 1
					click menu item 4 --> 25FPS
				end tell
			end tell
			
			tell pop up button 4
				its value
				click it
				repeat 50 times
					if exists menu 1 then exit repeat
					delay 0.2
				end repeat
				tell menu 1
					click menu item 7 --> Apple ProRes 4444
				end tell
			end tell
			
			set checkBoxAvailable to (class of UI elements) contains checkbox
			
			set value of text field -2 to "1920" --> Set Dimensions
			set value of text field -1 to "1080" --> Set Dimensions
			
			click radio button -1 --> "All Slides or From"
			if checkBoxAvailable then
				value of checkbox 1 --> 1
			end if
			
		end tell
		
	end tell
end tell

In case anyone needs it or would like to improve on it.