Nicks ProTools-Skripte
AppDelegate
--
-- AppDelegate.applescript
-- macNDR Tool
--
-- Created by Jan- Niklas Würpel on 21.03.19.
-- Copyright © 2019 Jan- Niklas Würpel. All rights reserved.
--
script AppDelegate
property parent : class "NSObject"
-- IBOutlets
property theWindow : missing value
property BenutzerName : missing value
property TagesordnerUserPath : missing value
property PfadBiDOrdner : missing value
property ordnerName : missing value
property MXFFilename : missing value
property MXFExportName : missing value
property MXFFile : missing value
property checkCreateSession : missing value
property buttonVS : missing value
property buttonPT : missing value
property buttonState : missing value
-- Delay Zeiten
property shortDelay : 0.1
property medDelay : 0.3
property longDelay : 1.0
set exportfolder to "/Users/nickwuerpel/Movies/Export/"
on buttonState:sender
end buttonState:
on LaunchProTools:sender
tell application "Pro Tools"
activate
end tell
end LaunchProTools:
on LaunchVideoSlave:sender
-- tell app "Video Slave"
-- activate
-- end tell
end LaunchVideoSlave:
-- Button MXF importieren
on ImportMXF:sender
set destinationFolder to ((path to movies folder as text) & "Tagesordner:")
set MXFFile to choose file with prompt "Bitte MXF Datei zum Import auswählen." of type {"mxf"}
tell application "Finder"
set MXFFilename to name of file (MXFFile as string)
set MXFBiD to characters 1 thru 6 of MXFFilename as string
make new folder in PfadBiDOrdner with properties {name:MXFBiD}
end tell
MXFExportName's setStringValue:MXFFilename
set MXFFilePOSIX to quoted form of the POSIX path of MXFFile
-- tell application "Finder" to set MFXPathPOSIX to POSIX path of ((container of MFXFile) as text)
set destinationFolder to destinationFolder & ordnerName & ":" & MXFBiD & ":"
set destinationFolderPOSIX to the POSIX path of destinationFolder
set MXFPathPOSIX to quoted form of the destinationFolderPOSIX
tell application "Terminal"
-- activate
do shell script "/usr/local/Cellar/ffmpeg/4.1/bin/ffmpeg -i " & MXFFilePOSIX & " -map 0:a:0 -c copy " & MXFPathPOSIX & "a1.wav -map 0:a:1 -c copy " & MXFPathPOSIX & "a2.wav -map 0:a:2 -c copy " & MXFPathPOSIX & "a3.wav -map 0:a:3 -c copy " & MXFPathPOSIX & "a4.wav -map 0:a:4 -c copy " & MXFPathPOSIX & "a5.wav -map 0:a:5 -c copy " & MXFPathPOSIX & "a6.wav -map 0:a:6 -c copy " & MXFPathPOSIX & "a7.wav -map 0:a:7 -c copy " & MXFPathPOSIX & "a8.wav"
end tell
activate application "Pro Tools"
tell application "System Events"
tell process "Pro Tools"
-- Open "Import/Audio..." from the File menu
click menu item "Audio..." of menu 1 of menu item "Import" of menu 1 of menu bar item "File" of menu bar 1
repeat until exists window "Öffnen"
delay shortDelay
end repeat
keystroke "g" using {command down, shift down} -- Opens "Go to Folder…" sheet
tell window "Öffnen"
repeat until exists sheet 1
delay medDelay
end repeat
tell sheet 1
set value of combo box 1 to destinationFolderPOSIX -- The path to go to in order to save the file
click button 1 -- Go button
end tell
repeat while exists sheet 1
delay medDelay
end repeat
keystroke "a" using {command down}
click button 7
delay medDelay
click button 13
repeat while exists sheet 1
delay medDelay
end repeat
end tell
tell window "Audio Import Options"
keystroke "t" using {command down}
-- set value of combo box 1 to 1
-- set theValue to contents of combo box 1 -- of window "main"
click button 1
end tell
tell window "Spot Dialog"
delay 0.5
keystroke "10000000"
click button 2
end tell
(* repeat until exists window "Öffnen"
delay shortDelay
end repeat *)
end tell
end tell
tell application "Finder" to set MXFPathPOSIX to POSIX path of ((container of MXFFile) as text)
set the clipboard to MXFPathPOSIX
(* delay medDelay
activate application "Video Slave"
tell application "System Events"
tell process "Video Slave"
keystroke "o" using {command down, shift down}
keystroke "g" using {command down, shift down}
delay medDelay
keystroke "v" using {command down}
delay medDelay
key code 36
delay longDelay
set tasten to name of MFXFile
keystroke tasten
delay medDelay
key code 36
delay longDelay
keystroke "l" using {command down}
end tell
end tell*)
end ImportMXF:
-- button MXF exportieren
on ExportMXF:sender
-- set PfadBenutzerOrdner to ((path to movies folder as text) & "Tagesordner:3April2019-ASi_Askan Siegfried")
set PfadBenutzerOrdner to ((path to movies folder as text) & "Tagesordner:" & ordnerName)
-- tell application "Finder" to display Dialog PfadBenutzerOrdner
-- tell application "Finder" to display Dialog PfadBiDOrdner
-- set PfadBiDOrdnerPOSIX to quoted form of POSIX path of PfadBiDOrdner
-- set PfadBenutzerOrdner to PfadBiDOrdner
tell application "Finder" to make new folder in PfadBenutzerOrdner with properties {name:"Temp"}
set stemFolder to PfadBenutzerOrdner & ":Temp:"
set PfadBenutzerOrdnerPOSIX to quoted form of the POSIX path of (PfadBenutzerOrdner & ":")
set stemFolderPOSIX to the POSIX path of stemFolder
tell application "Pro Tools"
activate
tell application "System Events"
tell process "Pro Tools"
-- keystroke "3" using {option down, shift down}
-- delay 0.3
keystroke "k" using {command down, shift down}
repeat until exists window "Export Selected"
end repeat
tell button "Choose..." of window "Export Selected" to perform action "AXPress"
repeat until exists window "Öffnen"
end repeat
keystroke "g" using {command down, shift down}
tell window "Öffnen"
repeat until exists sheet 1
end repeat
tell sheet 1
set value of combo box 1 to stemFolderPOSIX -- The path to go to in order to save the file
delay longDelay
-- tell button "Öffnen" of window "Öffnen" to perform action "AXPress"
click button 1 -- Go button
key code 36
end tell
end tell
repeat until exists window "Export Selected"
end repeat
tell button "Export..." of window "Export Selected" to perform action "AXPress"
(* tell front window of (first application process whose frontmost is true)
set uiElems to entire contents
end tell *)
end tell
end tell
end tell
tell application "Finder"
activate
(*set destinationFolder to ((path to movies folder as text) & "Export:")
set destinationFolderPOSIX to POSIX path of destinationFolder*)
-- set MXFFileMUX to choose file with prompt "Bitte MXF Datei zum muxen auswählen." of type {"mxf"}
-- set MXFExportFile to (name of MXFFileMUX)
-- display Dialog MXFFileMUX
-- display Dialog MXFFile
set MXFFileMUX to MXFFile
set MXFExportFile to MXFFilename
-- tell application "Finder" to display dialog MFXFilePOSIX
set MXFFileMUXPOSIX to quoted form of POSIX path of MXFFileMUX
-- set MFXPathPOSIX to stemFolderPOSIX
-- display dialog destinationFolderPOSIX
set OrdnerInhalt to (every file of folder stemFolder whose name extension is "wav")
set muxDatei1 to (item 1 of OrdnerInhalt) as string
set muxDatei1POSIX to quoted form of POSIX path of muxDatei1
set muxDatei2 to (item 2 of OrdnerInhalt) as string
set muxDatei2POSIX to quoted form of POSIX path of muxDatei2
set muxDatei3 to (item 3 of OrdnerInhalt) as string
set muxDatei3POSIX to quoted form of POSIX path of muxDatei3
set muxDatei4 to (item 4 of OrdnerInhalt) as string
set muxDatei4POSIX to quoted form of POSIX path of muxDatei4
set muxDatei5 to (item 5 of OrdnerInhalt) as string
set muxDatei5POSIX to quoted form of POSIX path of muxDatei5
set muxDatei6 to (item 6 of OrdnerInhalt) as string
set muxDatei6POSIX to quoted form of POSIX path of muxDatei6
set muxDatei7 to (item 7 of OrdnerInhalt) as string
set muxDatei7POSIX to quoted form of POSIX path of muxDatei7
set muxDatei8 to (item 8 of OrdnerInhalt) as string
set muxDatei8POSIX to quoted form of POSIX path of muxDatei8
end tell
tell application "Terminal"
activate
do shell script "/usr/local/Cellar/ffmpeg/4.1/bin/ffmpeg -i " & MXFFileMUXPOSIX & " -i " & muxDatei1POSIX & " -i " & muxDatei2POSIX & " -i " & muxDatei3POSIX & " -i " & muxDatei4POSIX & " -i " & muxDatei5POSIX & " -i " & muxDatei6POSIX & " -i " & muxDatei7POSIX & " -i " & muxDatei8POSIX & " -map 0:0 -map 1:0 -map 2:0 -map 3:0 -map 4:0 -c:v copy -c:a copy " & PfadBenutzerOrdnerPOSIX & MXFExportFile
tell application "Finder" to display dialog stemFolderPOSIX
do shell script "rm -R " & stemFolderPOSIX
end tell
(* set PfadBiDOrdner to ((path to movies folder as text) & "Tagesordner:31März2019-NWu_Nick Wuerpel:")
tell application "Finder" to make new folder in PfadBiDOrdner with properties {name:"Temp"}
tell application "Pro Tools"
activate
tell application "System Events"
tell process "Pro Tools"
keystroke "3" using {option down, shift down}
keystroke "k" using {command down, shift down}
repeat until exists window "Export Selected"
end repeat
tell button "Choose..." of window "Export Selected" to perform action "AXPress"
repeat until exists window "Öffnen"
end repeat
keystroke "g" using {command down, shift down}
tell window "Öffnen"
repeat until exists sheet 1
delay medDelay
end repeat
tell sheet 1
set value of combo box 1 to exportfolder -- The path to go to in order to save the file
click button 1 -- Go button
delay medDelay
key code 36
end tell
end tell
(* tell front window of (first application process whose frontmost is true)
set uiElems to entire contents
end tell *)
*)
(*) end tell
end tell
end tell*)
end ExportMXF:
-- button Tagesordner erstellen
on Tagesordnererstellen:sender
set tagesordnerPfad to (path to home folder as string) & "Filme:Tagesordner"
set tagesordnerPfadPOSIX to POSIX path of tagesordnerPfad
-- & "Library/Filme/Tagesordner/"
set ordnerName to choose from list {"NWu_Nick Wuerpel", "ABr_Andre Brickwedde", "HSt_Heiko Stoevesand", "FWe_Felix Wenzel", "ASi_Askan Siegfried", "SGo_Sven-Eric Goda", "MWa_Michel Wähling"} with title "Tagesordner anlegen" with prompt "Bitte Benutzer auswählen:"
set meinDatum to (current date) as string
set meinDatum to words 2 thru 4 of meinDatum as string
set ordnerName to meinDatum & "-" & ordnerName
set PfadBiDOrdner to (tagesordnerPfad & ":" & ordnerName)
tell application "Finder"
if (PfadBiDOrdner exists) then
display dialog ordnerName & " existiert bereits" buttons {"Ok"} default button 1
else
make new folder in tagesordnerPfad with properties {name:ordnerName}
BenutzerName's setStringValue:ordnerName
TagesordnerUserPath's setStringValue:tagesordnerPfadPOSIX
end if
end tell
end Tagesordnererstellen:
on updateTCInfo(MXFlocal)
end updateTCInfo
on applicationWillFinishLaunching:aNotification
-- Insert code here to initialize your application before any files are opened
end applicationWillFinishLaunching:
on applicationShouldTerminate:sender
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate:
end script
AppDelegateSAVE
--
-- AppDelegate.applescript
-- macNDR Tool
--
-- Created by Jan- Niklas Würpel on 21.03.19.
-- Copyright © 2019 Jan- Niklas Würpel. All rights reserved.
--
script AppDelegate
property parent : class "NSObject"
-- IBOutlets
property theWindow : missing value
property BenutzerName : missing value
property TagesordnerUserPath : missing value
property PfadBiDOrdner : missing value
property ordnerName : missing value
property MXFFilename : missing value
property MXFExportName : missing value
property MXFFile : missing value
property checkCreateSession : missing value
property RadioButtonVideo : missing value
property startTcField : missing value
property endTcField : missing value
property currentValue : 0.0 -- aktueller Wert Progress Bar
property maxValue : 40.0 -- maximaler Wert Progress Bar
property popSourceMXF : missing value
property buttonExportDatei : missing value
property buttonExportVPN3 : missing value
-- IBOutlets VPN3 CheckIn Window
property vpn3CheckInWindow : missing value
property fieldBiD : missing value
property fieldBeitragstitel : missing value
property fieldMateriatitel : missing value
property fieldAutorName : missing value
property fieldAutorNachname : missing value
property fieldAutorEmail : missing value
property fieldRegion : missing value
property fieldState : missing value
property fieldErstsendedatum : missing value
property fieldComputer : missing value
property checkFreigabe : missing value
property checkFarbkorrigiert : missing value
property checkGeprueft : missing value
property loudness : missing value
property range : missing value
property fieldBearbeiter : missing value
global varItemToImport
-- Pfade
-- property path2ffmpeg : "/usr/local/Cellar/ffmpeg/4.1/bin/" -- Nicks Laptop
-- property tagesordnerPfad : ((path to movies folder as text) & "Tagesordner:")
property destinationMXF : ((path to movies folder as text) & "Export:")
-- property path2SchnittFertig : "/Users/nickwuerpel/Movies/MXFMediacenter/" -- Probe Pfad auf dem Laptop
property path2SchnittFertig : "/Volumes/hhlokvpn/Ue_Schnitt_Ton/schnitt_fertig_em/"
property cliclickCLIPath : "/usr/local/bin/cliclick"
property linkMediaPortal : "http://shkieweb02.sh.ads.ndr-net.de/webconnect/media.php"
property path2ffmpeg : "/usr/local/Cellar/ffmpeg/4.1.3_1/bin/" -- NDR
property tagesordnerPfad : "ddpvolume:Temp:ProTools:Tagesordner:" -- ddp Laufwerk NDR
-- property destinationMXF : "Volumes:MediaGrid:omfs:hhlokvpn:Produktion:Schnitt:DAW_Test:Export:"
-- Delay Zeiten
property shortDelay : 0.1
property medDelay : 0.3
property longDelay : 1.0
on CheckIn:sender
-- textField's setStringValue_("Moin")
tell vpn3CheckInWindow to makeKeyAndOrderFront:me
initMetadata()
-- set whatever to textField's stringValue() as text
end CheckIn:
on buttonCheckInVPN3:sender
-- tell application "System Events" to keystroke "w" using command down
tell application "System Events"
-- tell process "Finder"
click button 1 of window 1
-- end tell
end tell
end buttonCheckInVPN3:
on selectVPNVersion:sender
end selectVPNVersion:
on selectImportSource:sender
end selectImportSource:
on LaunchProTools:sender
tell application "Pro Tools"
activate
end tell
end LaunchProTools:
on launchMediaCenter:sender
-- tell application "Firefox" to activate
end launchMediaCenter:
-- Button MXF importieren
on ImportMXF:sender
if ordnerName = "blank" then
display dialog "Bitte lege erst einen Tagesordner an" buttons ("OK") default button 1
else
set sessionExists to false
set indexVPNpopUp to ((popSourceMXF's indexOfSelectedItem()) as string)
if indexVPNpopUp = "0" then
set vpn2file to the clipboard
set vpn2file to do shell script "basename " & quoted form of vpn2file
if vpn2file contains "_" then
set MXFFile to path2SchnittFertig & vpn2file
set MXFFilename to vpn2file
set MXFBiD to characters 1 thru 6 of MXFFilename as string
else
display dialog "Kein gültiger Filename"
end if
fieldBiD's setStringValue:MXFBiD
fieldBeitragstitel's setStringValue:vpn2file
fieldMateriatitel's setStringValue:vpn2file
fieldComputer's setStringValue:(computer name of (system info))
fieldBearbeiter's setStringValue:(long user name of (system info))
fieldAutorEmail's setStringValue:"j.wuerpel@ndr.de"
end if
if indexVPNpopUp = "1" then
set the clipboard to "leer"
set importVPN3ItemID to "leer"
set importVPN3ItemIDCheck to false
tell application "Google Chrome"
open location linkMediaPortal
end tell
repeat until (importVPN3ItemIDCheck = true)
if importVPN3ItemID contains "-" then
set importVPN3ItemIDCheck to true
end if
try
set importVPN3ItemID to (the clipboard)
on error
display dialog "Import Timeout."
end try
delay 0.1
end repeat
tell application "System Events"
set visible of application process "Google Chrome" to false
end tell
display dialog "Soll Item-ID " & importVPN3ItemID & " importiert werden?"
-- set xx to getVPN3XML()
set varItemToImport to importVPN3ItemID
set MXFFile to getVPN3XML()
initMetadata()
set MXFBiD to fieldBiD's stringValue() as text
set MXFFilename to do shell script "basename " & quoted form of MXFFile
end if
if indexVPNpopUp = "2" then
set MXFFile to choose file with prompt "Bitte MXF Datei zum Import auswählen." of type {"mxf"}
tell application "Finder"
set MXFFilename to name of file (MXFFile as string)
set MXFBiD to characters 1 thru 6 of MXFFilename as string
fieldBiD's setStringValue:MXFBiD
fieldBeitragstitel's setStringValue:MXFFilename
fieldMateriatitel's setStringValue:MXFFilename
fieldComputer's setStringValue:(computer name of (system info))
fieldBearbeiter's setStringValue:(long user name of (system info))
fieldAutorEmail's setStringValue:"j.wuerpel@ndr.de"
end tell
end if
MXFExportName's setStringValue:MXFFilename
-- checkPTrunning()
--if result is false then
-- display dialog "Pro Tools ist nicht geöffnet" buttons ("OK") default button 1
-- else
if (state of checkCreateSession as string) = "1" then
set sessionExists to true
createSession(MXFBiD, PfadBiDOrdner)
end if
-- updateTCInfo(MXFFile)
tell application "System Events"
tell process "Pro Tools"
if exists (1st window whose title contains "Edit: ") then
set sessionExists to true
end if
end tell
end tell
if sessionExists is true then
-- createSession(MXFBiD,PfadBiDOrdner)
-- display dialog "Session wurde erstellt"
set startTC to getStartTC()
set startTC to "10000000"
copyMXF2local((MXFFile as string), PfadBiDOrdner, MXFFilename, MXFBiD)
importVideo2PT(PfadBiDOrdner, MXFBiD, startTC)
importAudio2PT(PfadBiDOrdner, MXFBiD, startTC)
else
display dialog "Es ist keine Session geöffnet. Bitte die Option <<Erstelle Session beim Import>> wählen" buttons ("OK") default button 1
end if
end if
end ImportMXF:
--***************************************************
-- button MXF exportieren
--**************************************************
on ExportMXF:sender
set startTCNum to "10000000"
-- set startTCNum to getStartTC()
set durationTCNum to getLengthOfMXF(MXFFile as string)
selectTracks2Export(startTCNum, durationTCNum)
bounceTracks(PfadBiDOrdner)
stems2MXF(PfadBiDOrdner, MXFFilename)
-- stems2MXF("Moin","Moin")
end ExportMXF:
-- ********************************************
-- button Tagesordner erstellen
-- ********************************************
on Tagesordnererstellen:sender
-- set tagesordnerPfad to ((path to movies folder as text) & "Tagesordner:")
set tagesordnerPfadPOSIX to POSIX path of tagesordnerPfad
-- & "Library/Filme/Tagesordner/"
set ordnerName to choose from list {"NWu_Nick Wuerpel", "ABr_Andre Brickwedde", "HSt_Heiko Stoevesand", "FWe_Felix Wenzel", "ASi_Askan Siegfried", "SGo_Sven-Eric Goda", "MWa_Michel Wähling", "CBe_Cornelius Behrens", "RHi_Regina Hinz", "UAr_Ulla Ahrens", "CFi_Christoph Finn"} with title "Tagesordner anlegen" with prompt "Bitte Benutzer auswählen:"
set ordnerName to (words 2 thru 4 of ((current date) as string) as string) & "-" & ordnerName
set PfadBiDOrdner to (tagesordnerPfad & ordnerName)
tell application "Finder"
if (PfadBiDOrdner exists) then
display dialog ordnerName & " existiert bereits. Soll zu diesem Ordner gewechselt werden?" buttons {"Ok"} default button 1
else
make new folder in tagesordnerPfad with properties {name:ordnerName}
make new folder at PfadBiDOrdner with properties {name:"mxf_video"}
end if
end tell
BenutzerName's setStringValue:ordnerName
TagesordnerUserPath's setStringValue:tagesordnerPfadPOSIX
end Tagesordnererstellen:
on changeExportMXF:sender
set MXFFile to choose file with prompt "Bitte MXF Datei zum Import auswählen." of type {"mxf"}
tell application "Finder"
set MXFFilename to name of file (MXFFile as string)
set MXFBiD to characters 1 thru 6 of MXFFilename as string
end tell
MXFExportName's setStringValue:MXFFilename
end changeExportMXF:
on applicationWillFinishLaunching:aNotification
set ordnerName to "blankxx"
-- Insert code here to initialize your application before any files are opened
end applicationWillFinishLaunching:
on applicationShouldTerminate:sender
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate:
on zeigeDialog()
display dialog "Session wurde erstellt"
end zeigeDialog
-- *********************************************************
-- leere Pro Tools Session nach Vorlage erstellen
-- *********************************************************
on createSession(SessionName, SessionPfad)
set vorlage_gefunden to false
set vorlagenPfad to POSIX path of ((path to movies folder as text) & "NDR_Vorlagen:")
set aktuelleVorlage to "NDR_blank.ptxt"
set SessionPfadPOSIX to POSIX path of (SessionPfad)
set the clipboard to SessionName
try
set openVorlage to "open " & quoted form of (vorlagenPfad & aktuelleVorlage)
do shell script openVorlage
set vorlage_gefunden to true
on error
set vorlage_gefunden to false
display dialog "Vorlage wurde nicht gefunden" with icon caution buttons {"OK"} default button 1
end try
if vorlage_gefunden = true then
tell application "System Events"
tell process "Pro Tools"
repeat until exists window "Dashboard"
delay 0.1
end repeat
delay medDelay
keystroke "v" using {command down}
tell window "Dashboard"
click button 1
-- tell button 1 to perform action "AXPress"
end tell
delay medDelay
set the clipboard to SessionPfadPOSIX
keystroke "g" using {command down, shift down}
delay medDelay
keystroke "v" using {command down}
delay medDelay
key code 36
delay medDelay
tell window "Öffnen" to click button 3
delay medDelay
tell window "Dashboard"
tell button 3 to perform action "AXPress"
end tell
tell application "Finder"
set Session_angelegt to false
repeat until Session_angelegt = true
if (SessionPfad & ":" & SessionName exists) then
set Session_angelegt to true
else
set Session_angelegt to false
end if
end repeat
make new folder at SessionPfad & ":" & SessionName with properties {name:"mxf_audio"}
end tell
end tell
end tell
end if
end createSession
on copyMXF2local(SourceCopy, DestinationCopy, MXFlocal, BidLocal)
set DestinationCopyPOSIX to quoted form of POSIX path of (DestinationCopy & ":mxf_video:")
set SourceCopyPOSIX to quoted form of (POSIX path of SourceCopy)
set unwrapFilePOSIX to quoted form of POSIX path of (DestinationCopy & ":mxf_video:" & MXFlocal)
set unwrapPathPOSIX to quoted form of POSIX path of (DestinationCopy & ":" & BidLocal & ":mxf_audio:")
set iconPath to (path to pictures folder as text) & "macNDR_Bilder:Antje512.icns"
tell application "SKProgressBar"
activate
---------------------------------------------------
-- SETUP WINDOW THAT CONTAINS ALL PROGRESS BARS --
---------------------------------------------------
set title to "macNDR Tool" --> default is "SKProgressBar"
set floating to false --> default is true
set position to {1200, 900} --> default is {1000, 750}, origin point is bottom left
set width to 400.0 --> default is 500.0
---------------------------------------------------
-- SETUP MAIN PROGRESS BAR --
-- (progress bar 1 by definition)
---------------------------------------------------
-- It already exists, so no need to create
tell main bar --main bar
set minimum value to 0.0 --> default is 0.0
set maximum value to maxValue --> default is 100.0
set current value to currentValue --> default is 0.0
-- header / footer properties
set header to "Copy MXF File..." --> default is empty string
set header alignment to center --> default is left
set header size to regular --> default is small
set footer to MXFlocal --> default is empty string
set footer alignment to center --> default is left
set footer size to small --> default is small
-- image path can be HFS or POSIX path, default is missing value (no image)
set image path to iconPath
end tell
---------------------------------------------------
-- DISPLAY/ACTIVATE THE PROGRESS BARS --
---------------------------------------------------
-- This will show one window will all progress bars
set show window to true --> default is false
tell main bar
set indeterminate to false
start animation
end tell
-- my resetMainBar()
-- tell application "SKProgressBar"
tell main bar
set maximum value to maxValue
set current value to currentValue
end tell
-- end tell
set pid1 to do shell script " cp " & SourceCopyPOSIX & " " & DestinationCopyPOSIX & " &> /dev/null & echo $!"
-- set pid1 to do shell script " cp ""ed form of posix path of SourceCopy&" /Users/nickwuerpel/Movies/Tagesordner/ &> /dev/null & echo $!"
set isRunning to true
repeat until isRunning = false
tell main bar to increment by 1
try
do shell script "kill -0 " & pid1
set isRunning to true
on error
set isRunning to false
end try
delay 2
end repeat
tell main bar to set header to "Unwrap MXF File..."
tell application "Finder"
if not ((DestinationCopy & ":" & BidLocal & ":mxf_audio") exists) then
make new folder at DestinationCopy with properties {name:BidLocal}
make new folder at DestinationCopy & ":" & BidLocal with properties {name:"mxf_audio"}
end if
end tell
set pid2 to do shell script path2ffmpeg & "ffmpeg -i " & unwrapFilePOSIX & " -map 0:a:0 -c copy " & unwrapPathPOSIX & "a1.wav -map 0:a:1 -c copy " & unwrapPathPOSIX & "a2.wav -map 0:a:2 -c copy " & unwrapPathPOSIX & "a3.wav -map 0:a:3 -c copy " & unwrapPathPOSIX & "a4.wav -map 0:a:4 -c copy " & unwrapPathPOSIX & "a5.wav -map 0:a:5 -c copy " & unwrapPathPOSIX & "a6.wav -map 0:a:6 -c copy " & unwrapPathPOSIX & "a7.wav -map 0:a:7 -c copy " & unwrapPathPOSIX & "a8.wav &> /dev/null & echo $!"
-- set pid2 to do shell script "/usr/local/Cellar/ffmpeg/4.1/bin/ffmpeg -i " & unwrapFilePOSIX & " -map 0:a:0 -c copy " & unwrapPathPOSIX & "a1.wav -map 0:a:1 -c copy " & unwrapPathPOSIX & "a2.wav -map 0:a:2 -c copy " & unwrapPathPOSIX & "a3.wav -map 0:a:3 -c copy " & unwrapPathPOSIX & "a4.wav -map 0:a:4 -c copy " & unwrapPathPOSIX & "a5.wav -map 0:a:5 -c copy " & unwrapPathPOSIX & "a6.wav -map 0:a:6 -c copy " & unwrapPathPOSIX & "a7.wav -map 0:a:7 -c copy " & unwrapPathPOSIX & "a8.wav &> /dev/null & echo $!"
set isRunning to true
repeat until isRunning = false
tell main bar to increment by 1
try
do shell script "kill -0 " & pid2
set isRunning to true
on error
set isRunning to false
end try
delay 2
end repeat
tell main bar to stop animation
quit
end tell
end copyMXF2local
on importAudio2PT(currentTagesordner, MXFlocal, tempTC)
set importPathAudio to POSIX path of (currentTagesordner & ":" & MXFlocal & ":mxf_audio")
activate application "Pro Tools"
tell application "System Events"
tell process "Pro Tools"
-- Open "Import/Audio..." from the File menu
click menu item "Audio..." of menu 1 of menu item "Import" of menu 1 of menu bar item "File" of menu bar 1
repeat until exists window "Öffnen"
delay shortDelay
end repeat
keystroke "g" using {command down, shift down} -- Opens "Go to Folder…" sheet
tell window "Öffnen"
repeat until exists sheet 1
delay medDelay
end repeat
tell sheet 1
set value of combo box 1 to importPathAudio
click button 1 -- Go button
end tell
repeat while exists sheet 1
delay medDelay
end repeat
keystroke "a" using {command down}
click button 7
delay medDelay
click button 13
repeat while exists sheet 1
delay medDelay
end repeat
end tell
repeat until exists window "Audio Import Options"
delay 0.1
end repeat
tell window "Audio Import Options"
if value of radio button "New Track <Command> 'T'" = 0 then
click radio button "New Track <Command> 'T'"
delay 0.2
end if
if value of pop up button 1 is not "Spot" then
tell pop up button 1 to perform action "AXPress"
keystroke "sp"
key code 36
delay 0.2
end if
delay 0.2
click button 1
end tell
repeat until exists window "Spot Dialog"
delay 0.2
end repeat
tell window "Spot Dialog"
if value of pop up button 1 is not "Timecode" then
click pop up button 1
keystroke "ti"
key code 36
delay 0.2
tell text field 1 to perform action "AXPress"
end if
-- set value of text field 1 to "10:00:00:00"
delay 0.2
keystroke tempTC
click button 2
end tell
(* repeat until exists window "Öffnen"
delay shortDelay
end repeat *)
end tell
end tell
end importAudio2PT
on importVideo2VS(currentTagesordner, BidLocal)
set clipboardPath to (currentTagesordner & ":mxf_video")
set clipboardPathPOSIX to POSIX path of clipboardPath
set the clipboard to clipboardPathPOSIX
delay medDelay
activate application "Video Slave"
tell application "System Events"
tell process "Video Slave"
keystroke "o" using {command down, shift down}
keystroke "g" using {command down, shift down}
delay medDelay
keystroke "v" using {command down}
delay medDelay
key code 36
delay longDelay
keystroke BidLocal
delay medDelay
key code 36
delay longDelay
keystroke "l" using {command down}
end tell
end tell
end importVideo2VS
on importVideo2PT(currentTagesordner, BidLocal, tempTC)
set clipboardPath to (currentTagesordner & ":mxf_video")
set clipboardPathPOSIX to POSIX path of clipboardPath
set the clipboard to clipboardPathPOSIX
tell application "Pro Tools" to activate
tell application "System Events"
tell process "Pro Tools"
keystroke "i" using {option down, shift down, command down}
-- delay 0.3
repeat until exists window "Öffnen"
delay 0.1
end repeat
keystroke "g" using {shift down, command down}
delay medDelay
keystroke "v" using {command down}
delay shortDelay
key code 36
delay shortDelay
keystroke BidLocal
delay shortDelay
key code 36
delay shortDelay
key code 36
repeat until exists window "Spot Dialog"
delay 0.1
end repeat
tell window "Spot Dialog"
keystroke tempTC
click button 2
end tell
end tell
end tell
end importVideo2PT
on WrapMXF(currentTagesordner, MXFlocal)
-- set MXFlocal to "G51380_003_Angela-Merkel-b_S_190506_HHJ19_M03_B.mxf"
-- set currentTagesordner to ((path to movies folder as text) & "Tagesordner:4Juni2019-HSt_Heiko Stoevesand")
tell application "Finder" to make new folder in currentTagesordner with properties {name:"Temp"}
set stemFolder to (currentTagesordner & ":Temp:")
-- set PfadBenutzerOrdnerPOSIX to quoted form of the POSIX path of (currentTagesordner&":")
set stemFolderPOSIX to the POSIX path of stemFolder
tell application "Pro Tools"
activate
tell application "System Events"
tell process "Pro Tools"
-- keystroke "3" using {option down, shift down}
delay 0.3
keystroke "k" using {command down, shift down}
repeat until exists window "Export Selected"
end repeat
tell button "Choose..." of window "Export Selected" to perform action "AXPress"
repeat until exists window "Öffnen"
end repeat
keystroke "g" using {command down, shift down}
tell window "Öffnen"
repeat until exists sheet 1
delay shortDelay
end repeat
tell sheet 1
set value of combo box 1 to stemFolderPOSIX -- The path to go to in order to save the file
delay longDelay
click button 1 -- Go button
key code 36
end tell
end tell
repeat until exists window "Export Selected"
end repeat
tell button "Export..." of window "Export Selected" to perform action "AXPress"
(* tell front window of (first application process whose frontmost is true)
set uiElems to entire contents
end tell *)
end tell
end tell
end tell
tell application "Finder"
activate
display dialog "Audiofiles in temp Ordner geschrieben" -- buttons {"Ok"} default button 1
set OrdnerInhalt to (every file of folder stemFolder whose name extension is "wav")
-- display Dialog "Ornerinhalt gelesen"
set muxDatei1 to (item 1 of OrdnerInhalt) as string
set muxDatei1POSIX to quoted form of POSIX path of muxDatei1
set muxDatei2 to (item 2 of OrdnerInhalt) as string
set muxDatei2POSIX to quoted form of POSIX path of muxDatei2
set muxDatei3 to (item 3 of OrdnerInhalt) as string
set muxDatei3POSIX to quoted form of POSIX path of muxDatei3
set muxDatei4 to (item 4 of OrdnerInhalt) as string
set muxDatei4POSIX to quoted form of POSIX path of muxDatei4
set muxDatei5 to (item 5 of OrdnerInhalt) as string
set muxDatei5POSIX to quoted form of POSIX path of muxDatei5
set muxDatei6 to (item 6 of OrdnerInhalt) as string
set muxDatei6POSIX to quoted form of POSIX path of muxDatei6
set muxDatei7 to (item 7 of OrdnerInhalt) as string
set muxDatei7POSIX to quoted form of POSIX path of muxDatei7
set muxDatei8 to (item 8 of OrdnerInhalt) as string
set muxDatei8POSIX to quoted form of POSIX path of muxDatei8
end tell
set MXFFileMUXPOSIX to quoted form of POSIX path of (currentTagesordner & ":mxf_video:" & MXFlocal)
-- display dialog MXFFileMUXPOSIX
set iconPath to (path to pictures folder as text) & "macNDR_Bilder:Antje512.icns"
tell application "SKProgressBar"
activate
---------------------------------------------------
-- SETUP WINDOW THAT CONTAINS ALL PROGRESS BARS --
---------------------------------------------------
set title to "macNDR Tool" --> default is "SKProgressBar"
set floating to false --> default is true
set position to {1200, 900} --> default is {1000, 750}, origin point is bottom left
set width to 400.0 --> default is 500.0
---------------------------------------------------
-- SETUP MAIN PROGRESS BAR --
-- (progress bar 1 by definition)
---------------------------------------------------
-- It already exists, so no need to create
tell main bar --main bar
set minimum value to 0.0 --> default is 0.0
set maximum value to maxValue --> default is 100.0
set current value to currentValue --> default is 0.0
-- header / footer properties
set header to "Wrapping MXF Container..." --> default is empty string
set header alignment to center --> default is left
set header size to regular --> default is small
-- set footer to "Hier könnte dann der MXF Name stehen" --> default is empty string
set footer to "Name vom MXFFile" --> default is empty string
set footer alignment to center --> default is left
set footer size to small --> default is small
-- image path can be HFS or POSIX path, default is missing value (no image)
set image path to iconPath
end tell
---------------------------------------------------
-- DISPLAY/ACTIVATE THE PROGRESS BARS --
---------------------------------------------------
-- This will show one window will all progress bars
set show window to true --> default is false
tell main bar
set indeterminate to false
start animation
end tell
my resetMainBar()
set pid1 to do shell script path2ffmpeg & "ffmpeg -i " & quoted form of POSIX path of (currentTagesordner & ":mxf_video:" & MXFlocal) & " -i " & muxDatei1POSIX & " -i " & muxDatei2POSIX & " -i " & muxDatei3POSIX & " -i " & muxDatei4POSIX & " -i " & muxDatei5POSIX & " -i " & muxDatei6POSIX & " -i " & muxDatei7POSIX & " -i " & muxDatei8POSIX & " -map 0:0 -map 1:0 -map 2:0 -map 3:0 -map 4:0 -map 5:0 -map 6:0 -map 7:0 -map 8:0 -c:v copy -c:a copy " & quoted form of POSIX path of (currentTagesordner & ":" & MXFlocal) & " &> /dev/null & echo $!"
repeat 40 times
tell main bar to increment by 1
try
do shell script "kill -0 " & pid1
set isRunning to true
on error
set isRunning to false
-- tell main bar to stop animation
-- quit
exit repeat
end try
delay 1
end repeat
-- tell main bar to stop animation
-- quit -- This quits the SKProgressBar app, closing all Progress Bars
end tell
-- set destinationMXF to ((path to movies folder as text) & "Export:")
-- set destinationMXF to "Volumes:MediaGrid:omfs:hhlokvpn:Produktion:Schnitt:DAW_Test:Export:"
set destinationMXFPOSIX to POSIX path of destinationMXF
-- display dialog quoted form of destinationMXFPOSIX
set pid2 to do shell script "mv -f " & quoted form of POSIX path of (currentTagesordner & ":" & MXFlocal) & " " & quoted form of destinationMXFPOSIX & " &> /dev/null & echo $!"
tell application "SKProgressBar"
tell main bar to set header to "Copy MXF Container..."
repeat 40 times
tell main bar to increment by 1
try
do shell script "kill -0 " & pid2
set isRunning to true
on error
set isRunning to false
tell main bar to stop animation
quit
exit repeat
end try
delay 2
end repeat
end tell
-- tell application "Finder" to display Dialog stemFolderPOSIX
set stemFolderPOSIXquote to the quoted form of stemFolderPOSIX
do shell script "rm -R " & stemFolderPOSIXquote
tell application "Finder"
activate
display dialog "Export abgeschlossen" buttons {"Ok"} default button 1
end tell
end WrapMXF
on stems2MXF(currentTagesordner, MXFlocal)
-- set MXFlocal to "NHTH-Drohne_-_PFF_-_DJI_0068_16.mxf"
-- set currentTagesordner to "ddpvolume:Temp:ProTools:Tagesordner:9Oktober2019-NWu_Nick Wuerpel"
tell application "Finder"
activate
-- tell application "Finder" to make new folder in currentTagesordner with properties {name:"Temp"}
set stemFolder to (currentTagesordner & ":bounce:")
set mxfWrapName to MXFlocal
set mxfWrapName to the text returned of (display dialog "Wrap MXF:" default answer mxfWrapName)
-- set PfadBenutzerOrdnerPOSIX to quoted form of the POSIX path of (currentTagesordner&":")
set stemFolderPOSIX to the POSIX path of stemFolder
set fileSizeMXF to size of (info for file (currentTagesordner & ":mxf_video:" & MXFlocal))
-- display dialog fileSizeMXF / 2
-- set delayTime to fileSizeMXF / 220695938
set delayTime to 2
-- display dialog "Audiofiles in temp Ordner geschrieben" -- buttons {"Ok"} default button 1
set OrdnerInhalt to (every file of folder stemFolder whose name extension is "wav")
if (count (OrdnerInhalt)) = 8 then
set muxDatei1POSIX to quoted form of POSIX path of ((item 1 of OrdnerInhalt) as string)
set muxDatei2POSIX to quoted form of POSIX path of ((item 2 of OrdnerInhalt) as string)
set muxDatei3POSIX to quoted form of POSIX path of ((item 3 of OrdnerInhalt) as string)
set muxDatei4POSIX to quoted form of POSIX path of ((item 4 of OrdnerInhalt) as string)
set muxDatei5POSIX to quoted form of POSIX path of ((item 5 of OrdnerInhalt) as string)
set muxDatei6POSIX to quoted form of POSIX path of ((item 6 of OrdnerInhalt) as string)
set muxDatei7POSIX to quoted form of POSIX path of ((item 7 of OrdnerInhalt) as string)
set muxDatei8POSIX to quoted form of POSIX path of ((item 8 of OrdnerInhalt) as string)
else
display dialog "Fehler: Es müssen 8 Spuren zum Wrappen vorliegen" with icon caution
end if
end tell
set MXFFileMUXPOSIX to quoted form of POSIX path of (currentTagesordner & ":mxf_video:" & MXFlocal)
set iconPath to (path to pictures folder as text) & "macNDR_Bilder:Antje512.icns"
set maxValue to 100.0
set currentValue to 0.0
tell application "SKProgressBar"
activate
---------------------------------------------------
-- SETUP WINDOW THAT CONTAINS ALL PROGRESS BARS --
---------------------------------------------------
set title to "macNDR Tool" --> default is "SKProgressBar"
set floating to false --> default is true
set position to {1200, 900} --> default is {1000, 750}, origin point is bottom left
set width to 400.0 --> default is 500.0
---------------------------------------------------
-- SETUP MAIN PROGRESS BAR --
-- (progress bar 1 by definition)
---------------------------------------------------
-- It already exists, so no need to create
tell main bar --main bar
set minimum value to 0.0 --> default is 0.0
set maximum value to maxValue --> default is 100.0
set current value to currentValue --> default is 0.0
-- header / footer properties
set header to "Wrapping MXF Container..." --> default is empty string
set header alignment to center --> default is left
set header size to regular --> default is small
-- set footer to "Hier könnte dann der MXF Name stehen" --> default is empty string
set footer to MXFlocal --> default is empty string
set footer alignment to center --> default is left
set footer size to small --> default is small
-- image path can be HFS or POSIX path, default is missing value (no image)
set image path to iconPath
end tell
---------------------------------------------------
-- DISPLAY/ACTIVATE THE PROGRESS BARS --
---------------------------------------------------
-- This will show one window will all progress bars
set show window to true --> default is false
tell main bar
set indeterminate to false
start animation
end tell
my resetMainBar()
set pid1 to do shell script path2ffmpeg & "ffmpeg -i " & quoted form of POSIX path of (currentTagesordner & ":mxf_video:" & MXFlocal) & " -i " & muxDatei1POSIX & " -i " & muxDatei2POSIX & " -i " & muxDatei3POSIX & " -i " & muxDatei4POSIX & " -i " & muxDatei5POSIX & " -i " & muxDatei6POSIX & " -i " & muxDatei7POSIX & " -i " & muxDatei8POSIX & " -map 0:0 -map 1:0 -map 2:0 -map 3:0 -map 4:0 -map 5:0 -map 6:0 -map 7:0 -map 8:0 -c:v copy -c:a copy " & quoted form of POSIX path of (currentTagesordner & ":" & mxfWrapName) & " &> /dev/null & echo $!"
repeat 40 times
tell main bar to increment by 1
try
do shell script "kill -0 " & pid1
set isRunning to true
on error
set isRunning to false
-- tell main bar to stop animation
-- quit
exit repeat
end try
delay delayTime
end repeat
-- tell main bar to stop animation
-- quit -- This quits the SKProgressBar app, closing all Progress Bars
end tell
if (state of buttonExportDatei as string) = "1" then
set destinationMXF to ((path to movies folder as text) & "Export:")
-- set destinationMXF to "Volumes:MediaGrid:omfs:hhlokvpn:Produktion:Schnitt:DAW_Test:Export:"
set destinationMXFPOSIX to POSIX path of destinationMXF
end if
if (state of buttonExportVPN3 as string) = "1" then
set checkInFile to (currentTagesordner & ":" & mxfWrapName) as alias
set mxfWrapName to checkInVPN3(checkInFile)
-- display dialog xx
set destinationMXF to "VPMS:Ingest:3003_VidiWft_Vantage:"
set destinationMXFPOSIX to POSIX path of destinationMXF
end if
-- display dialog quoted form of destinationMXFPOSIX
set pid2 to do shell script "mv -f " & quoted form of POSIX path of (currentTagesordner & ":" & mxfWrapName) & " " & quoted form of destinationMXFPOSIX & " &> /dev/null & echo $!"
tell application "SKProgressBar"
tell main bar to set header to "Copy MXF Container..."
repeat 40 times
tell main bar to increment by 1
try
do shell script "kill -0 " & pid2
set isRunning to true
on error
set isRunning to false
tell main bar to stop animation
quit
exit repeat
end try
delay delayTime
end repeat
end tell
-- tell application "Finder" to display Dialog stemFolderPOSIX
set stemFolderPOSIXquote to the quoted form of stemFolderPOSIX
try
do shell script "rm " & stemFolderPOSIXquote & "/*"
end try
tell application "Finder"
activate
display dialog "Export abgeschlossen" buttons {"Ok"} default button 1
end tell
end stems2MXF
on checkPTrunning()
tell application "System Events"
if exists application process "Pro Tools" then
return true
else
return false
end if
end tell
end checkPTrunning
on resetMainBar()
tell application "SKProgressBar"
tell main bar
set maximum value to maxValue
set current value to currentValue
end tell
end tell
end resetMainBar
on selectTracks2Export(startTC, durTC)
set exportTrackNames to {} -- Leere Liste erstellen, die mit den Namen der zu exportierenden Tracks gefüllt wird
tell application "Pro Tools"
activate
tell application "System Events"
-- tell text field "Edit Selection Start" of group "Counter Display Cluster" of window 1 of application process "Pro Tools" of application "System Events" to perform action "AXPress"
tell process "Pro Tools"
tell (1st window whose title contains "Edit: ")
click text field 2 of group 4
keystroke startTC
delay 0.1
key code 36
click text field 4 of group 4
keystroke durTC
delay 0.1
key code 36
end tell
end tell
-- display dialog "Stop"
end tell
end tell
set numberOfTracks to getTrackCount()
tell application "System Events"
tell application "Pro Tools" to activate
-- if exists (process "Pro Tools") then
tell process "Pro Tools"
tell (1st window whose title contains "Edit: ")
set trackCounter to 1
set eightSelected to false
repeat until eightSelected = true or trackCounter > numberOfTracks
-- try
if selected of (row trackCounter of table "Track List") is true then
set trackName to (title of button of UI element 2 of (row trackCounter of table "Track List")) as string
set trackName to words 2 through -3 of trackName as string
set the end of exportTrackNames to trackName
set selectCounter to 1
repeat 7 times
set trackName to (title of button of UI element 2 of (row (trackCounter + selectCounter) of table "Track List")) as string
if trackName contains "Selected" then
set trackName to words 2 through -3 of trackName as string
else
set trackName to words 1 through -3 of trackName as string
end if
set the end of exportTrackNames to trackName
if selected of (row (trackCounter + selectCounter) of table "Track List") is false then -- display dialog "nicht selektiert"
click button 1 of UI element 2 of row (trackCounter + selectCounter) of table 1
end if
set selectCounter to selectCounter + 1
end repeat
set eightSelected to true
end if
set trackCounter to trackCounter + 1
-- display dialog trackCounter
-- end try
end repeat
if eightSelected = false then
display dialog "Bitte selektiere mindestens eine Spur!"
else
-- display dialog "fertig selektiert"
display alert "Wollen sie folgende Tracks exportieren?
" & "HM.Links:" & tab & tab & item 1 of exportTrackNames & "
" & "HM.Rechts:" & tab & item 2 of exportTrackNames & "
" & "IT.Links:" & tab & tab & item 3 of exportTrackNames & "
" & "IT.Rechts:" & tab & tab & item 4 of exportTrackNames & "
" & "IToMusik.L:" & tab & item 5 of exportTrackNames & "
" & "IToMusik.R:" & tab & item 6 of exportTrackNames & "
" & "Musik.Links:" & tab & item 7 of exportTrackNames & "
" & "Musik.Rechts:" & tab & item 8 of exportTrackNames & return buttons {"Cancel", "OK"} cancel button 1
end if
end tell
end tell
-- end if
end tell
end selectTracks2Export
on bounceTracks(currentTagesordner)
-- set currentTagesordner to ((path to movies folder as text) & "Tagesordner:7August2019-NWu_Nick Wuerpel")
do shell script "mkdir -p " & quoted form of POSIX path of (currentTagesordner & ":bounce")
set stemFolder to (currentTagesordner & ":bounce:")
set stemFolderPOSIX to the POSIX path of stemFolder
set the clipboard to stemFolderPOSIX
tell application "Pro Tools" to activate
tell application "System Events"
-- if exists (process "Pro Tools") then
tell process "Pro Tools"
keystroke "b" using {shift down, option down, command down}
repeat until exists window "Track Bounce"
delay 0.1
end repeat
tell window "Track Bounce"
if value of pop up button 1 is not "WAV" then
tell pop up button 1
set {xPosition, yPosition} to position
set {xSize, ySize} to size
my cliClick("c:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2))
end tell
delay 0.1
keystroke "sp"
key code 36
delay 0.2
end if
if value of pop up button 2 is not "Multiple mono" then
tell pop up button 2
set {xPosition, yPosition} to position
set {xSize, ySize} to size
my cliClick("c:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2))
end tell
delay 0.1
keystroke "mu"
key code 36
delay 0.2
end if
if value of pop up button 3 is not "24 Bit" then
tell pop up button 3
set {xPosition, yPosition} to position
set {xSize, ySize} to size
my cliClick("c:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2))
end tell
delay 0.1
keystroke "2"
key code 36
delay 0.2
end if
if value of pop up button 4 is not "48 kHz" then
tell pop up button 4
set {xPosition, yPosition} to position
set {xSize, ySize} to size
my cliClick("c:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2))
end tell
delay 0.1
keystroke "4"
key code 36
delay 0.2
end if
if value of checkbox 1 is 1 then -- Pan
click checkbox 1
end if
if value of checkbox 2 is 0 then -- Volume
click checkbox 2
end if
if value of checkbox 3 is 1 then -- add Mp3
click checkbox 3
end if
if value of checkbox 4 is 1 then -- Enforce Media Compatibility
click checkbox 4
end if
if value of checkbox 5 is 1 then -- Import after Bouce
click checkbox 5
end if
if value of checkbox 7 is 0 then -- offline
click checkbox 5
end if
tell button 1 to perform action "AXPress"
-- repeat until exists window "Öffnen"
-- end repeat
keystroke "g" using {command down, shift down}
-- tell window "Öffnen"
--repeat until exists sheet 1
delay 0.2
keystroke "v" using {command down}
delay 0.3
key code 36
delay 0.6
key code 36
delay 0.3
click button 3
-- end repeat
-- tell sheet 1
-- set value of combo box 1 to "stemFolderPOSIX" -- The path to go to in order to save the file
-- end tell
-- end tell
end tell
end tell
-- end if
end tell
end bounceTracks
on getTrackCount()
tell application "System Events"
if exists (process "Pro Tools") then
tell process "Pro Tools"
tell (1st window whose title contains "Edit: ")
set numberOfTracks to 0
try
repeat 192 times
set numberOfTracks to numberOfTracks + 1
-- set trackName to (title of button of UI element 2 of (row numberOfTracks of table "Track List")) as string
set testTrack to selected of (row numberOfTracks of table "Track List")
end repeat
end try
set numberOfTracks to numberOfTracks - 1
return numberOfTracks
end tell
end tell
end if
end tell
end getTrackCount
on selectStems(MXFFilelocal)
set MXFlaenge to (do shell script "/usr/local/bin/ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 " & quoted form of (POSIX path of MXFFilelocal))
set AppleScript's text item delimiters to "."
set MXFlaenge to (text items of MXFlaenge)
set AppleScript's text item delimiters to ","
set MXFlaenge to (MXFlaenge as string)
set AppleScript's text item delimiters to ""
set MXFlaengeINT to MXFlaenge as integer
set MFXVideoLength to secondsToHMSF from MXFlaengeINT
tell application "Pro Tools"
activate
tell application "System Events"
-- tell front window of (first application process whose frontmost is true)
-- tell text field "Edit Selection End" of group "Counter Display Cluster" of window "Edit: Test Import" of application process "Pro Tools" of application "System Events" to perform action "AXPress"
tell text field "Edit Selection Start" of group "Counter Display Cluster" of window 1 of application process "Pro Tools" of application "System Events" to perform action "AXPress"
keystroke "10000000"
delay 0.3
key code 36
tell text field "Edit Selection Length" of group "Counter Display Cluster" of window 1 of application process "Pro Tools" of application "System Events" to perform action "AXPress"
keystroke MFXVideoLength
delay 0.3
key code 36
keystroke "a"
delay 0.3
keystroke "1"
delay 0.3
key code 36
delay 0.3
repeat 7 times
keystroke "ö" using {shift down}
delay 0.1
end repeat
end tell
end tell
end selectStems
on getLengthOfMXF(MXFFilelocal)
set MXFlaenge to (do shell script "/usr/local/bin/ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 " & quoted form of (POSIX path of MXFFilelocal))
set AppleScript's text item delimiters to "."
set MXFlaenge to (text items of MXFlaenge)
set AppleScript's text item delimiters to ","
set MXFlaenge to (MXFlaenge as string)
set AppleScript's text item delimiters to ""
set MXFlaengeINT to MXFlaenge as integer
set MFXVideoLength to secondsToHMSF from MXFlaengeINT
end getLengthOfMXF
on secondsToHMSF from theSeconds
tell theSeconds to return my pad(it div hours) & my pad(it mod hours div minutes) & (my pad(it mod minutes)) + 1 & "00"
-- tell theSeconds to return my pad(it div hours) & ":" & my pad(it mod hours div minutes) & ":" & my pad(it mod minutes)
end secondsToHMSF
on pad(v)
return text -2 thru -1 of (v + 100 as text)
end pad
on updateTCInfo(MXFlocal)
startTcField's setStringValue:(do shell script "/usr/local/bin/ffprobe -v error -show_entries format_tags=timecode -of default=noprint_wrappers=1:nokey=1 " & quoted form of (POSIX path of MXFFile))
set MXFlaenge to (do shell script "/usr/local/bin/ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 " & quoted form of (POSIX path of MXFFile))
set AppleScript's text item delimiters to "."
set MXFlaenge to (text items of MXFlaenge)
set AppleScript's text item delimiters to ","
set MXFlaenge to (MXFlaenge as string)
set AppleScript's text item delimiters to ""
set MXFlaengeINT to MXFlaenge as integer
set MFXVideoLength to secondsToHMSF from MXFlaengeINT
-- display dialog MFXVideoLength
end updateTCInfo
on getVPN3XML()
activate
set varAppName to "unFair Lite"
-- set varItemToImport to the text returned of (display dialog "Bitte geben Sie die Item-ID ein, die sie aus VPN3 importieren wollen:" default answer "VX-1004" with title varAppName)
-- set varItemToImport to the text returned of (display dialog "Bitte geben Sie die Item-ID ein, die sie aus VPN3 importieren wollen:" default answer varItemToImport with title varAppName)
# ------------------------------ curl-Abfrage von vidispine, "Suche Metadaten zu ItemId", Ausgabe in Datei ------------------------------
set varVidispineXmlTempFileUri to (path to documents folder) & "temp:ItemUri.xml" as string
set varCurlOptionAuthMethod to "basic"
set varCurlOptionAuthUser to "admin"
set varCurlOptionAuthUserPwd to "admin"
set varCurlOptionRequestMethod to "GET"
set varCurlUrl to "http://ndrlokv3t-adl01.ad.ndr-net.de:31060/API/item/" & varItemToImport & "/uri/?tag=XDCAMHD"
set varVidispineXml to do shell script "curl -H --" & varCurlOptionAuthMethod & " --user " & varCurlOptionAuthUser & ":" & varCurlOptionAuthUserPwd & " request " & varCurlOptionRequestMethod & " '" & varCurlUrl & "' > " & (POSIX path of varVidispineXmlTempFileUri) & " "
tell application "System Events"
tell XML element 1 of contents of XML file varVidispineXmlTempFileUri
set varVidispineUri to (value of (XML element "uri"))
end tell
end tell
set varDestinationPath to POSIX path of (path to desktop)
set varSourcePath to ("/Volumes/" & text 23 thru (length of varVidispineUri) of varVidispineUri)
return varSourcePath
end getVPN3XML
on checkInVPN3(varFileToCheckIn)
activate
tell application "Finder"
set varDateTime to do shell script "date '+%Y-%m-%d_%H-%M-%S'"
set varDateIso to do shell script "date '+%Y-%m-%dT%H:%M:%SZ'"
set varV3_P_P_ERSTELLDATUM to varDateIso
-- set varFileToCheckIn to choose file with prompt "Welche Datei soll eingecheckt werden?"
set varFileToCheckInKind to kind of varFileToCheckIn
set varMATERIALTITEL to (name of varFileToCheckIn)
set varV3_R_O_MATERIALTITEL to text 1 thru ((offset of "." in varMATERIALTITEL) - 1) of varMATERIALTITEL
set varV3_P_D_FILENAME to varDateTime & "_" & (name of varFileToCheckIn) # **** Eindeutigen Dateinamen erzeugen
end tell
-- set varV3_I_O_CODE to computer name of (system info)
-- set varV3_I_P_PROD_NACHNAME to long user name of (system info)
-- activate
# **** weitere Metadaten setzen (diese sollten natürlich wie die BID eingebbar oder auslesbar sein)
set varV3_R_O_BEITRAGSTITEL to fieldBeitragstitel's stringValue() as text
-- set varV3_R_O_MATERIALTITEL to fieldMateriatitel's stringValue() as text
set varV3_I_P_AUTOR_NAME to fieldAutorName's stringValue() as text
set varV3_I_P_AUTOR_NACHNAME to fieldAutorNachname's stringValue() as text
set varV3_I_P_AUTOR_EMAIL to fieldAutorEmail's stringValue() as text
set varV3_I_O_REGION to "Kiel"
set varV3_I_O_STATE to "KIE"
set varV3_P_P_ERSTSENDEDATUM_dt to "2019-06-01T15:00:00.0000000Z"
set varV3_I_O_CODE to " "
-- set varV3_P_D_FILENAME to "Test.mxf"
# **** Systemmetadaten auslesen und setzen
-- set varV3_P_P_ERSTELLDATUM to "varDateIso"
set varV3_I_O_CODE to fieldComputer's stringValue() as text
set varV3_I_P_PROD_NACHNAME to fieldBearbeiter's stringValue() as text
set varV3_R_O_BID to fieldBiD's stringValue() as text
-- set varV3_I_O_CODE to computer name of (system info)
-- set varV3_I_P_PROD_NACHNAME to long user name of (system info)
-- set varV3_R_O_BID to the text returned of (display dialog "Unter welcher BID soll eingecheckt werden?" default answer ¬
-- varV3_R_O_BID with title "noFair Lite")
# ------------------------------ **** XML-Datensatz erzeugen **** ------------------------------
set varXmlData to "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<MetadataDocument xmlns='http://xml.vidispine.com/schema/vidispine'>
<timespan start='-INF' end='+INF'>
<field>
<name>V3_R_O_BEITRAGSTITEL</name>
<value>" & varV3_R_O_BEITRAGSTITEL & "</value>
</field>
<field>
<name>V3_R_O_MATERIALTITEL</name>
<value>" & varV3_R_O_MATERIALTITEL & "</value>
</field>
<field>
<name>V3_R_O_BID</name>
<value>" & varV3_R_O_BID & "</value>
</field>
<field>
<name>V3_I_P_AUTOR_NAME</name>
<value>" & varV3_I_P_AUTOR_NAME & "</value>
</field>
<field>
<name>V3_I_P_AUTOR_NACHNAME</name>
<value>" & varV3_I_P_AUTOR_NACHNAME & "</value>
</field>
<field>
<name>V3_I_P_AUTOR_EMAIL</name>
<value></value>
</field>
<field>
<name>V3_I_P_AUTOR_PHONE</name>
<value></value></field>
<field>
<name>V3_I_P_PROD_NAME</name>
<value></value>
</field>
<field>
<name>V3_I_P_PROD_NACHNAME</name>
<value>" & varV3_I_P_PROD_NACHNAME & "</value>
</field>
<field>
<name>V3_I_A_NAME</name>
<value></value>
</field>
<field>
<name>V3_I_A_TYPE</name>
<value></value>
</field>
<field>
<name>V3_I_O_CODE</name>
<value>" & varV3_I_O_CODE & "</value>
</field>
<field>
<name>V3_I_O_NAME</name>
<value></value>
</field>
<field>
<name>V3_I_O_REGION</name>
<value></value>
</field>
<field>
<name>V3_I_O_STATE</name>
<value></value>
</field>
<field>
<name>V3_R_O_BESCHREIBUNG</name>
<value></value>
</field>
<field>
<name>V3_R_O_SENDUNGSTITEL</name>
<value></value>
</field>
<field>
<name>V3_R_P_BEITRAGSSTATUS</name>
<value>redaktionelle Bearbeitung</value>
</field>
<field>
<name>V3_R_P_FREIGABE</name>
<value>false</value>
</field>
<field>
<name>V3_R_P_GEPRUEFT</name>
<value>true</value>
</field>
<field>
<name>V3_R_P_BEARBEIT_STATUS</name>
<value></value>
</field>
<field>
<name>V3_P_P_ERSTELLDATUM</name>
<value>" & varV3_P_P_ERSTELLDATUM & "</value>
</field>
<field>
<name>V3_P_P_ERSTSENDEDATUM</name>
<value>" & varV3_P_P_ERSTSENDEDATUM_dt & "</value>
</field>
<field>
<name>V3_P_P_FARBKORRIGIERT</name>
<value>false</value>
</field>
<field>
<name>V3_P_P_JOBSTATUS</name>
<value>InProcess</value>
</field><field>
<name>V3_P_P_PLANJOBSTATUS</name>
<value></value>
</field>
<field>
<name>V3_P_P_PLANSYSTEM_ID</name>
<value></value>
</field>
<field>
<name>V3_P_D_LOOK</name>
<value>Interlaced</value>
</field>
<field>
<name>V3_P_D_TECH_MAN_BESCHR</name>
<value></value>
</field>
<field>
<name>V3_P_D_FILENAME</name>
<value>" & varV3_P_D_FILENAME & "</value>
</field>
<field>
<name>V3_P_D_AUDIOCODING_SP1</name>
<value>Stereo links</value>
</field>
<field>
<name>V3_P_D_AUDIOCODING_SP2</name>
<value>Stereo rechts</value>
</field>
<field>
<name>V3_P_D_AUDIOCODING_SP3</name>
<value>Stereo links</value>
</field>
<field>
<name>V3_P_D_AUDIOCODING_SP4</name>
<value>Stereo rechts</value>
</field>
<field>
<name>V3_P_D_AUDIOCODING_SP5</name>
<value>Stereo links</value>
</field>
<field>
<name>V3_P_D_AUDIOCODING_SP6</name>
<value>Stereo rechts</value>
</field>
<field>
<name>V3_P_D_AUDIOCODING_SP7</name>
<value>Stereo links</value>
</field>
<field>
<name>V3_P_D_AUDIOCODING_SP8</name>
<value>Stereo rechts</value>
</field>
<field>
<name>V3_P_D_AUDIOLABEL_SP1</name>
<value>internationaler Ton (IT)</value>
</field>
<field>
<name>V3_P_D_AUDIOLABEL_SP2</name>
<value>internationaler Ton (IT)</value>
</field>
<field>
<name>V3_P_D_AUDIOLABEL_SP3</name>
<value>internationaler Ton (IT)</value>
</field>
<field>
<name>V3_P_D_AUDIOLABEL_SP4</name>
<value>internationaler Ton (IT)</value>
</field>
<field>
<name>V3_P_D_AUDIOLABEL_SP5</name>
<value>nicht belegt</value>
</field>
<field>
<name>V3_P_D_AUDIOLABEL_SP6</name>
<value>nicht belegt</value>
</field>
<field>
<name>V3_P_D_AUDIOLABEL_SP7</name>
<value>nicht belegt</value>
</field>
<field>
<name>V3_P_D_AUDIOLABEL_SP8</name>
<value>nicht belegt</value>
</field>
<field>
<name>V3_P_D_LOUDNESS_SP1</name>
<value>0.1</value>
</field>
<field>
<name>V3_P_D_LOUDNESS_SP2</name>
<value>0.1</value>
</field>
<field>
<name>V3_P_D_LOUDNESS_SP3</name>
<value>0.1</value>
</field>
<field>
<name>V3_P_D_LOUDNESS_SP4</name>
<value>0.1</value>
</field>
<field>
<name>V3_P_D_RANGE_SP1</name>
<value>0.1</value>
</field>
<field>
<name>V3_P_D_RANGE_SP2</name>
<value>0.1</value>
</field>
<field>
<name>V3_P_D_RANGE_SP3</name>
<value>0.1</value>
</field>
<field>
<name>V3_P_D_RANGE_SP4</name>
<value>0.1</value>
</field>
<field>
<name>V3_P_D_TRUEPEAK_SP1</name>
<value>0.1</value>
</field>
<field>
<name>V3_P_D_TRUEPEAK_SP2</name>
<value>0.1</value>
</field>
<field>
<name>V3_P_D_TRUEPEAK_SP3</name>
<value>0.1</value>
</field>
<field>
<name>V3_P_D_TRUEPEAK_SP4</name>
<value>0.1</value>
</field>
</timespan>
</MetadataDocument>"
set varV3_P_D_FILENAME_withoutExtension to text 1 thru ((offset of "." in varV3_P_D_FILENAME) - 1) of varV3_P_D_FILENAME
-- set varXmlTempFile to (path to desktop) & varV3_P_D_FILENAME_withoutExtension & ".xml" as string
set varXmlTempFile to (path to documents folder) & "temp:" & varV3_P_D_FILENAME_withoutExtension & ".xml" as string
tell application "Finder"
set varFileReference to (open for access file varXmlTempFile with write permission)
set eof of varFileReference to 0
try
write varXmlData to varFileReference as «class utf8» starting at eof
close access file varXmlTempFile
on error
activate
display dialog "Es ist ein Fehler beim Schreiben der XML aufgetreten!"
end try
end tell
# **** passenden Speicherpfad und Typ zum Dateityp setzen ****
if varFileToCheckInKind is equal to "Media Exchange Format" or varFileToCheckInKind contains "Film" then
set varDestinationPath to "VPMS:Ingest:3003_VidiWft_Vantage:"
set varType to "Video"
end if
if varFileToCheckInKind contains "Bild" then
set varDestinationPath to "VPMS:Ingest:3006_DropMMO"
set varType to "Bild"
end if
if varFileToCheckInKind contains "Audio" then
set varDestinationPath to "VPMS:Ingest:3006_DropMMO"
set varType to "Audio"
end if
-- Später löschen!
-- set varDestinationPath to (path to movies folder)&"Export:" as text
tell application "Finder"
-- try
duplicate file varXmlTempFile to varDestinationPath with replace
-- display dialog varFileToCheckIn as text
-- display dialog varV3_P_D_FILENAME as text
set name of varFileToCheckIn to varV3_P_D_FILENAME
-- duplicate file ("Macintosh HD:Users:nickwuerpel:Movies:MXFMediacenter:"&varV3_P_D_FILENAME) to varDestinationPath with replace
-- display dialog "Die Datei " & varMATERIALTITEL & " wurde unter der BID " & varV3_R_O_BID & " als " & varType & " ins VPN3-System kopiert."
-- on error
-- activate
-- display dialog "Es ist ein Fehler beim Kopieren der Dateien aufgetreten!"
-- end try
end tell
return varV3_P_D_FILENAME
end checkInVPN3
on initMetadata()
activate
-- set varItemToImport to "VX-1004" -- muss wieder gelöscht werden!
set varAppName to "unFair Lite"
-- set varItemToImport to the text returned of (display dialog "Bitte geben Sie die Item-ID ein, die sie aus VPN3 importieren wollen:" default answer "VX-1004" with title varAppName)
set varVidispineXmlTempFileMetadata to (path to documents folder) & "temp:ItemMetadata.xml" as text
set varCurlOptionAuthMethod to "basic"
set varCurlOptionAuthUser to "admin"
set varCurlOptionAuthUserPwd to "admin"
set varCurlOptionRequestMethod to "GET"
set varCurlMeta to "http://ndrlokv3t-adl01.ad.ndr-net.de:31060/API/item/" & varItemToImport & "/?content=metadata&field=V3_R_O_BEITRAGSTITEL,V3_R_O_MATERIALTITEL,V3_I_P_AUTOR_NAME,V3_I_P_AUTOR_NACHNAME,V3_R_O_BID,V3_P_P_ERSTSENDEDATUM"
set varVidispineXml to do shell script "curl -H --" & varCurlOptionAuthMethod & " --user " & varCurlOptionAuthUser & ":" & varCurlOptionAuthUserPwd & " request " & varCurlOptionRequestMethod & " '" & varCurlMeta & "'> " & (POSIX path of varVidispineXmlTempFileMetadata) & " "
tell application "System Events"
set varXmlSavedData to contents of XML file varVidispineXmlTempFileMetadata
tell XML element "ItemDocument" of varXmlSavedData
tell XML element "metadata"
tell XML element "timespan"
set varEveryFields to every XML element whose name = "field"
repeat with a from 1 to (length of varEveryFields)
set varCurrentField to item a of varEveryFields
tell varCurrentField
set varFieldName to value of (first XML element whose name = "name")
if varFieldName = "V3_R_O_BEITRAGSTITEL" then
set varV3_R_O_BEITRAGSTITEL to value of (first XML element whose name = "value")
end if
if varFieldName = "V3_R_O_MATERIALTITEL" then
set varV3_R_O_MATERIALTITEL to value of (first XML element whose name = "value")
end if
if varFieldName = "V3_R_O_BID" then
set varV3_R_O_BID to value of (first XML element whose name = "value")
end if
if varFieldName = "V3_I_P_AUTOR_NAME" then
set varV3_I_P_AUTOR_NAME to value of (first XML element whose name = "value")
end if
if varFieldName = "V3_I_P_AUTOR_NACHNAME" then
set varV3_I_P_AUTOR_NACHNAME to value of (first XML element whose name = "value")
end if
if varFieldName = "V3_P_P_ERSTSENDEDATUM" then
set varV3_P_P_ERSTSENDEDATUM to value of (first XML element whose name = "value")
end if
end tell
end repeat
end tell
end tell
end tell
end tell
-- activate
fieldBiD's setStringValue:varV3_R_O_BID
fieldBeitragstitel's setStringValue:varV3_R_O_BEITRAGSTITEL
fieldMateriatitel's setStringValue:varV3_R_O_MATERIALTITEL
fieldComputer's setStringValue:(computer name of (system info))
fieldBearbeiter's setStringValue:(long user name of (system info))
fieldAutorEmail's setStringValue:"j.wuerpel@ndr.de"
fieldAutorName's setStringValue:varV3_I_P_AUTOR_NAME
fieldAutorNachname's setStringValue:varV3_I_P_AUTOR_NACHNAME
fieldErstsendedatum's setStringValue:varV3_P_P_ERSTSENDEDATUM
end initMetadata
on cliClick(coordinate)
do shell script quoted form of cliclickCLIPath & " -r " & coordinate
end cliClick
on getStartTC()
set tempTC to do shell script "/usr/local/bin/ffprobe -v error -show_entries format_tags=timecode -of default=noprint_wrappers=1:nokey=1 " & quoted form of (POSIX path of MXFFile)
set AppleScript's text item delimiters to ":"
set tempTC to (every text item of tempTC)
set AppleScript's text item delimiters to ""
set tempTC to tempTC as text
return tempTC
end getStartTC
end script
No comments to display
No comments to display