Skip to content

Instantly share code, notes, and snippets.

@walkingriver
Created November 7, 2017 23:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save walkingriver/5832d8b49b92e164593e11610b3f6fc0 to your computer and use it in GitHub Desktop.
Save walkingriver/5832d8b49b92e164593e11610b3f6fc0 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
@walkingriver
Copy link
Author

Quickstart

  • Manually export a single project. Whatever settings you last chose will be used by this process.
  • Open this script in the Apple Script Editor.
  • Click the Play button.
  • Select the folder with your .cmproj files.
  • Let the script do the rest.
  • Come back later.

Notes

  • This is very rudimentary, but I find it useful.
  • There is little to no error handling here.
  • If you bring another app to the foreground, the script gets confused.

Contributing

  • If you find it useful, and you can make it better, feel free to suggest enhancements.
  • I didn't write this, and don't remember where I got it, or I'd be happy to acknowledge the original author.
  • All I did was update it to work with Camtasia 3, which consisted of changing one word.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment