Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Newbie scripter getting stuck in!

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,48330
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Newbie scripter getting stuck in!
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Newbie scripter getting stuck in! - 6/15/2007 4:52:37 AM   
  TerribleToll

 

Posts: 5
Score: 0
Joined: 6/14/2007
Status: offline
Hi. I', new to VBScript, but not new to programming, so this is probably even harder on me.

I have a challenge creating a script to transfer a folder of songs to the iTunes music application and drop into a playlist.

I have the script as follows:


      

The code works ... well sort of. It copies the first song into iTunes and then sticks it in the playlist, but then in trips up over itself as it hasn't finished loading the first song when it tries for the next one.

Firstly, big apologies for the crap coding, I have cobbled this together from a bunch of different scripts and frankly, it's amazing that it works at all.

Any hints, help or just plain abuse would be much appreciated.

thanks - Anatole

_____________________________

Anatole Beams
Anatole Beams Digital Media
 
 
Post #: 1
 
 RE: Newbie scripter getting stuck in! - 6/15/2007 5:07:34 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
Do you have any good resources on the properties of the Itunes object?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to TerribleToll)
 
 
Post #: 2
 
 RE: Newbie scripter getting stuck in! - 6/15/2007 5:13:24 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
Ok, I did some research and the ITunes.Application object has a .COnvertOperationStatus property. You may want to look at that as a way to wait until the conversion is done.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Newbie scripter getting stuck in! - 6/15/2007 9:12:52 AM   
  TerribleToll

 

Posts: 5
Score: 0
Joined: 6/14/2007
Status: offline
OK - thanks for that. I'll look into it. Any ideas what I might do with it? It took me all day to write the stuff I have got.

My sources so far have been the Apple Windows SDK for iTunes, which has been pretty useless and incomprehensible. The best hints have been in an article in the Microsoft resources http://www.microsoft.com/technet/scriptcenter/funzone/tunes.mspx

Thanks for the reply and I'll be on the case over the weekend.

cheers - Anatole

_____________________________

Anatole Beams
Anatole Beams Digital Media

(in reply to ebgreen)
 
 
Post #: 4
 
 RE: Newbie scripter getting stuck in! - 6/15/2007 12:40:49 PM   
  dm_4ever


Posts: 2726
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
See how this works for you...


      

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to TerribleToll)
 
 
Post #: 5
 
 RE: Newbie scripter getting stuck in! - 6/15/2007 6:52:38 PM   
  TerribleToll

 

Posts: 5
Score: 0
Joined: 6/14/2007
Status: offline
That's superb - thanks for the help there.

Although it is supremely annoying when you have a large list of songs to convert (it plays the first song and bongs on every subsequent import).

There is another command called "iTunesApp.ConvertFiles2(objItem)" which I was hoping would convert a block of files in one hit. However, I only seem to get 'object errors' when I try to use it and take the loop out. I am sure that this is down to my ignorance in VBS coding. I'll drop in an example shortly, so you can see what I am trying to do.

Thanks hugely again for the help - at least it now works.

Anatole

_____________________________

Anatole Beams
Anatole Beams Digital Media

(in reply to dm_4ever)
 
 
Post #: 6
 
 RE: Newbie scripter getting stuck in! - 6/15/2007 8:38:59 PM   
  TerribleToll

 

Posts: 5
Score: 0
Joined: 6/14/2007
Status: offline
In the iTunes resource at http://cuzic.net/iTunesLib/classes/IiTunes.html they give the following descriptions for the ConvertFile functions:

ConvertFile(filePath)
Start converting the specified file path. return iStatus (IITOperationStatus)

ConvertFile2(filePath)
Start converting the specified file path. return iStatus (IITConvertOperationStatus)

ConvertFiles(filePaths)
Start converting the specified array of file paths. filePaths can be of type VT_ARRAY|VT_VARIANT, where each entry is a VT_BSTR, or VT_ARRAY|VT_BSTR. You can also pass a JScript Array object. return iStatus (IITOperationStatus)

ConvertFiles2(filePaths)
Start converting the specified array of file paths. filePaths can be of type VT_ARRAY|VT_VARIANT, where each entry is a VT_BSTR, or VT_ARRAY|VT_BSTR. You can also pass a JScript Array object. return iStatus (IITConvertOperationStatus)

So i have applied it in the following way:


      

However, all this manages to illicit is an 'Object doesn't support this property or method' error. I guess my array is wrong!

Anatole

_____________________________

Anatole Beams
Anatole Beams Digital Media

(in reply to TerribleToll)
 
 
Post #: 7
 
 RE: Newbie scripter getting stuck in! - 6/16/2007 4:56:55 AM   
  dm_4ever


Posts: 2726
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
I did see the ConvertFiles2 method while playing with this.  Try this...unfortunately I'm not sure how to keep it from playing, but a simple .stop will stop it right away and using the ConvertFiles2 method you won't hear a "bong" after each new song is added.


      

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to TerribleToll)
 
 
Post #: 8
 
 RE: Newbie scripter getting stuck in! - 6/17/2007 7:11:58 AM   
  TerribleToll

 

Posts: 5
Score: 0
Joined: 6/14/2007
Status: offline
Thanks again for this. You have been seriously helpful, although it has certainly shown up some limitations of my VBscripting.

I can see what you have done in creating the array of music paths, but I get an error on the loading up of the playlist. Presumably because it hasn't waited for all the tunes to be loaded up into iTunes.

'Invalid procedure call or argument.'

Anyway, I'll probably manage to cope and I'll put the finished script up when I have it working fully.

javascript:void(AddText('[8\|]'))

_____________________________

Anatole Beams
Anatole Beams Digital Media

(in reply to dm_4ever)
 
 
Post #: 9
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Newbie scripter getting stuck in! Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts