Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe Premiere Pro Export Markers (Solved until Adobe provides something better)

  • Export Markers (Solved until Adobe provides something better)

    Posted by Ed Elliott on March 31, 2010 at 11:14 am

    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 fast

    stringMarker := "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
    WinClose

    Clipboard := "" ; 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

    Manuel Sclavo replied 8 years, 1 month ago 13 Members · 42 Replies
  • 42 Replies
  • Ed Elliott

    April 3, 2010 at 4:07 pm

    Revised to handle double quotes (“) in Name or Comment. Converted to single quotes (‘). This prevents problems when pasting from the Clipboard into the spreadsheet.

    ; 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 fast

    stringMarker := "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
    WinClose

    Clipboard := "" ; 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% StringReplace, markerName, markerName, ", ', All ; replace double quotes with single quote } else if ( y = 100 ) ; Comments { ControlGetText, markerComment, , ahk_id %A_LoopField% StringReplace, markerComment, markerComment, ", ', All ; replace double quotes with single quote } } } 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

  • Wil Conklin

    July 7, 2010 at 12:01 pm

    Ed, have you made any updates to this?? This is brilliant. I don’t understand why Adobe has not added this functionality.

  • Ed Elliott

    July 8, 2010 at 12:58 am

    Wil,

    The original code remains unchanged to the best of my recollection.

    However, I needed to go the other direction from my spreadsheet with the time back to the sequence. So the following code let’s the user have the desired sequence active in Premiere, position the cursor in the desired spreadsheet cell containing the time, then press Winkey+Shift+T. The AutoHotKey code then positions Premiere’s CTI at the desired time. This code resides in an AHK file which loads when my system boots so it’s always available.

    #+t:: ; T for Time (Premiere)
    ; Purpose: Copy desired time, switch to Adobe Premiere and move the CTI to the desired time.
    ; 1. Quit any application which may be monitoring the clipboard or disable the application's monitoring
    ; of the clipboard. In my case it was the mediachance.com Multimon Task Bar.
    ; 2. Make sure Premiere focus is in Timeline, Program Monitor, or Reference Monitor for the desired sequence.
    ; 3. Switch to the spreadsheet and select the cell containing desired time. Then press Win+Shift+T.
    ; If the time is not in a spreadsheet cell, select the time text before pressing Win+Shift+T.
    ; The time will consist of all digits in the cell concatenated as if no other characters were in the cell.
    ; This functionality complements the Marker-export logic of the separate script PremiereMarkers.ahk.
    send ^c ; copy cell or text string to clipboard
    ClipWait ; wait for clipboard to contain data
    if WinExist("ahk_class Premiere Pro")
    {
    WinActivate ; give focus to Premiere
    sleep, 500
    send ^+a ; Ctrl+Shift+A to Deselect All so we don't move In points of all selected clips
    Loop, PARSE, Clipboard ; send Numpad characters rather than main keyboard numerics. Ignore non-numeric characters.
    {
    if ( A_LoopField = "0" )
    send {Numpad0}
    else if ( A_LoopField = "1" )
    send {Numpad1}
    else if ( A_LoopField = "2" )
    send {Numpad2}
    else if ( A_LoopField = "3" )
    send {Numpad3}
    else if ( A_LoopField = "4" )
    send {Numpad4}
    else if ( A_LoopField = "5" )
    send {Numpad5}
    else if ( A_LoopField = "6" )
    send {Numpad6}
    else if ( A_LoopField = "7" )
    send {Numpad7}
    else if ( A_LoopField = "8" )
    send {Numpad8}
    else if ( A_LoopField = "9" )
    send {Numpad9}
    }
    Send {NumpadEnter} ; complete entry of desired time
    }
    else MsgBox ,0,Error,Could not locate Premiere window. Therefore desired CTI time could not be entered. (AutoHotKey: Win+Shift+T)
    return

    Not to go off topic on my own thread but I found the following code also useful. This code resides in my boot-up AHK file. It makes small enhancements to three different standard Premiere keyboard shortcuts:

    Shift+1: Open the Project Panel AND POSITION THE CURSOR IN THE FIND FIELD.

    Shift+7: Open the Effects Panel AND POSITION THE CURSOR IN THE FIND FIELD.

    Numpad*: If the marker already exists, open the marker dialog box AND PLACE THE CURSOR IN THE NAME FIELD.

    ; ========================== Adobe Premiere Customizations ==============
    ; see also #+t in Windows Logo Key section
    #IfWinActive ahk_class Premiere Pro
    +1:: ; Shift+1 is standard shortcut for Project panel
    send +1 ; Activate Project panel
    send +f ; Shift+f is the standard shortcut to place cursor in Find box
    return
    +7:: ; Shift+7 is standard shortcut for Effects panel
    send +7 ; activate Effects panel
    send +f ; Shift+f is the standard shortcut to place cursor in Find box
    return
    NumpadMult:: ; Numpad * is the standard shortcut to set an unnumbered Marker or to open the Marker dialog box for an existing marker.
    ; When opening the Marker dialog box, this script places cursor in the Name field, rather than the default of leaving the OK button active.
    ; Tip: While cursor is in Name field, press Enter to close Marker dialog box.
    send {NumpadMult} ; Numpad * send Marker shortcut
    sleep, 100
    if WinExist( "Marker @ " ) ;if Marker dialog box opened rather than creating new marker
    {
    send {Tab} ; six {Tab} move to name field
    send {Tab}
    send {Tab}
    send {Tab}
    send {Tab}
    send {Tab}
    }
    return
    #IfWinActive ; end Adobe Premiere
    ; END END END ========================== Adobe Premiere Customizations ==============

  • Wil Conklin

    July 8, 2010 at 1:06 am

    I like the last one. Thanks for that. I muddled around a bit with your script and got it doing what I needed. I actually needed the timecode put into xml formated like so:

    <p begin="0:00:00:00" end="1:23:45.67"></p>

    After a bit of tinkering I got what I needed. So much better than doing it by hand. Especially with alot of cue points:)

    Thanks for your help!

  • Adam Shamoon

    January 24, 2011 at 9:26 pm

    This seems like a great script – would be the best solution I’ve found.
    Doesn’t seem to be picking up the marker names or comments though. Is it because I’m using CS5?

    Thanks.

  • Adam Shamoon

    January 24, 2011 at 9:28 pm

    This seems like a great script – would be the best solution I’ve found.
    Doesn’t seem to be picking up the marker names or comments though. Is it because I’m using CS5?

    Thanks.

  • Alex Power

    February 23, 2011 at 3:42 am

    I’m working with a team in Melbourne, and this script is exactly what we’re after.

    However, we’re having the same problem as Adam Shamoon (Titles and descriptions not exported properly), and we’re using CS5 also.

    This functionality is really important to us; if it will cost some money to have this script updated/adapted for CS5, then let us know. thanks so much for your work so far!

    Best,
    Alex

  • Ed Elliott

    February 23, 2011 at 8:42 am

    I do not have CS5 and do not feel like installing the CS5 trial and tweaking the AHK script. You could see if someone at the AutoHotKey forums is interested or someone on your team may be able to do it.

    Here are a some tips:

    o You need a Spy tool so that you can gather data about the Windows controls Premiere is using. The best Spy tool I have found is the AHK script from this forum https://www.autohotkey.com/forum/topic37645.html. I copied the script code to Notepad then saved it as “SpyBySmurth.ahk”. Double click that.ahk file, click the Control tab, then hover over the Premiere control of interest. If Adobe has not made significant changes between CS4 and CS5, the problem probably lies with the y positions of Name field (y=40 in CS4) and the Comments field (y=100 in CS4) in the Marker dialog box. To determine these values for CS5: with SpyBySmurth running and the Control tab active, make the Premiere timeline active, press * on the numeric keypad, hover the mouse over the Name entry field and check the Y value displayed by SpyBySmurth. Do the same for the Comments entry field. Change the values in my Export script to match the displayed values. Hopefully the answer is that simple.

    o Debugging in AHK is not very sophisticated. The most common technique is to include the following two lines before or after the suspect code:
    listvars
    pause

    o For each AHK script which is running, an H icon will appear in the Windows Notification Area (normally in the bottom right of the desktop). Right-clicking on the icon presents various actions. The The listvars command presented above essentially performs the Open action with the View = “Variables and their contents”. Another useful action is Pause Script — if you have paused a script either manually or programmatically (i.e., “pause” command), clicking the Pause Script action will continue execution of the script. The Help action leads to a very comprehensive help file with excellent search capabilities.

    Hope this helps. My apologies to Adam for not responding to his January query. If someone gets this working with CS5, I am sure others would appreciate the updated code being posted.

  • Adam Shamoon

    February 23, 2011 at 2:07 pm

    Hey Alex —

    Take a look at this. I used a combination of the two methods (here and the thread below). Tedious, but worked for both TC and comments.

    https://forums.creativecow.net/thread/3/886336

    Adam

  • Scott Nadeau

    April 5, 2011 at 6:46 pm

    I just tried to get the script to work in CS5 and all it did was delete the sequence markers on the current sequence and didn’t stop.

    When I deleted the two lines as suggested (in the script) and ran the new one, it copied the first marker, then the 00:00:00:00 marker and stopped.

    If I could get this to work it would save me a ton of work.

    I have to subtitle a video and need the time codes to use in a DVD subtitle script.

Page 1 of 5

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy