I've written some simple code which interfaces with HandbrakeCLI to convert a video into a format that iTunes can handle. Once that has finished, I want it to be automatically added to iTunes.
From what I can tell from the iTunes SDK documentation, the following VBScript code should work:
Option Explicit
Dim oiTunes
Set oiTunes = CreateObject("iTunes.Application")
oiTunes.ConvertFile2("D:\Development\VBScript\converted-video.avi")
Set oiTunes = Nothing
Msgbox "Uploaded!"
However, upon running, the "Uploaded!" message appears but iTunes has not imported (or even started to import) any video file.
Can anyone suggest how I can get this working? In addition, if someone can show me how I can also determine whether or not it has finished the import (as I'd like to rename the meta-data once the import has finished) then I'd really appreciate it.
Following the useful pointer by AutomatedChaos, I offer the following working code sample:
Make sure that you can import the video file through the iTunes UI first, because if you can't then this will fail.
There is little point trying to put anything into the
Do .. Loop
as a 44 minute video is added on my (reasonably low specification) computer in about 2 seconds.