Using VB Scripting To Control Quicktime
Posted: Sun Oct 23, 2011 3:06 am
Greetings All,
I am working on a little project for my grandkids. I want to take audio recordings (saved as .mov files), combine them with corresponding jpeg images to create many little quicktime movies. Then, I want to combine all my little movies into one big movie. My problem is this . . . some of the kids have Macs and some have PCs. I have finished the applescript coding so everything works great on the Mac side. However, I don't have a clue how to write the code for a VB script. Is there someone out there with enough patience to tutor me in this. I am showing my live code script for the apple scripting I do to give you an idea of what the program does.
Thanks,
John
-- GET LOCATION OF JPEG FILES
put cd fld "Current Book Folder" into imageLoc
put "/Images" after imageLoc
set the defaultfolder to imageLoc
put the files into imagesXX
filter imagesXX without "[.]*"
filter imagesXX with"*[.jpg]"
-- GET LOCATION OF SELECTED AUDIO RECORDINGS
put cd fld "Current Book Folder" into audioLoc
put "/Recordings" after audioLoc
set the defaultfolder to audioLoc
put the files into recordingsYY
filter recordingsYY without "[.]*"
filter recordingsYY with"*[.mov]"
-- GET LOCATION OF MOVIE FOLDER
put cd fld "Current Book Folder" into bookLoc
put "/My Movie" after bookLoc
-- OPEN QUICKTIME PLAYER 7 & OPEN NEW MOVIE
put "tell application " & QUOTE & "QuickTime Player 7" & QUOTE into scriptXX
put CR & "launch" after scriptXX
put CR & "make new movie" after scriptXX
put CR & "end tell" after scriptXX
do scriptXX as applescript
repeat with x = 1 to (number of lines in recordingsYY)
-- UPDATE CARD FIELD "STATUS"
put "Processing Page " & x & " Of " & (number of lines in recordingsYY) into cd fld "Status"
-- GET LOCATION OF IMAGES FOLDER
put imageLoc & "/" & line x of imagesXX into imageFile
replace "/" with ":" in imageFile
-- GET LOCATION OF RECORDINGS FOLDER
put audioLoc & "/" & line x of recordingsYY into audioFile
replace "/" with ":" in audioFile
put CR & "tell application " & QUOTE & "QuickTime Player 7" & QUOTE into scriptXX
put CR & "open file " & QUOTE & imageFile & QUOTE after scriptXX
put CR & "select all front document" after scriptXX
put CR & "copy front document" after scriptXX
put CR & "close front document" after scriptXX
put CR & "end tell" after scriptXX
do scriptXX as applescript
set the thumbpos of scrollbar "Movie" to the thumbpos of scrollbar "Movie"+1
put CR & "tell application " & QUOTE & "QuickTime Player 7" & QUOTE into scriptXX
put CR & "open file " & QUOTE & audioFile & QUOTE after scriptXX
put CR & "set the movie_length to ((the duration of document 1)-200)" after scriptXX
put CR & "tell document 1" after scriptXX
put CR & "select at 0 to movie_length" after scriptXX
put CR & "trim" after scriptXX
put CR & "end tell" after scriptXX
put CR & "end tell" after scriptXX
do scriptXX as applescript
set the thumbpos of scrollbar "Movie" to the thumbpos of scrollbar "Movie"+1
put CR & "tell application " & QUOTE & "QuickTime Player 7" & QUOTE into scriptXX
put CR & "select all document 1" after scriptXX
put CR & "add document 1 with scaled" after scriptXX
put CR & "select all document 1" after scriptXX
put CR & "copy document 1" after scriptXX
put CR & "close document 1" after scriptXX
put CR & "end tell" after scriptXX
do scriptXX as applescript
set the thumbpos of scrollbar "Movie" to the thumbpos of scrollbar "Movie"+1
put CR & "tell application " & QUOTE & "QuickTime Player 7" & QUOTE into scriptXX
put CR & "tell movie 1" after scriptXX
put CR & "add" after scriptXX
put CR & "select none" after scriptXX
put CR & "end tell" after scriptXX
put CR & "end tell" after scriptXX
do scriptXX as applescript
set the thumbpos of scrollbar "Movie" to the thumbpos of scrollbar "Movie"+1
wait 5 ticks
set the thumbpos of scrollbar "Movie" to the thumbpos of scrollbar "Movie"+1
end repeat
I am working on a little project for my grandkids. I want to take audio recordings (saved as .mov files), combine them with corresponding jpeg images to create many little quicktime movies. Then, I want to combine all my little movies into one big movie. My problem is this . . . some of the kids have Macs and some have PCs. I have finished the applescript coding so everything works great on the Mac side. However, I don't have a clue how to write the code for a VB script. Is there someone out there with enough patience to tutor me in this. I am showing my live code script for the apple scripting I do to give you an idea of what the program does.
Thanks,
John
-- GET LOCATION OF JPEG FILES
put cd fld "Current Book Folder" into imageLoc
put "/Images" after imageLoc
set the defaultfolder to imageLoc
put the files into imagesXX
filter imagesXX without "[.]*"
filter imagesXX with"*[.jpg]"
-- GET LOCATION OF SELECTED AUDIO RECORDINGS
put cd fld "Current Book Folder" into audioLoc
put "/Recordings" after audioLoc
set the defaultfolder to audioLoc
put the files into recordingsYY
filter recordingsYY without "[.]*"
filter recordingsYY with"*[.mov]"
-- GET LOCATION OF MOVIE FOLDER
put cd fld "Current Book Folder" into bookLoc
put "/My Movie" after bookLoc
-- OPEN QUICKTIME PLAYER 7 & OPEN NEW MOVIE
put "tell application " & QUOTE & "QuickTime Player 7" & QUOTE into scriptXX
put CR & "launch" after scriptXX
put CR & "make new movie" after scriptXX
put CR & "end tell" after scriptXX
do scriptXX as applescript
repeat with x = 1 to (number of lines in recordingsYY)
-- UPDATE CARD FIELD "STATUS"
put "Processing Page " & x & " Of " & (number of lines in recordingsYY) into cd fld "Status"
-- GET LOCATION OF IMAGES FOLDER
put imageLoc & "/" & line x of imagesXX into imageFile
replace "/" with ":" in imageFile
-- GET LOCATION OF RECORDINGS FOLDER
put audioLoc & "/" & line x of recordingsYY into audioFile
replace "/" with ":" in audioFile
put CR & "tell application " & QUOTE & "QuickTime Player 7" & QUOTE into scriptXX
put CR & "open file " & QUOTE & imageFile & QUOTE after scriptXX
put CR & "select all front document" after scriptXX
put CR & "copy front document" after scriptXX
put CR & "close front document" after scriptXX
put CR & "end tell" after scriptXX
do scriptXX as applescript
set the thumbpos of scrollbar "Movie" to the thumbpos of scrollbar "Movie"+1
put CR & "tell application " & QUOTE & "QuickTime Player 7" & QUOTE into scriptXX
put CR & "open file " & QUOTE & audioFile & QUOTE after scriptXX
put CR & "set the movie_length to ((the duration of document 1)-200)" after scriptXX
put CR & "tell document 1" after scriptXX
put CR & "select at 0 to movie_length" after scriptXX
put CR & "trim" after scriptXX
put CR & "end tell" after scriptXX
put CR & "end tell" after scriptXX
do scriptXX as applescript
set the thumbpos of scrollbar "Movie" to the thumbpos of scrollbar "Movie"+1
put CR & "tell application " & QUOTE & "QuickTime Player 7" & QUOTE into scriptXX
put CR & "select all document 1" after scriptXX
put CR & "add document 1 with scaled" after scriptXX
put CR & "select all document 1" after scriptXX
put CR & "copy document 1" after scriptXX
put CR & "close document 1" after scriptXX
put CR & "end tell" after scriptXX
do scriptXX as applescript
set the thumbpos of scrollbar "Movie" to the thumbpos of scrollbar "Movie"+1
put CR & "tell application " & QUOTE & "QuickTime Player 7" & QUOTE into scriptXX
put CR & "tell movie 1" after scriptXX
put CR & "add" after scriptXX
put CR & "select none" after scriptXX
put CR & "end tell" after scriptXX
put CR & "end tell" after scriptXX
do scriptXX as applescript
set the thumbpos of scrollbar "Movie" to the thumbpos of scrollbar "Movie"+1
wait 5 ticks
set the thumbpos of scrollbar "Movie" to the thumbpos of scrollbar "Movie"+1
end repeat