From: Tom Lavedas on
On Oct 27, 6:12 pm, tonysathre <tonysat...(a)gmail.com> wrote:
> Thanks a lot for the suggestions. I have already tried removing the
> following, with no luck:
>
> > Dim vers
> > vers = iTunesApp.Version
> > Dim Reg1
> > Set Reg1 = new RegExp
> > Reg1.Pattern = "^7"
> > if Reg1.Test(vers) Then
> > ' yay
> > Else
> > Wscript.Echo "This script requires iTunes 7"
> > Wscript.Quit
> > End If
>
> I have also tried changing this part: Reg1.Pattern = "^7" to 9, but it
> didn't work either. Below is the error I get when running it with, or
> without those changes.
>
> (67, 1) Microsoft VBScript runtime error: ActiveX component can't
> create object: 'iTunes.Application.1'
>
> Thanks,
>
> Tony

You need to open the registry and search for iTunes and check for the
current version (the final number) to see if it has changed. Or you
can just try removing the number. That often, but no always, works.
________________
Tom Lavedas
From: Alexander Mueller on
tonysathre schrieb:
> Thanks a lot for the suggestions. I have already tried removing the
> following, with no luck:
>
>> Dim vers
>> vers = iTunesApp.Version
>> Dim Reg1
>> Set Reg1 = new RegExp
>> Reg1.Pattern = "^7"
>> if Reg1.Test(vers) Then
>> ' yay
>> Else
>> Wscript.Echo "This script requires iTunes 7"
>> Wscript.Quit
>> End If
>
> I have also tried changing this part: Reg1.Pattern = "^7" to 9, but it
> didn't work either. Below is the error I get when running it with, or
> without those changes.
>
> (67, 1) Microsoft VBScript runtime error: ActiveX component can't
> create object: 'iTunes.Application.1'

Better use the version-independent ProgID, e.g.
'iTunes.Application'. If this still doesn't work then
ITunes isn't probably properly installed (or at least its COM-part)

As for the version check, the version-string returns sth like:
'8.1.0.52' (major.minor.revision.build), so you need the digits
before the first dot, which will be 2 digits soon, starting with
iTunes 10. If RegExp is the choice, a better pattern and numeric
check was:

Set Reg1 = new RegExp
Reg1.Pattern = "^(\d+?)\..+$"
Dim majorVer
majorVer = Reg1.Replace(iTunesApp.Version, "$1")
If Not IsNumeric(majorVer) Then
WSH.Echo "Error detecting iTunes-version"
WSH.Quit
ElseIf CInt(majorVer) < 7 Then
WSH.Echo "This scripts requires iTunes 7 or higher"
WSH.Quit
'Else 'Version OK
End If


HTH,
Alex