Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethanliew/92c03125727a22235d9255bb2413ecff to your computer and use it in GitHub Desktop.
Save ethanliew/92c03125727a22235d9255bb2413ecff to your computer and use it in GitHub Desktop.
AppleScript to batch-export an entire folder of Camtasia 3 projects with your default settings.
set projDir to choose folder with prompt "Choose a folder with .cmproj files in it" without invisibles
set myDirectory to POSIX path of projDir
tell application "Finder"
set fl to files of alias (projDir as text)
end tell
repeat with f in fl
set n to name of f
if n ends with ".cmproj" then
set offs to offset of ".cmproj" in n
set exportName to (text 1 through offs of n) & "mp4"
tell application "Camtasia 3"
open f
repeat
delay 1
if number of documents > 0 then
if name of first document = n then
exit repeat
end if
end if
end repeat
end tell
tell application "System Events" to tell process "Camtasia 3"
#click menu item "Export…" of menu "Share" of menu bar item "Share" of menu bar 1
repeat
key code 14 using {command down}
delay 0.5
try
tell window n to click button "Export" of sheet 1
exit repeat
end try
# 1 – none; 2 – axraise; 3 – window menu
tell window n to perform action "AXRaise"
#click menu item n of menu "Window" of menu bar item "Window" of menu bar 1
delay 0.1
end repeat
repeat
try
static text "Export finished" of sheet 1 of window n
tell window n to click button "Close" of sheet 1
exit repeat
end try
delay 2
end repeat
end tell
(*
tell project of first document
export file myDirectory & "/" & exportName
repeat
set shouldExit to not isExporting
if shouldExit then exit repeat
delay 2
end repeat
end tell
*)
tell application "Camtasia 3"
close every document without saving
end tell
end if
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment