Sunday, April 21, 2019

#1 2011-12-03 01:29:25 pm

wkmanley
Member
From:: Westlake, Ohio USA
Registered: 2011-11-22
Posts: 19

Applescript for MPEG Streamclip

Is there a way to control  MPEG Streamclip with Applescript.  I want a script to set in and out points and cut out the section.  I can't find an applescript dictionary.  Any advise would be appreciated.


Applescript v 2.3   OSX 10.6.8   Macbook Pro 2.16 GHz Intel Core Duo  2GB 667 MHz DDR2 SDRAM

Offline

 

#2 2011-12-03 04:27:11 pm

partron22
Member
Registered: 2011-03-18
Posts: 86

Re: Applescript for MPEG Streamclip

A quick gander with this script:

Applescript:

-- Entire Contents Demo - mini
-- BP ages ago or so

-- This'll get all the controls and structures associated with an App's window and menus
-- In a form which is easily pasteable into your own scripts
-- and show them in the result pane below.
--
-- Copy that into a text editor and change commas to returns to get an easily readable list.
--
-- The script can take a long time if there are LOTS of window items, such as
-- in the "music" pane of iTunes. It may even time out if you have a huge iTunes library
-- The script'll process most App's UI structures in under a minute

set appname to "MPEG Streamclip" -------------------------- Set this to the App you want to look at

set winstuff to "defaultval"
set menustuff to "defaultval"

tell application appname
   activate
end tell

tell application "System Events"
   tell process appname
       set winstuff to entire contents of front window
       set menustuff to entire contents of menu bar 1
   end tell
end tell
return winstuff & "\r\r\r\r" & menustuff -- comment this out to get just winstuff
return winstuff -- comment this out too to get just menustuff
return menustuff

Yields promising results:

button 1 of window "MPEG Streamclip 1.9.3b3  ©  2004-2010 Squared 5 " of application process "MPEG Streamclip" of application "System Events"
button 2 of window "MPEG Streamclip 1.9.3b3  ©  2004-2010 Squared 5 " of application process "MPEG Streamclip" of application "System Events"
button 3 of window "MPEG Streamclip 1.9.3b3  ©  2004-2010 Squared 5 " of application process "MPEG Streamclip" of application "System Events"
pop up button 1 of window "MPEG Streamclip 1.9.3b3  ©  2004-2010 Squared 5 " of application process "MPEG Streamclip" of application "System Events"
pop up button 2 of window "MPEG Streamclip 1.9.3b3  ©  2004-2010 Squared 5 " of application process "MPEG Streamclip" of application "System Events"
... etc.
menu item "Batch List" of menu "List" of menu bar item "List" of menu bar 1 of application process "MPEG Streamclip" of application "System Events"
menu item "Edit List" of menu "List" of menu bar item "List" of menu bar 1 of application process "MPEG Streamclip" of application "System Events"
menu item 3 of menu "List" of menu bar item "List" of menu bar 1 of application process "MPEG Streamclip" of application "System Events"
menu item "Log Window" of menu "List" of menu bar item "List" of menu bar 1 of application process "MPEG Streamclip" of application "System Events"
menu bar item "Enigma" of menu bar 1 of application process "MPEG Streamclip" of application "System Events"
... etc.


Yup, this script works for me:

Applescript:

tell application "MPEG Streamclip"
   activate
end tell

tell application "System Events"    
   click menu item "Batch List" of menu "List" of menu bar item "List" of menu bar 1 of application process "MPEG Streamclip"    
end tell

Last edited by partron22 (2011-12-03 04:28:46 pm)

Offline

 

#3 2011-12-03 04:40:16 pm

partron22
Member
Registered: 2011-03-18
Posts: 86

Re: Applescript for MPEG Streamclip

Additionally, running the first script a second time, while the "Batch list" window is in front yields results for that window:

...
button "Source" of group 1 of table 1 of scroll area 1 of window "MPEG Streamclip - Batch List" of application process "MPEG Streamclip" of application "System Events"
button "Task" of group 1 of table 1 of scroll area 1 of window "MPEG Streamclip - Batch List" of application process "MPEG Streamclip" of application "System Events"
button "Destination" of group 1 of table 1 of scroll area 1 of window "MPEG Streamclip - Batch List" of application process "MPEG Streamclip" of application "System Events"
button "Status" of group 1 of table 1 of scroll area 1 of window "MPEG Streamclip - Batch List" of application process "MPEG Streamclip" of application "System Events"
button "Go" of window "MPEG Streamclip - Batch List" of application process "MPEG Streamclip" of application "System Events"
button "↑" of window "MPEG Streamclip - Batch List" of application process "MPEG Streamclip" of application "System Events"
button "↓" of window "MPEG Streamclip - Batch List" of application process "MPEG Streamclip" of application "System
Events"
...


So it's quite simple to burrow as deeply as needed into the App's user interface.

Last edited by partron22 (2011-12-03 04:40:44 pm)

Offline

 

#4 2011-12-03 10:35:30 pm

wkmanley
Member
From:: Westlake, Ohio USA
Registered: 2011-11-22
Posts: 19

Re: Applescript for MPEG Streamclip

The code is great.  My next step is to input a cell from excel into the dialog box "GO TO enter time" The excel sheet makes a time code "minutes:seconds,frames" i.e. 06:23,13 I need to get that into Streamclip.

In Quicktime I can :
tell application "QuickTime Player 7"
            activate --allow QT to be run by script
            tell document 1 --the active file in QT
                set selection start to inValue     --INVALUE AND OUTVALUE COME FROM EXCEL IN STREAMCLIP INVALUE,OUTVALUE WOULD BE SOMETHINE LIKE  06:23,13
                set selection end to outValue --set in out points
                set current time to inValue --show in point
                delay 2 --wait show out point
                set current time to outValue
               
            end tell
end tell

But Streamclip dosen't seem to have the variables <selection start>, <selection end> and <set current time>.  Is there code to do that or must I use cut and paste keyboard commands that I've seen in other applescripts? Something like this

Applescript:


tell application "Finder"
   activate
   open selection using application file "MPEG Streamclip.app" of folder "Applications" of startup disk
end tell

tell application "MPEG Streamclip" to activate
tell application "System Events"
   tell process "MPEG Streamclip"
       keystroke "e" using {control down, command down}
       delay 1.5
       keystroke return
   end tell
end tell

The following code brings up the dialog box I need to control with the variable made in excel,

Applescript:



tell application "MPEG Streamclip"
   activate
end tell

tell application "System Events"
   
   click menu item "Go to Time…" of menu "Edit" of menu bar item "Edit" of menu bar 1 of application process "MPEG Streamclip" of application "System Events"
   
   -- or
   --click menu item "Go to In" of menu "Edit" of menu bar item "Edit" of menu bar 1 of application process "MPEG Streamclip" of application "System Events"
   --click menu item "Go to Out" of menu "Edit" of menu bar item "Edit" of menu bar 1 of application process "MPEG Streamclip" of application "System Events"
   --click menu item "Cut" of menu "Edit" of menu bar item "Edit" of menu bar 1 of application process "MPEG Streamclip" of application "System Events"    
   
end tell


This is a great site and I can't tell you how much help I've received and how much fun I'm having.


Applescript v 2.3   OSX 10.6.8   Macbook Pro 2.16 GHz Intel Core Duo  2GB 667 MHz DDR2 SDRAM

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)