Page 1 of 3
NowPlaying.vbs / NowPlayingConf.vbs (Updated 01/23/2006)
Posted: Mon Dec 12, 2005 3:12 am
by margu
Hello,
I've the above problem and am not able to find a solution, because I'm not a programmer.
I wrote a script for my needs to have a textfile with several info about the now playing song written. It uses a loop because I wanted to have the players state (stop or pause) in the textfile either.
But while it runs I neither can use my remote nor any hotkeys.
I will be very happy if someone of you script-gods can help me
Posted: Mon Dec 12, 2005 3:18 am
by onkel_enno
I think each time the second script is started, mm becomes inactive and so no hotkey will work.
Posted: Mon Dec 12, 2005 3:37 am
by margu
onkel_enno wrote:I think each time the second script is started, mm becomes inactive and so no hotkey will work.
Yeah, maybe. I noticed another thing now: while playing a song and I use "Next" or "Prev" at the player, the selected track in playlist don't change until i do a click on the window or do a manual refresh.
If the song is played until the end and MM switch to the next song all is ok. I think this is because the main script restarts then. Darn

Posted: Mon Dec 12, 2005 4:26 am
by trixmoto
Surely this line is a typo:
You have not defined
oRating. Using the following line at the top of your script will highlight these problems:
The problem you are having with your hotkeys is to do with focus. MM needs to be focused for them to work.
ADDITION: Your .ini entry has
[InlineLyrics] as the key, you should change this to your
[NowPlaying] 
Posted: Mon Dec 12, 2005 4:36 am
by trixmoto
margu wrote:Code: Select all
If isPause = TRUE Then
Status = " (paused)"
x = 1
ElseIf isPause = FALSE And isPlay = FALSE Then
Status = " (stopped)"
x = 0
ElseIf isPlay = TRUE Then
x = 1
End If
What you have written works, but it
could be streamlined thus:
Code: Select all
x = 1
If isPlay = False Then
Status = " (stopped)"
x = 0
ElseIf isPause Then
Status = " (paused)"
End If
(This works because
isPlay is true when the player is paused as well)
Looks like you're doing a pretty good job considering you're...
margu wrote:not a programmer

Posted: Mon Dec 12, 2005 4:44 am
by margu
trixmoto wrote:Surely this line is a typo:
You have not defined
oRating. Using the following line at the top of your script will highlight these problems:
Thanks, this is only in my working copy and not in my script I use

I changed this.
trixmoto wrote:The problem you are having with your hotkeys is to do with focus. MM needs to be focused for them to work.
And there isn't any posibility to work around it?
After some more testing I ran into much more problems. Any other scipts work neither
trixmoto wrote:ADDITION: Your .ini entry has
[InlineLyrics] as the key, you should change this to your
[NowPlaying] 
Like above. Only the description has this "typo".
As you can see I took a deep look into your script and got some hints for doing my script

Posted: Mon Dec 12, 2005 4:47 am
by margu
trixmoto wrote:
What you have written works, but it
could be streamlined thus:
Code: Select all
x = 1
If isPlay = False Then
Status = " (stopped)"
x = 0
ElseIf isPause Then
Status = " (paused)"
End If
(This works because
isPlay is true when the player is paused as well)
Looks like you're doing a pretty good job considering you're...
margu wrote:not a programmer

Oh, this is fine, thanks.
Well "not a programmer" isn't really correct, because I did much more work on Perl but nothing in VBS before, so maybe my understanding is a bit skilled

Posted: Mon Dec 12, 2005 5:50 am
by Steegy
If the problem is a "focus" thing, can't you change the behaviour then by using other parameters for the WShell.Run method?
See
http://msdn.microsoft.com/library/defau ... mthrun.asp
for intWindowStyle:
The active window remains active.
Cheers
Steegy
Posted: Mon Dec 12, 2005 6:13 am
by margu
Woohoo
You made my day! I played a while with the parameters and now it works with following line
I either tried with 7 instead of 8 but this didn't work.
Thank you alot Steegy, you are
So, and now for all people who are interested, the fixed and cleand up code again:
If there is something going wrong: ask me
..::Margu::..
Posted: Mon Dec 12, 2005 6:51 am
by trixmoto
I did recognise some of my code (before the InlineLyrics bit which definitely gave it away!) - it's no problem, that's how we learn!
The script looks good. I believe you can now officially call yourself a VBScript programmer!

NowPlaying Script (Update)
Posted: Mon Dec 12, 2005 10:40 am
by margu
Hello,
above started and with perfect help fixed, I wanted to release my script and will try to update it time by time (if I have enough time to work on it

)
I did some changes on usability so user can define which of the additional information are to be shown in the textfile. For now only the 2nd line can be modified by changing the settings in the NowPlaying.vbs
I hope you enjoy this first script release of mine
Posted: Tue Dec 13, 2005 5:46 am
by trixmoto
It's worth editing earlier posts to remove old versions of the code - otherwise people will get very confused and end up with the wrong version. I always replace mine with a note saying "NEW CODE BELOW".
Posted: Tue Dec 13, 2005 6:01 am
by margu
trixmoto wrote:It's worth editing earlier posts to remove old versions of the code - otherwise people will get very confused and end up with the wrong version.
You are right trixmoto, and I'm always willed to learn

and did the changes.
Thanks
..::Margu::..
Posted: Thu Dec 15, 2005 3:00 pm
by popper
This is a really cool script. I've been using the first version for some time now and it always bugged me that I had to manually start the script to get the correct song in my .sig.
One small thing though:
LoopScript = SDB.ApplicationPath&"Scripts\playing2.vbs"
should probably read instead:
LoopScript = SDB.ApplicationPath&"Scripts\NowPlaying2.vbs"
Oh, and while I am at it, two questions:
- would it be possible to only write to the file if the song has changed? Right now, it just writes every 10 sec or so which is probably unnecessary.
- where has the album information gone? ("now playing: x - y from z")
EDIT:
I'm referring to this "old version" of the NowPlaying script that I have been using:
http://www.mediamonkey.com/forum/viewtopic.php?t=5404
Perhaps you can use the "album name" routine that has been implemented there.
--
listening: Oasis - Dont Look Back In Anger
my rating: 2,5 of 5 stars / MediaPlayer: MediaMonkey 2.5.1
Posted: Thu Dec 15, 2005 5:55 pm
by margu
popper wrote:This is a really cool script. I've been using the first version for some time now and it always bugged me that I had to manually start the script to get the correct song in my .sig.
One small thing though:
LoopScript = SDB.ApplicationPath&"Scripts\playing2.vbs"
should probably read instead:
LoopScript = SDB.ApplicationPath&"Scripts\NowPlaying2.vbs"
Oh, you're right. I didn't check when I changed it from my working copy
popper wrote:Oh, and while I am at it, two questions:
- would it be possible to only write to the file if the song has changed? Right now, it just writes every 10 sec or so which is probably unnecessary.
- where has the album information gone? ("now playing: x - y from z")
In the new (beta) version of my script that I'll post below, I implemented the possibility to choose if the script only will run once or in a loop.
For the album information I only use rude AlbumName for now. But I'm working to implement such an AlbumArtist/AlbumName function like in the other script you referred below.
popper wrote:EDIT:
I'm referring to this "old version" of the NowPlaying script that I have been using:
http://www.mediamonkey.com/forum/viewtopic.php?t=5404
Perhaps you can use the "album name" routine that has been implemented there.
--
listening: Oasis - Dont Look Back In Anger
my rating: 2,5 of 5 stars / MediaPlayer: MediaMonkey 2.5.1