I read a previous post from early April about working applescript
into Ruby. BUT....
I need to be able to convert mp3s into hinted movie format (which
isn't covered ANYWHERE). Whats the best way to do this in any
applescript wrapper?
Thanks,
Ari
-------------------------------------------|
I'm not sure I understand the question. But does this help
rb-appscript.rubyforge.org
This isn't what you're looking for, but gives an example of working with
a movie. I got the following in response to a question I asked from HAS:
require 'appscript'
include Appscript
QTP = app('QuickTime Player.app')
# To export the middle frame of a movie file to a PICT file:
movie = QTP.open(MacTypes::Alias.path('/path/to/your movie.mov'))[0]
movie.current_time.set(movie.duration.get / 2)
movie.export(:to=>MacTypes::FileURL.path('/path/to/middle
frame.pict'), :as=>:picture)
movie.close
You can tell QuickTime Player to open each file and export it as a
hinted movie. This is not really a Ruby matter, though certainly you
might use Ruby as a basis for sending the necessary Apple events. m.
···
Ari Brown <ari@aribrown.com> wrote:
Hey all
I read a previous post from early April about working applescript
into Ruby. BUT....
I need to be able to convert mp3s into hinted movie format (which
isn't covered ANYWHERE). Whats the best way to do this in any
applescript wrapper?
require 'appscript'
include Appscript
QTP = app('QuickTime Player.app')
# To export the middle frame of a movie file to a PICT file:
movie = QTP.open(MacTypes::Alias.path('/path/to/your movie.mov'))[0]
movie.current_time.set(movie.duration.get / 2)
movie.export(:to=>MacTypes::FileURL.path('/path/to/middle
frame.pict'), :as=>:picture)
movie.close
I saw that, and in fact that's what I'm using as my library. But I need to convert the file into Hinted Movie format. In quicktime, it's under File -> Export -> Hinted Movie
What would I write in ':as' if I wanted to do that? Or where could I get a list of possible file conversions for this?
aRi
--------------------------------------------|
If you're not living on the edge,
then you're just wasting space.
As I said, this is not a Ruby matter. You have to read the dictionary
(the AppleScript dictionary). m.
···
Ari Brown <ari@aribrown.com> wrote:
On Jul 9, 2007, at 11:33 PM, 12 34 wrote:
<snip>
> require 'appscript'
> include Appscript
> QTP = app('QuickTime Player.app')
>
> # To export the middle frame of a movie file to a PICT file:
> movie = QTP.open(MacTypes::Alias.path('/path/to/your movie.mov'))[0]
> movie.current_time.set(movie.duration.get / 2)
> movie.export(:to=>MacTypes::FileURL.path('/path/to/middle
> frame.pict'), :as=>:picture)
> movie.close
I saw that, and in fact that's what I'm using as my library. But I
need to convert the file into Hinted Movie format. In quicktime, it's
under File -> Export -> Hinted Movie
What would I write in ':as' if I wanted to do that? Or where could I
get a list of possible file conversions for this?
Hey, thanks for your help. I just have a quick question.
What does the 'MacTypes::Alias.path(infile))[0]' do?
movie = QTP.open(MacTypes::Alias.path(infile))[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I don't understand what the Alias
MacTypes::Alias.path(...) creates a new Alias object. The MacTypes
module is discussed in more detail in the appscript documentation.
and the [0] are doing.
QTP's 'open' command returns an array of references to the newly opened
movies, in this case [app('QuickTime Player').movies['some file']].
However, we just want the first item in that array so we call its #
method.
HTH
has
p.s. The equivalent line in AppleScript would read:
set theMovie to item 1 of (open alias "HD:path:to:your file.mp3")
except that AppleScript uses an HFS path string rather than a POSIX one
for legacy reasons.