NowPlaying.vbs / NowPlayingConf.vbs (Updated 01/23/2006)

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

NowPlaying.vbs / NowPlayingConf.vbs (Updated 01/23/2006)

Postby margu » Mon Dec 12, 2005 3:12 am

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 :-)

Code: Select all
New Code below
Last edited by margu on Mon Jan 23, 2006 1:05 pm, edited 10 times in total.
margu
 
Posts: 53
Joined: Thu Feb 03, 2005 3:43 am
Location: Rheinberg, Germany

Postby onkel_enno » Mon Dec 12, 2005 3:18 am

I think each time the second script is started, mm becomes inactive and so no hotkey will work.
SansaMonkey - for SanDisk Sansa and Rockbox Users

Please no PMs for Questions which should be asked in the Forum. Thx
onkel_enno
 
Posts: 2145
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany

Postby margu » Mon Dec 12, 2005 3:37 am

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 :-(
margu
 
Posts: 53
Joined: Thu Feb 03, 2005 3:43 am
Location: Rheinberg, Germany

Postby trixmoto » Mon Dec 12, 2005 4:26 am

Surely this line is a typo:
margu wrote:
Code: Select all
Rating = oRating & " of 5 stars"

You have not defined oRating. Using the following line at the top of your script will highlight these problems:
Code: Select all
Option Explicit

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] :)
Last edited by trixmoto on Mon Dec 12, 2005 4:37 am, edited 2 times in total.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby trixmoto » Mon Dec 12, 2005 4:36 am

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
:)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby margu » Mon Dec 12, 2005 4:44 am

trixmoto wrote:Surely this line is a typo:
Code: Select all
Rating = oRating & " of 5 stars"

You have not defined oRating. Using the following line at the top of your script will highlight these problems:
Code: Select all
Option Explicit

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 :-)
margu
 
Posts: 53
Joined: Thu Feb 03, 2005 3:43 am
Location: Rheinberg, Germany

Postby margu » Mon Dec 12, 2005 4:47 am

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 :-)
margu
 
Posts: 53
Joined: Thu Feb 03, 2005 3:43 am
Location: Rheinberg, Germany

Postby Steegy » Mon Dec 12, 2005 5:50 am

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/default.asp?url=/library/en-us/script56/html/wsmthrun.asp
for intWindowStyle:
The active window remains active.


Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Steegy
 
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium

Postby margu » Mon Dec 12, 2005 6:13 am

Steegy wrote: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/default.asp?url=/library/en-us/script56/html/wsmthrun.asp
for intWindowStyle:
The active window remains active.


Cheers
Steegy

Woohoo :lol:
You made my day! I played a while with the parameters and now it works with following line
Code: Select all
    res = WShell.Run(command, 8, 0)

I either tried with 7 instead of 8 but this didn't work.

Thank you alot Steegy, you are 8) :-)

So, and now for all people who are interested, the fixed and cleand up code again:

Code: Select all
New Code below


If there is something going wrong: ask me :-)

..::Margu::..
Last edited by margu on Tue Dec 13, 2005 5:59 am, edited 1 time in total.
margu
 
Posts: 53
Joined: Thu Feb 03, 2005 3:43 am
Location: Rheinberg, Germany

Postby trixmoto » Mon Dec 12, 2005 6:51 am

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! :D
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

NowPlaying Script (Update)

Postby margu » Mon Dec 12, 2005 10:40 am

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 :)

Code: Select all
New code below
Last edited by margu on Thu Dec 15, 2005 6:02 pm, edited 1 time in total.
margu
 
Posts: 53
Joined: Thu Feb 03, 2005 3:43 am
Location: Rheinberg, Germany

Postby trixmoto » Tue Dec 13, 2005 5:46 am

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".
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Send me BTC: 34VQPVsf9mCeR4nfhFvvBYZqQ7LkqNZ8Mn
Send me LTC: 3P1mzrfbyscdhbxRpXLgKz7tufGAU3SrEG
Send me DOGE: 9xPpYSqgF7P5yQiqvE1VqWb4UjxVCCLFJ6
Check out these great cryptocurrency faucets... BTC / LTC / DOGE
trixmoto
 
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Barton, UK

Postby margu » Tue Dec 13, 2005 6:01 am

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 :wink: and did the changes.

Thanks
..::Margu::..
margu
 
Posts: 53
Joined: Thu Feb 03, 2005 3:43 am
Location: Rheinberg, Germany

Postby popper » Thu Dec 15, 2005 3:00 pm

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
popper
 
Posts: 34
Joined: Mon Feb 21, 2005 5:10 pm
Location: Germany

Postby margu » Thu Dec 15, 2005 5:55 pm

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
margu
 
Posts: 53
Joined: Thu Feb 03, 2005 3:43 am
Location: Rheinberg, Germany

Next

Return to Need Help with Addons?

Who is online

Users browsing this forum: Google [Bot] and 16 guests