Jump to content

I want to write a windows based script for itunes, however I have never written a script or know ...


G+_Travis Decker
 Share

Recommended Posts

I want to write a windows based script for itunes, however I have never written a script or know how to run one.  Can someone give me some pointers?

 

Simple script:  At X time, open itunes movie list, where kind = "Protected MPEG-4 video file" individually select the first file, choose "get info" then "Okay", then move to the next file and repeat.  

 

I have set custom genre's on my purchased video files and apple keeps overwriting them, so I thought a automated script would be a useful work around for those dealing with this issue. 

 

Any help is appreciated!!

Link to comment
Share on other sites

so wait...What do you mean by "open iTunes?"  the site or the program?  If you mean the site, yes, JS might be a good choice.  If you mean the program, AutoIt would be a far better choice. (It's made for controlling other programs.)  In fact, I'm not quite sure how Nicholas Glenn would use JavaScript or SQL Server to do ANY of that.  (But that's mainly due to my lack of familiarity w/ SQL Server.) As for doing something regularly, or at a specified time, the Task Scheduler service is the facility on Windows which very typically does that.?

Link to comment
Share on other sites

SQL Server and JavaScript could both be used to open either the Web link or the actual program of iTunes Joe Philipps . I do this at work on a daily basis (just not for iTunes). SQL Server has a functionality built in much like Tasker for your phone which allows you to automate the process and run certain processes at a specified time on whichever days you would pick. JavaScript would be used to write the actual function that would check to see if the genre has been changed or not. In this case though, since Travis Decker  is looking at a detail (property) of the files he has, you wouldn't actually need to open iTunes (even though you could if you wanted). You would want to look at the properties of the file in the directory they are being stored and use a simple if/else statement in JavaScript to see if the property has been changed or not.

 

I'm sure there are multiple ways a person could do this, but this is just one example of how this could be done, and it is the most familiar to me as it is what I do everyday at work. I'm not sure that SQL Server is a free program though, so another program may be needed to automate the task if your looking to go the free route.

Link to comment
Share on other sites

You could have a look at AutoHotKey (http://l.autohotkey.net/), this can do simple things like simulating mouse/keyboard actions based on timing and coordinates and in a more advanced mode, check the status of windows, control windows objects (buttons, etc). For help check the Autohotkey forum at http://www.autohotkey.com/board/

Link to comment
Share on other sites

SQL Server, to my knowledge, is not free.  It starts out at about $300 for one version behind (2008), with a "developer's edition" for about $45.  In fact, most pricing you will see (a Google search) start at around $1500 for the current product and go all the way up to ten or so thousand dollars for the current (2012) enterprise product.  I just don't see the need to buy anything for that purpose when the ability to launch programs on a schedule is built into the Task Scheduler, which comes with Windows.  I mean, if this gives the user some gain, some better functionality, I'm all eyes (instead of ears).

 

I'm also with Vincent Tompkins ; JavaScript needs an interpreter (or at the very least a compiler), and the one most people encounter is part and parcel of a Web browser.  In that sense, AFAIK, you would need a browser capable of injecting your code into the iTunes page, such as Opera, Chrome, or Firefox+Greasemonkey.  I just can't foresee how JS will help you much.  Maybe SQL Server provides that interpreter.

 

Something like AutoIt (which has its own BASIC-like scripting language) or as Robert Ilbrink mentions, AutoHotKey, might be more suited to your task.  AutoIt can control a program (such as iTunes) and simulate clicks and keystrokes.  It even has a compiler which can produce an executable (which you then could in turn presumably launch from Task Scheduler).  Just sayin', my advice is to start out with one of these click-n-keystroke-injector programs, like AutoHotKey or AutoIt, and if that won't do what you need it to do, maybe Nicholas Glenn can clue us all in on how to use JS to do it instead.

 

I might add, I don't use iTunes, so I'm just writing theoretically.  I must say, I didn't like the UI much.  I've only bought one song through it, and basically haven't returned to it.

Link to comment
Share on other sites

Yeah the macro program is fun, but iTunes being iTunes named all of the popup menu windows and main window "iTunes" so the really nice feature of the macro program that can recognize when a window loads and disappears doesn't work, so the macro has to allow for inconsistent window load times and be all timing based.

Link to comment
Share on other sites

 Share

×
×
  • Create New...