Page 1 of 1

Using VB Scripting To Control Quicktime

Posted: Sun Oct 23, 2011 3:06 am
by johnmiller1950
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

Re: Using VB Scripting To Control Quicktime

Posted: Sun Oct 23, 2011 11:35 am
by Klaus
Hi John,

please take a look at Trevors wonderful Enhanced QuickTime External (Mac and Windows!):
http://www.bluemangolearning.com/revolu ... rnals/eqt/

Maybe this coul be helpful sice it will eliminate the use of any other scripting but LiveCode :)


Best

Klaus

Re: Using VB Scripting To Control Quicktime

Posted: Sun Oct 23, 2011 3:33 pm
by johnmiller1950
Klaus,

This looks like it might be just the thing I need. However, I don't seems to be able to get the plugins to load when live code starts up. I put the "EnhancedQT.dll" & "Enhanced.bundle" files into a folder
~/Documents/My LiveCode/Plugins. I told LiveCode to check in ~/Documents/My LiveCode for the plugins. I believe this is the correct way to do it.

Do I need to do something else? One of the tutorials suggested deleting the LiveCode preference file, but I can't find a preference file anywhere on my computer for LiveCode.

John

Re: Using VB Scripting To Control Quicktime

Posted: Sun Oct 23, 2011 3:55 pm
by Klaus
Hi John,

if there is NOT a file "Externals.txt" inside of your "~/Documents/My LiveCode/" folder, please create one with this content, ONE line:
EnhancedQTExternal, EnhancedQTExternal.dll
on Windows

Resp.:
EnhancedQTExternal, EnhancedQTExternal.bundle
on a Mac, so the IDE knows what externals to load additionally on startup.

If there is this file, open that file and append this line.

Save and restart LiveCode, that should do the trick.
And yes this could be easier and should be documented somewhere (maybe it is, but I did not find it yet) 8)


Best

Klaus

Re: Using VB Scripting To Control Quicktime

Posted: Sun Oct 23, 2011 4:22 pm
by johnmiller1950
Klaus,

Thanks for your speedy reply. Initially I couldn't get your suggestion to work. However, I tried changing the name of my "Plugins" folder to "Externals" and now it works great.

Thanks again,
John