Page 1 of 38

Custom Report 3.2 - Updated 29/07/2014

Posted: Sat Jun 16, 2007 7:20 pm
by trixmoto
This script allows the user to define their own reports. First choose the format and filename of the report. Then add columns and order them as you please. You can define the column headings and also format the data as you please.

The field formats can be separated with spaces to apply multiple formats to one field. For example, to surround a value with brackets use the format P( S).

As always to installer is available from my website. :)

Code: Select all

'
' MediaMonkey Script
'
' NAME: CustomReport 3.2
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 29/07/2014
'
' INSTALL: Copy to Scripts directory and add the following to Scripts.ini 
'          Don't forget to remove comments (') and set the order appropriately
'
' [CustomReport]
' FileName=CustomReport.vbs
' ProcName=CustomReport
' Order=50
' DisplayName=Custom Report
' Description=Custom Report
' Language=VBScript
' ScriptType=1
'
' FORMAT:
'   Add: A1 - "1" becomes "2"
'   Newline char: C*** - Newline character
'   Divide: D100 - "1" becomes "0.01"
'   Extract: E()2 - "A B C" becomes "B"
'   Format date: Fd/m/Y - "30th Oct 2009" becomes "30/10/2009" - http://uk.php.net/manual/en/function.date.php
'   Hyperlink: H... - Create link in HTML
'   Hyperlink: I... - Create link in HTML using mask 
'   Justify: JL for left, JR for right, JC for centre
'   Lowercase: L - "Word" becomes "word"
'   Multiply: M100 - "1" becomes "100"
'   Number: N2 - "1" becomes "1.00"
'   Prefix: P( - "Word" becomes "(Word"
'   Replace: R1=One - "1" becomes "One"
'   Suffix: S) - "Word" becomes "Word)"
'   Title case: T - "WORD" becomes "Word"
'   Uppercase: U - "Word" becomes "WORD"
'   Width: W25% - Column width in HTML/Excel
'   Leading zeros: Z2 - "1" becomes "01"
'   Traverse: \1 - "C:\Music\Test.mp3" becomes "Music\Test.mp3"
'
' FIXES: Fixed SongLengthString back to unformatted value
'        Added SongLengthTime and SongLengthLocal with formatted values
'
(Exceeds 60,000 characters)

Posted: Sat Jun 16, 2007 7:36 pm
by Eyal
Hi Trixmoto, it's worth a try, it looks very interresting.

Question:
If Number: N2 - "1" becomes "1.00"

Is there a way to Number: X2 - "1" becomes "01" ?
Useful to have track numbers aligned in HTML or text format.


Thanks

Posted: Sat Jun 16, 2007 9:26 pm
by Eyal
I did some report tests in HTML format.
Here's what I did:
Image

Here's what I got:
Image

Apart the apostrophe, what can be done about song lenghts? The first song is 213 seconds long, or 3:33.
Also, it will be great to have the choice of generate a TXT format of the report.

Thanks

Posted: Sun Jun 17, 2007 2:32 am
by Bex
Impressive!

Cool script

Posted: Sun Jun 17, 2007 3:17 am
by Maaspuck
indeed, fantastic script!

@Eyal
i tested the html report and it worked fine with the apostrophe and also with all german special characters. Did I understand it right and you want the length 3:33 to be displayed instead of 213472? If yes, you may choose the tag "SongLengthString" instead of "SongLength".

BTW: I also like music by Sylvester and Patrick Cowley.

Maaspuck

Posted: Sun Jun 17, 2007 8:02 am
by Eyal
Thanks Maaspuck, that was it. I don't know why I have just overlooked it.

I don't know if I'm the only one, but I also get a IE warning each time:
"To help protect your security, your web browser has restricted this file from showing active content that could access your computer. Click here for options..."
It works with all other french characters, I tried different IE encoding options, but I can't get that apostrophe to display... :(

Posted: Sun Jun 17, 2007 3:36 pm
by trixmoto
@Eyal - I'll add a new format in the next version (probably Z) for adding leading zeros, and TXT file type. The apostrophe is deliberately encoded this way, which your browser should understand (which browser are you using?) but you can remove line 656 which does this if you like.

@Bex - Thanks :)

@Masspuck - Yes, this field is already formatted correctly, removing the need to try and format the raw value.

Posted: Mon Jun 18, 2007 5:32 am
by trixmoto
New version (1.1) is now available from my website. Changes include...

- Added new field format Z to control leading zeros
- Added new field format A to allow addition
- Added new file type of TXT (textfile)
- Fixed headings not applied to file type XML

Let me know what you think! :)

Posted: Wed Jul 18, 2007 2:19 am
by paulmt
This script looks very good and exactly what I was looking for.

However I get an error on running after new install.

Line 457 Col. 6 - which is...
Call wsh.Run(str&Chr(34)&Edit1.Text&Chr(34),1,0)

Custom Script 1.1
MM 2.5.5.x
Win XP Svc Pack II
Saving report as HTML

Any ideas please.

Thanks

Posted: Wed Jul 18, 2007 3:33 am
by trixmoto
What error message do you get?

Posted: Thu Jul 19, 2007 1:42 am
by paulmt
trixmoto wrote:What error message do you get?

The report runs, then displays the "report complete do you want to display now"
Clicking on this brings up...

Error #2147023741 - File c:\program files\mediamonkey\scripts\customreport.vbs Line 457 Column 6

AFter clicking "ok"

"Error happened during script execution: No application is associated with the specified file for this operation"

Click on "ok" and the error message goes away

**** But I have figured this out..... my error!
I was assigning a file name but not a directory, I thought it would just save to the scripts folder by default. Once I clicked on the /\ and selected a directory the script works perfectly.

Thanks

Posted: Thu Jul 19, 2007 3:59 am
by trixmoto
Ok, I'm glad you sorted this out. I'll try to put a catch for this error in the next version.

Posted: Thu Jul 26, 2007 7:58 am
by Mizery_Made

Code: Select all

Error #5 - Microsoft VBScript runtime error
Invalid procedure call or argument
File: "C:\Program Files\MediaMonkey\Scripts\CustomReport.vbs", Line: 403, Column: 8
Don't know what that's about.

Posted: Thu Jul 26, 2007 9:47 am
by trixmoto
Well line 403 is...

Code: Select all

Call f.WriteLine(Join(dic.Items,","))
You could try replacing this with the following...

Code: Select all

On Error Resume Next
Call f.WriteLine(Join(dic.Items,","))
If Err.Number <> 0 Then
  MsgBox Join(dic.Items,",")
  Err.Clear
End If
On Error Goto 0
...which should pop up the text that is invalid instead of the error message. What is the text which causes the error?

Posted: Thu Jul 26, 2007 12:58 pm
by Mizery_Made
Appears to be having trouble with the characters "е" & "ш" *Shrugs*

As for what you said to replace, I did so and the error still comes up, now only thing different is it says line 422 instead of 403.