top of page
Writer's pictureTaylor Glad

ProTools Marker Import

Updated: Jun 15, 2023

Explanation


Export markers from ProTools to a text file, then import to QLab.

This script will have you select a text file, and ask you if you want to import the markers as new Start Cues or new Memo cues, or add slices to an existing audio or video cue. (To import as slices, an audio or video cue must be selected before running the script.)

Exporting Markers from ProTools

  1. In ProTools, Open the Memory Locations window (Ctrl + 5 on numberpad)

  2. In the top right corner, click on the downward triangle, select "Export markers as text...

  3. Out of the top 5 checkboxes, leave only "Include Markers" as checked

    • Leave File Format as TextEdit 'TEXT'

    • Time Format option is not important



 

Script


Copy the text below, and paste it into a script cue in your QLab workspace.

I recommend assigning it a hotkey, or I like to give each script cue a unique cue number using letters, and then trigger it from Bitfocus Companion.




--Import Markers from ProTools (as slices, memo cues start cues, load-to-time cues, or any combination)


--by Taylor Glad. Updated 8/18/21
--Script will prompt you for a txt file.
--select the txt file of exported markers from ProTools
--will detect if the txt file is invalid (if it doesn't start with "SESSION NAME:")
--it then looks for "Samples" in each row to account for plugins section sometimes appearing in the memos.

--This script prompts if you want to import new Start Cues or Memo cues, or add Slices.

set TheFile to choose file of type "txt" with prompt "Please select your exported text file from ProTools Markers"
set theFileContents to read TheFile
set thetids to AppleScript's text item delimiters
set AppleScript's text item delimiters to tab

set FirstItem to text item 1 of paragraph 1 of theFileContents

if FirstItem = "SESSION NAME:" then
	
	set thenumberofrows to (count of paragraphs of theFileContents) - 1
	
	--display dialog "Import ProTools Markers as new Start cues,  Memo cues, or as slices to selected audio/video cue?" with title "ProTools Markers" with icon 1 buttons {"Start Cues", "Memo Cues", "Slices"}
	--set userChoice to button returned of result
	
	set userChoice to choose from list {"Slices", "Memo Cues", "Start Cues", "Load to Time Cues", "Memo Cues and Slices", "Start Cues and Slices", "Load to Time Cues and Slices", "Memos, Loads and Slices", "Starts, Loads, and Slices", "All"} with title "ProTools Markers" with prompt "Convert markers to:" default items "Slices"
	
	--SLICES
	if (userChoice as string) contains "Slices" or (userChoice as string is "ALL") then
		tell application id "com.figure53.QLab.4" to tell front workspace
			
			set theSelection to the selected as list
			repeat with theCue in theSelection
				if (the q type of theCue is "Video") or (the q type of theCue is "Audio") then
					
					set theCueEndTime to the end time of theCue
					set sampleRate to text item 2 of paragraph 2 of theFileContents
					
					set theMarkers to {}
					repeat with rowCount from 13 to thenumberofrows --starts in 13 to skip the other pasted jargon
						set theRow to (paragraph rowCount) of theFileContents
						--check if text item 4 of theRow is "Samples" before running the following script
						try
							if text item 4 of theRow contains "Samples" then
								set rowIsGood to true
							else
								set rowIsGood to false
							end if
						on error
							set rowIsGood to false
						end try
						if rowIsGood then
							set theSliceTime to (text item 3 of theRow as string as real) / sampleRate
							if theSliceTime as real is greater than theCueEndTime as real then
								display dialog "One of the imported slices in your CSV is past the end time of your selected cue" with title "Incompatible Marker" with icon 2
								return
							end if
							
							set end of theMarkers to {time:theSliceTime, playCount:1}
						end if --rowIsGood
					end repeat --for eachLine
					set the slice markers of theCue to theMarkers
					
				else --theCue is an Audio or Video cue
					display dialog "Please select an audio or video cue before running this script." with title "Select Audio or Video Cue" with icon 2
				end if --theCue is an Audio or Video cue
				
			end repeat --of the selected cues
		end tell
	end if --Contains "Slices"
	
	--MEMO CUES
	if (userChoice as string) contains "Memo" or (userChoice as string is "ALL") then
		set newCueGroupName to text item 2 of paragraph 1 of theFileContents & " Marker Import"
		set sampleRate to text item 2 of paragraph 2 of theFileContents
		
		tell application id "com.figure53.QLab.4" to tell front workspace
			
			try
				set current cue list to last cue list whose q name is newCueGroupName
			on error
				make type "cue list"
				set q name of last cue list to newCueGroupName
				set current cue list to last cue list whose q name is newCueGroupName
			end try
			
			repeat with makeCues from 13 to thenumberofrows
				set theRow to (paragraph makeCues) of theFileContents
				--check if text item 4 of theRow is "Samples" before running the following script
				try
					if text item 4 of theRow contains "Samples" then
						set rowIsGood to true
					else
						set rowIsGood to false
					end if
				on error
					set rowIsGood to false
				end try
				if rowIsGood then
					
					make type "memo"
					set theCue to last item of (selected as list)
					set the pre wait of theCue to (text item 3 of theRow as string as real) / sampleRate
					set the q name of theCue to text item 5 of theRow
				end if --rowIsGood
			end repeat
		end tell
	end if --Contains "Memo"
	
	--START CUES
	if (userChoice as string) contains "Start" or (userChoice as string is "ALL") then
		
		set newCueGroupName to text item 2 of paragraph 1 of theFileContents & " Marker Import"
		set sampleRate to text item 2 of paragraph 2 of theFileContents
		
		tell application id "com.figure53.QLab.4" to tell front workspace
			
			try
				set current cue list to last cue list whose q name is newCueGroupName
			on error
				make type "cue list"
				set q name of last cue list to newCueGroupName
				set current cue list to last cue list whose q name is newCueGroupName
			end try
			
			repeat with makeCues from 13 to thenumberofrows
				set theRow to (paragraph makeCues) of theFileContents
				--check if text item 4 of theRow is "Samples" before running the following script
				try
					if text item 4 of theRow contains "Samples" then
						set rowIsGood to true
					else
						set rowIsGood to false
					end if
				on error
					set rowIsGood to false
				end try
				if rowIsGood then
					
					make type "start"
					set theCue to last item of (selected as list)
					set the pre wait of theCue to (text item 3 of theRow as string as real) / sampleRate
					set the q name of theCue to text item 5 of theRow
				end if --rowIsGood
			end repeat
		end tell
	end if -- Contains "Start"
	
	
	--Load CUES
	if (userChoice as string) contains "Load" or (userChoice as string is "ALL") then
		
		
		set newCueGroupName to text item 2 of paragraph 1 of theFileContents & " Marker Import"
		set sampleRate to text item 2 of paragraph 2 of theFileContents
		
		tell application id "com.figure53.QLab.4" to tell front workspace
			set theSelection to first item of (selected as list)
			try
				set current cue list to last cue list whose q name is newCueGroupName
			on error
				make type "cue list"
				set q name of last cue list to newCueGroupName
				set current cue list to last cue list whose q name is newCueGroupName
			end try
			
			repeat with makeCues from 13 to thenumberofrows
				set theRow to (paragraph makeCues) of theFileContents
				--check if text item 4 of theRow is "Samples" before running the following script
				try
					if text item 4 of theRow contains "Samples" then
						set rowIsGood to true
					else
						set rowIsGood to false
					end if
				on error
					set rowIsGood to false
				end try
				if rowIsGood then
					
					make type "load"
					set theCue to last item of (selected as list)
					set the load time of theCue to (text item 3 of theRow as string as real) / sampleRate
					set the q name of theCue to text item 5 of theRow
					if (the q type of theSelection is "Video") or the q type of theSelection is "Audio" then
						set the cue target of theCue to theSelection
					end if
				end if --rowIsGood
			end repeat
		end tell
	end if
	
	
else --if the txt file is NOT a valid export file from ProTools (Just checking that the first part is "SESSION NAME:")
	display dialog "INVALID TXT FILE" with icon 2
end if --the txt file is a valid export file from ProTools (Just checking that the first part is "SESSION NAME:")
set AppleScript's text item delimiters to thetids

194 views0 comments

Recent Posts

See All

Comments


bottom of page