-
Export Markers (Solved until Adobe provides something better)
I have written an AutoHotKey script to extract each marker’s time, name, and comment for each sequence in the Timeline and to place the results in the clipboard.
I do not understand why Adobe has not provided the capability to export markers and to have at least a dedicated marker window which lists the markers/regions (at least in, out, name, comment) and which highlights the active entry when the CTI is positioned over a marker or within a region. It would be nice if the marker data could be edited from within the marker/region list window rather than having to open the marker dialog box. As I move through the video I have to keep moving the CTI back to the marker and open the Marker dialog box in order to post comments. I am at the point in my process where I do not want to do subclips yet.
; Copies to Clipboard the marker time, name, and comments from all markers in all Premiere Timeline sequences.
; If the sequence is not in the Timeline, the marker data will not be copied.; Paste this script into a text file with the file extension .ahk (e.g., PremiereMarkers.ahk). Install free AutoHotKey from autohotkey.com. Windows only, not Mac.
; Start Premiere and load your project. Double-click on the .ahk file. Do not change the focus by interacting with other programs while the script is running.; Fragility:
; o Relies upon some standard keyboard shortcuts, but these are mainstream shortcuts rather than something obscure or likely to be changed.
; o Locates the Marker Name and Marker comment by their y position within the Marker dialog box.
; o Probably is language sensitive. The Marker dialog box is found by looking for "Marker @".
; o Tested with CS4. Other versions could have minor differences which may prevent the script from working as is.; I was unable to figure out how to extract the name of the sequence so the extracted data just shows Sequence0001, Sequence0002, etc.
; One way of documenting the sequence name is to manually create a marker at 00:00:00:00 with the sequence name in the Marker Name field.
; The script does not do anything special with the marker at 00:00:00:00.
; In addition to researching getting the sequence name from the Timeline, I also researched:
; o retrieve it by Alt+W, t, t, Enter, the there is no Edit control in the Window menu to retrieve the name,
; o retrieve it from the Project panel, but there is there no "Reveal in Project" command for sequences like there is for a clip.
; One possibility which I did not explore was copying the graphical image of the sequence name from the Timeline.; Perhaps this is not important, but I was also unable to figure out how to make the left-most sequence be Sequence0001.
; The numbering depends upon what was the last sequence selected in the Timeline before the script began executing. Sequence0001 will be sequence after sending a Shift+3 keysroke.
; So, if you want Sequence0001 to correspond to the left-most sequence, select the right-most sequence before running the script. The remaining sequences
; will be numbered in left-to-right order.; Be careful when making changes. When in doubt, throw in extra whitespace (e.g., WinExist(stringMarker) does not
; produce the same result as WinExist( stringMarker )). Sometimes capitalization is important (e.g., AND rather than and). The difference between = and :=
; is significant as is the way variables are referenced (variable vs. %variable%). None of these subtleties will generate a compiler error -- just a different result.#SingleInstance force ; Skips the dialog box and replaces the old instance of this script automatically
#NoEnv ; Recommended. Undefined variables (%xxxx%) do not cause a search of Environment variables.SetTitleMatchMode 1 ; Must start with
SetTitleMatchMode faststringMarker := "Marker @ " ; Beginning of title of the Marker dialog box. Used to find the dialog box.
if WinExist( stringMarker ) ; just in case the user left a marker dialog box open
WinCloseClipboard := "" ; so there's no risk of having left overs in Clipboard in case script does not complete successfully
if WinExist("ahk_class Premiere Pro")
{
WinActivate ; give focus to Premiere
Send +3 ; give focus to Timeline (Shift+3). If Timeline already has focus, focus will move to next sequence.
firstMarkerTitle := "" ; for determining when we're done
firstMarkerName := ""
firstMarkerComment := ""
countSequence = 1 ; for labeling sequences
stringClipboard := "" ; for accumulating the text which will be placed in Clipboard. The limit is 64KB (not tested).
doneWithAllSequences = 0
While ( doneWithAllSequences = 0 ) ; for each Sequence
{
Send {Home} ; move to beginning of Timeline
; The next two lines could be omitted. In the case when there is no marker at 00:00:00:00 but there are other markers, they avoid creating a marker then deleting it.
Send ^{Right} ; Ctrl+RightArrow - move to 1st Marker after 00:00:00:00, if there is one; otherwise, stay at 00:00:00.
Send ^{Left} ; Ctrl+LeftArrow - move to marker at 00:00:00:00 if it exists; otherwise stay at first marker after 00:00:00:00; if no markers, stay at 00:00:00:00.
priorMarkerTitle := "" ; for determining right-most marker in a sequence
doneWithThisSequence = 0
While ( doneWithThisSequence = 0 ) ; for each Marker
{
Send {NumpadMult} ; Num* to open marker dialog box. If no markers in Sequence, we will erroneusly create one at 00:00:00:00.
; If we erroneously create one, the dialog box will not be open and we will send Ctrl+0 to delete the marker.
waitForDialogBox = 0
iterations = 0
while ( waitForDialogBox <> 1 AND iterations < 5) ;max wait = 5 * 200ms = 1 second if WinExist( stringMarker ) waitForDialogBox = 1 else { sleep 200 iterations += 1 } if WinExist( stringMarker ) { WinGetTitle, markerTitle ;get Marker dialog box title ("Marker @ 00;00;00;00") WinGet, hwndControls, ControlListHwnd ;get hwnd's of all controls in Marker dialog box Loop, Parse, hwndControls, `n ;loop thru all of the controls of the Marker dialog box { WinGetClass, controlClass, ahk_id %A_LoopField% if ( controlClass = "Edit" ) { ControlGetPos ,x, y, controlWidth, controlHeight, ,ahk_id %A_LoopField% if ( y = 40 ) ; Name ControlGetText, markerName, , ahk_id %A_LoopField% else if ( y = 100 ) ; Comments ControlGetText, markerComment, , ahk_id %A_LoopField% } } WinClose ; Close the Marker dialog box. We'll WinWaitClose below to make sure that it's closed, but in the meantime let's do some processing... if ( markerTitle = firstMarkerTitle AND markerName = firstMarkerName AND markerComment = firstMarkerComment ) ; we've probably (not 100% sure) processed all sequences { doneWithAllSequences = 1 ; we've looped around back to the very first marker. Perform final actions and terminate. doneWithThisSequence = 1 } else { if ( firstMarkerTitle = "" ) ; prepare for detecting when we've processed all markers in all sequences { firstMarkerTitle := markerTitle firstMarkerName := markerName firstMarkerComment := markerComment } if ( markerTitle = priorMarkerTitle ) ; we're reprocessing the right-most marker of the sequence doneWithThisSequence = 1 ; move on to next Sequence else { priorMarkerTitle := markerTitle ; prepare for next iteration and determining when we've processed the right-most marker of a sequence ; Valid marker. Append sequence id, CTI, Name, & Comment to clipboard string. sequenceName := SubStr("000"countSequence, -3). markerTime := SubStr(markerTitle, 10, 11) ; extract CTI stringClipboard = %stringClipboard%Sequence%sequenceName%%A_Tab%%markerTime%%A_Tab%"%markerName%"%A_Tab%"%markerComment%"`r`n } } WinWaitClose ; wait for Marker dialog box to close } else { ; no markers in this sequence, but we just erroneously created one at 00:00:00:00 send ^0 ; delete the erroneously-created marker (Ctrl+0) doneWithThisSequence = 1 ; move on to next Sequence } Send ^{Right} ; Ctrl+RightArrow - move to next Marker } ; end While ( doneWithThisSequence = 0 ) Send +3 ; next Sequence (Shift+3) countSequence += 1 } ; end While ( doneWithAllSequences = 0 ) clipboard := stringClipboard MsgBox The list of markers has been placed in the Clipboard. Paste into spreadsheet, word processor, or database. The separator is a tab. } else MsgBox ,0,Error,Cannot locate Premiere window Exit