Champak Posted February 17, 2008 Share Posted February 17, 2008 (edited) I'm trying to get the user rating of an mp3 into the second column of my array, but it is casing an error with the object. Am I calling the userrating incorrectly? I know the array loop it self is working correctly because if you put a value in there, it will show up in the second column. How should I be calling it? Dim $aSource[$iTotal][2] Local $i $aSource[0][0] = $iTotal $aSource[1][0] = "";$oPlayer.PlaylistCollection.getbyname($sPlaylist).item(0).item($i).sourceurl $aSource[1][1] = "";22 For $i = 0 To $iTotal - 1 ; If @error Then ExitLoop $aSource[$i][0] = $oPlayer.PlaylistCollection.getbyname($sPlaylist).item(0).item($i).sourceurl $aSource[$i][1] = $oPlayer.PlaylistCollection.getbyname($sPlaylist).item(0).item($i).UserRating Next Edited February 17, 2008 by Champak Link to comment Share on other sites More sharing options...
therks Posted February 18, 2008 Share Posted February 18, 2008 D:\Rob\AutoIt\_Scraps\_scrap.au3(1,25) : WARNING: $iTotal: possibly used before declaration. Dim $aSource[$iTotal] ~~~~~~~~~~~~~~~~~~~~~~~~^ D:\Rob\AutoIt\_Scraps\_scrap.au3(8,75) : WARNING: $sPlaylist: possibly used before declaration. $aSource[$i][0] = $oPlayer.PlaylistCollection.getbyname($sPlaylist) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ D:\Rob\AutoIt\_Scraps\_scrap.au3(8,103) : WARNING: $oPlayer: possibly used before declaration. $aSource[$i][0] = $oPlayer.PlaylistCollection.getbyname($sPlaylist).item(0).item($i).sourceurl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~^ D:\Rob\AutoIt\_Scraps\_scrap.au3(1,25) : ERROR: $iTotal: undeclared global variable. Dim $aSource[$iTotal] ~~~~~~~~~~~~~~~~~~~~~~~~^ D:\Rob\AutoIt\_Scraps\_scrap.au3 - 1 error(s), 3 warning(s) Script doesn't work. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Champak Posted February 18, 2008 Author Share Posted February 18, 2008 I don't understand your post. I know it doesn't work, that is why I am requesting help. Link to comment Share on other sites More sharing options...
MHz Posted February 18, 2008 Share Posted February 18, 2008 (edited) I don't understand your post. I know it doesn't work, that is why I am requesting help.Au3Check is showing the errors ti fix. Always start with the 1st error and check again to see if you have corrected it. Your 1st error would be using a variable before declaration. $iTotal is your problem and you need to declare it within your script before you use it in the array declaration. Edit: Declare like this Dim $iTotal = 2 and watch the scope used with the variables when using Dim. @Saunders "Script doesn't work" fails understanding for most members. But the hint of direction using Au3Check was indeed good. Edited February 18, 2008 by MHz Link to comment Share on other sites More sharing options...
Champak Posted February 18, 2008 Author Share Posted February 18, 2008 Actually, he's getting that error because HE (no offense Saunders) didn't declare it. Probably my fault, I didn't post the whole code because I didn't think it was necessary in that I specifically couldn't get the ratings in the 2nd col; as stated in the first post, I can get a regular value, "dog" for instance, in the 2nd col. This actually comes before which takes care of the variable being declared. $iTotal = $oPlayer.PlaylistCollection.getbyname($sPlaylist).item(0).count The com error I'm getting is 80020006, although I don't believe that will be very useful. I believe it is specifically how I'm calling the ratings. So what now? And I don't understand what you mean: "and watch the scope used with the variables when using Dim" Thanks. Link to comment Share on other sites More sharing options...
MHz Posted February 18, 2008 Share Posted February 18, 2008 Actually, he's getting that error because HE (no offense Saunders) didn't declare it. Probably my fault, I didn't post the whole code because I didn't think...OIC. I guess Saunders and I were misled with the partial snip of code and what it represents as being an issue. I am not sure if I can help with what snips of code that I can see and hope someone can understand your issue.And I don't understand what you mean: "and watch the scope used with the variables when using Dim".Well, you are declaring an array with Dim and the next line you are using Local. If these lines are within a function then the array may take on Local scope unless the array variable is declared outside the function prior as Global scope. Thus the hint of warning about scope. Link to comment Share on other sites More sharing options...
therks Posted February 23, 2008 Share Posted February 23, 2008 I was just being a smart ass, which usually works better when I come back to the thread before a week has gone by.. preferably the next day, damn work taking up all my time. It's also hard to help when we only get snippets of code that don't work for us. Personally I had an issue with the fact that I don't have a clue where $oPlayer is coming from or what it is, and you specifically asked "Am I calling the userrating incorrectly? ... How should I be calling it?" like we actually knew what you were talking about. I can assume that it's an object of some sort, and based on what you're asking, that it's related to a media player.. of some sort. If I had to guess I'd say it's probably Windows Media Player, because it's rather common, but it could be Winamp, or Real Player (shudder) for all I know. I could probably do some research and figure it out based on some of the code you used, but in my experience providing the people you're asking for help with that kind of information up front is the best way to garner interest in your question and the best way to get results. I know most of the time if I don't understand what someone is asking because they left things vague or unexplained I will just overlook the thread, and a lot of other users do the same, and it's those topics whose first reply are from the author saying, "*bump* Anybody?"I guess what it boils down to is this: You did not give us (or at least me) enough information to make your question interesting enough to be worth answering, so I decided to be a cock about subtly suggesting you provide more information. Guess it didn't work. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Champak Posted February 27, 2008 Author Share Posted February 27, 2008 Finally figured the bloody thing out. I have to say, it is amazing that I couldn't find this example anywhere on the net for the past two weeks...even vb forums couldn't help. I just got fed up, sat down and went through a load of different string combinations and finally hit it; and it was one small thing. So this is it "getiteminfo": $aSource[$i][0] = $oPlayer1.PlaylistCollection.getbyname($sPlaylist).item(0).item($i).sourceurl $aSource[$i][1] = $oPlayer1.PlaylistCollection.getbyname($sPlaylist).item(0).item($i).getItemInfo("UserRating")oÝ÷ Ù&®×«°§uê쵩ÝÂÊëÊ)à"ØhºmÂ",µçpjǧ¢è!)î²z-²Öx-«HçyØ~Ö0úç-J¶)±§íz¸Z¾)à(^iÖî®'{ayÊyú+iÊ.¦W¡¢êìÝý±æ¬ÊÚ,*lyé¢ rºx¦¦íj{bú+«b¢x§¶¡×«fk&Þr»©péëzV²xê®zË^²©eË^*.j·¬¡úºÇ¢z'z«¶'.ªåwÊ,¢gg¬"ØbK(궩zez«yªÞ²ê^®f§Â§"Ç(¶«¦-²Ê%ºØ¨Æ«{b¦ºè®Øb0êÞlÛmébz÷§¢×§¢è!wèÁ«)jËt(ëbë-)䶶©®åzb7öhZ¾)à¬y¹Zµ©í*¾*.²Ú&¢·Æ«éÜyÚ^¢^²#ºËi¢Ëp«Hmébz÷¢²wz˯(î²×è®lÆéÜÈZ½ê'zj+zènW¦Â+a¶¬¦íè~Ø^±Êâ¦Ò'yçm¢¶¢YhÂ)à{aÊ®¢Ñh®«¨¶Z(¥«¢+Ø$%%]¥¹Ñ¥Ù ÅÕ½ÐíMÑÉÑMÁ±Í ÅÕ½Ðì¤Q¡¸($$$ÀÌØíMÑ ½Õ¹Ðô ½¹Ñɽ±MÑQáÐ ÀÌØíMÑÉÑMÁ±Í °ÅÕ½ÐìÅÕ½Ðì°ÀÌØíMÁ±Í¡1°Ä°ÅÕ½ÐíA±å±¥ÍÐÉɽȸÅÕ½ÐìµÀì I1µÀìÅÕ½Ðí ½Õ±¹½Ð¥¹ÁÉÙ¥½ÕÌÁ±å±¥Íи9½Ü±½¥¹ÌäìÅÕ½ÐìµÀìÀÌØíÍA±å±¥ÍеÀìÅÕ½ÐìÌäìèÅÕ½ÐìµÀìÀÌØí¤¬ÄµÀìÅÕ½Ðì½ÅÕ½ÐìµÀìÀÌØí¥Q½Ñ°¤($%±Í($$$ÀÌØíMÑ ½Õ¹Ðô ½¹Ñɽ±MÑQáÐ ÀÌØíÁÁQ¥Ñ±°ÅÕ½ÐíA±ä½AÕÍÅÕ½Ðì°ÀÌØí]5A}M½¹%¹¼°ÅÕ½Ðí1½¥¹M½¹ÌèÅÕ½ÐìµÀì I1µÀìÀÌØíÍA±å±¥ÍеÀìÅÕ½ÐìÌäìÅÕ½ÐìµÀì I1µÀìÀÌØí¤¬ÄµÀìÅÕ½Ðì½ÅÕ½ÐìµÀìÀÌØí¥Q½Ñ°¤($%¹% I hope that's detailed.... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now