{"id":67523,"date":"2006-04-17T16:15:00","date_gmt":"2006-04-17T16:15:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2006\/04\/17\/how-can-i-change-the-title-property-of-a-wma-file\/"},"modified":"2006-04-17T16:15:00","modified_gmt":"2006-04-17T16:15:00","slug":"how-can-i-change-the-title-property-of-a-wma-file","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-change-the-title-property-of-a-wma-file\/","title":{"rendered":"How Can I Change the Title Property of a .WMA File?"},"content":{"rendered":"<p><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\"> \n<P>Hey, Scripting Guy! How can I change the Title property of a .WMA file?<BR><BR>&#8212; LL<\/P><IMG border=\"0\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" height=\"5\"><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\"><A href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><IMG class=\"farGraphic\" title=\"Script Center\" border=\"0\" alt=\"Script Center\" align=\"right\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" height=\"288\"><\/A> \n<P>Hey, LL. Here\u2019s a piece of trivia for you. Originally, the Beatles\u2019 classic <I>Yesterday<\/I> was titled <I>Scrambled Eggs<\/I>. (Start singing the song, but instead of singing \u201cYesterday\u201d sing \u201cScrambled eggs.\u201d) Before the group recorded the song, however, Paul wrote some lyrics and, in the process, changed the name as well. The rest, as they say, is history.<\/P>\n<P>No doubt your next question is this: did Paul McCartney use a script to change the title of <I>Scrambled Eggs<\/I>? To tell you the truth, we don\u2019t know; we always mean to ask Paul that, but every time we get together it seems like something comes up and we forget to ask. However, there\u2019s no doubt that he <I>could<\/I> have used a script like this one to change the title:<\/P><PRE class=\"codeSample\">Set objPlayer = CreateObject(&#8220;WMPlayer.OCX&#8221; )<\/p>\n<p>Set objMediaCollection = objPlayer.MediaCollection\nSet objTempList = objMediaCollection.getByName(&#8220;Scrambled Eggs&#8221;)<\/p>\n<p>Set objSong = objTempList.Item(0)\nobjSong.setItemInfo &#8220;Name&#8221;, &#8220;Yesterday&#8221;\n<\/PRE>\n<P>Before we go any further we should point out that this script changes the song title only as far as Windows Media Player is concerned. When you view your song list in Windows Media Player the song formerly known as <I>Scrambled Eggs<\/I> will now appear as <I>Yesterday<\/I>. However, this script doesn\u2019t change the .WMA file itself: the file name remains as-is, and if you right-click the file and look at the <B>Summary Properties<\/B> the title will still show up as <I>Scrambled Eggs<\/I>. Unfortunately, we don\u2019t know of any way to change the Title property of the file itself; the best we can do is change the way the song title appears in Windows Media Player.<\/P>\n<TABLE id=\"EWD\" class=\"dataTable\" cellSpacing=\"0\" cellPadding=\"0\">\n<THEAD><\/THEAD>\n<TBODY>\n<TR class=\"record\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\"><B>Note<\/B>. What\u2019s that? You didn\u2019t even <I>know<\/I> that you could script Windows Media Player? You guys haven\u2019t been to <A href=\"http:\/\/null\/technet\/scriptcenter\/funzone\/default.mspx\"><B>Dr. Scripto\u2019s Fun Zone<\/B><\/A> have you?<\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<DIV class=\"dataTableBottomMargin\"><\/DIV>\n<P>If you\u2019re OK with just changing the song as it appears in Windows Media Player, well then, read on. As you can see, our script begins by creating an instance of the <B>WMPlayer.OCX<\/B> object; this is simply the object that provides programmatic access to Windows Media Player. We then use these two lines of code to bind to the Windows Media Player media collection and to return a list of all the songs that have the title <I>Scrambled Eggs<\/I>:<\/P><PRE class=\"codeSample\">Set objMediaCollection = objPlayer.MediaCollection\nSet objTempList = objMediaCollection.getByName(&#8220;Scrambled Eggs&#8221;)\n<\/PRE>\n<P>And yes, we do need to return a collection: that\u2019s because Windows Media Player actually allows you to have multiple songs with the same title. We\u2019re going to assume that you\u2019ve given all your songs unique titles; that enables us to take a little bit of a shortcut when binding to the song and changing your title. If you <I>do<\/I> have multiple songs with the title <I>Scrambled Eggs<\/I> then you can use this modified script to change the title for each of those songs:<\/P><PRE class=\"codeSample\">Set objPlayer = CreateObject(&#8220;WMPlayer.OCX&#8221; )<\/p>\n<p>Set objMediaCollection = objPlayer.MediaCollection\nSet objTempList = objMediaCollection.getByName(&#8220;Scrambled Eggs&#8221;)<\/p>\n<p>For i = 0 to objTempList.Count &#8211; 1\n    Set objSong = objTempList.Item(i)\n    objSong.setItemInfo &#8220;Name&#8221;, &#8220;Yesterday&#8221;\nNext\n<\/PRE>\n<P>Now, back to the script that assumes you have only one song named <I>Scrambled Eggs<\/I>. If that\u2019s the case then we need only this line of code to bind directly to the single song with that title (completely bypassing the For Next loop we had to use in the preceding script):<\/P><PRE class=\"codeSample\">Set objSong = objTempList.Item(0)\n<\/PRE>\n<P>Once we\u2019ve made the connection, changing the title is as simple as using the <B>setItemInfo<\/B> method to change the song <B>Name<\/B> to <I>Yesterday<\/I>:<\/P><PRE class=\"codeSample\">objSong.setItemInfo &#8220;Name&#8221;, &#8220;Yesterday&#8221;\n<\/PRE>\n<P>The rest, as they say, is history.<\/P>\n<P>Incidentally, the Scripting Guys also like the name <I>Scrambled Eggs<\/I> better; if nothing else, it goes nicely with the song <I>I Am the Walrus <\/I>(\u201cI am the egg man, they are the egg men\u201d). But the Beatles never asked the Scripting Guys for their opinion on this one. We just hope things worked out OK for them even without our help.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I change the Title property of a .WMA file?&#8212; LL Hey, LL. Here\u2019s a piece of trivia for you. Originally, the Beatles\u2019 classic Yesterday was titled Scrambled Eggs. (Start singing the song, but instead of singing \u201cYesterday\u201d sing \u201cScrambled eggs.\u201d) Before the group recorded the song, however, Paul wrote some [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[123,3,5,192],"class_list":["post-67523","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-multimedia","tag-scripting-guy","tag-vbscript","tag-windows-media-player-and-audio"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! How can I change the Title property of a .WMA file?&#8212; LL Hey, LL. Here\u2019s a piece of trivia for you. Originally, the Beatles\u2019 classic Yesterday was titled Scrambled Eggs. (Start singing the song, but instead of singing \u201cYesterday\u201d sing \u201cScrambled eggs.\u201d) Before the group recorded the song, however, Paul wrote some [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/67523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=67523"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/67523\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=67523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=67523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=67523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}