Calling All HTML Scripting Experts

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Calling All HTML Scripting Experts

Post by Plethora »

I'm looking for a way to export more than one .html file in a script.

1. need to know how to open a new .html file with an album/artist name
ex. 'itm.artistname'.html


2. need to know how to place other links in the code using script
ex. >

Code: Select all

Generated by <a href='http://www.mediamonkey/'itm.artistname'/'itm.albumname'.com'>MediaMonkey</a></td>
The project I am trying to complete is lengthy and any help would greatly be appreciated.

-Plethora :wink: [/code]
- Plethora
- 160 GB and Counting!!!
jiri
Posts: 5419
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

I think you can easily find answers to your questions in Export.vbs file, namely in the function ExportHTML, where:

1) Is done by line

Code: Select all

Set fout = fso.CreateTextFile( fullfile, True)
You can supply filename according to your needs.

2) As a continuation of 1) you can write:

Code: Select all

fout.WriteLine "<td style='border-bottom-width:0px'><B>"&SDB.Localize("Total Tracks:")&" </B>"&i&"</td> <td align=Right style='border-bottom-width:0px'>Generated by <a href='http://www.mediamonkey.com'>MediaMonkey</a></td>"
fout.Close
Jiri
Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Post by Plethora »

Thanks for the quick reply

I have edited the ExportHTML file before but I think what i'm looking for is to create a web page(.html) for each artist and then each album.

I would like to create links back and forth. I know this could be extensive code.

so if I have

Code: Select all

artistname = itm.artist
set fout = fso.CreateTextFile( artistname, true)
is this what your suggesting?

also

Code: Select all

<a href='http://www.mp3list.com/'artistname'>artistname</a></td>"
fout.close
thanks
- Plethora
- 160 GB and Counting!!!
jiri
Posts: 5419
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

Yes, generally speaking that's what you need to do. Of course, there are some other things to do, e.g. to add full path and '.htm' extension to the filename, etc., but I think it's pretty clear.

Jiri
Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Post by Plethora »

Can you give me an example that creates a html file using an itm.artistname?

also
What is the MapXML for in the following code

Code: Select all

artistname = MapXML(itm.ArtistName)
    if artistname="" then 
      artistname = "&" 
    end if 
If I take out all other subs in the Export.vbs file (leaving the beginning ones and the html sub) I get an error having to do with this MapXML thingy.

THanks
- Plethora
- 160 GB and Counting!!!
Guest

Post by Guest »

think i figured part of my current problem out... will post when more acurate...
Guest

Post by Guest »

Got this so far

Code: Select all

' Iterate through the list and export all songs 
  Progress.MaxValue = list.count 
  Dim i, itm 
	
	' Declare prevartist in order to check for duplicates in for loop
	Dim prevartist  
	Dim j
	j=0		

	for i=0 to list.count-1 
		Set itm = list.Item(i) 
	
		' Call Artistname and put to file
		Dim artistname 
		artistname = MapXML(itm.ArtistName)
		
		if prevartist<>artistname then
			' Body of the table 
			fout.WriteLine "<tr><td align=center class=dark>"&i+1&"</TD><td align=Center style='border-bottom-width:0px'><a href='http://www."&artistname&".htm'>"&artistname&"</a></td>" 
			
			' Create the output file 
			'Dim ArtistHtml
			'artistnameHTML = artistname
			'Set ArtistHtml = fso.CreateTextFile( artistnameHTML)
			'	artistnameHTML.WriteLine "<html>"
			'	artistnameHTML.WriteLine ""&artistname&""
		end if
		
		prevartist=artistname
		
		Progress.Value = i+1 
		if Progress.Terminate then 
			Exit For 
		end if 
	next 
Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Post by Plethora »

The above code is what i have so far.

How would i go about creating an html file with "artistname".html as the file name

as you can see in the code I have attempted a make shift version of this idea.

any comments would be great.

-Plethora
- Plethora
- 160 GB and Counting!!!
Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Opening a new file to write to

Post by Plethora »

Can any one help me with opening a new file to write to in VBS?

I see where the export.vbs script does this but it's still not clear to me.

Thanks
- Plethora
- 160 GB and Counting!!!
Guest

creating a .vbs file

Post by Guest »

I think you just open a new notepad document,
use it to write / paste script into.
Save it & then rename it with a .vbs extension

I hope this helps
Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Yummy Scripting

Post by Plethora »

Ok so those of you who have the extra time to script and like tinkering,
here's a tasty morsel to digest.

Code: Select all

artistfile = ""&savedir&""&artistname&".htm"
Set fsoartist = CreateObject("Scripting.FileSystemObject")
Set foutartist = fsoartist.CreateTextFile( artistfile, True)
This is just a part of the script I am forever working on... I didn't know this before and with enough tinkering I found out that I can create files to write to using the above code.

Now... does anyone know how to create folders in VBS? :D
- Plethora
- 160 GB and Counting!!!
jiri
Posts: 5419
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

Use fso.CreateFolder for this. I would recommend you to download scripting help from http://www.microsoft.com/scripting, you'll find many answers to your questions there.

Jiri
Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Ahhhh Yess

Post by Plethora »

Ok kool, I did go there once before. It is a good resource for all things Microsoft :lol:

I'll continue my search there. :D
- Plethora
- 160 GB and Counting!!!
Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Post by Plethora »

In the main window of MM (where you select tracks) there is a bar that has stuff like "album|track|artist|bitrate" and much more. I have discovered that if you right click on the bar you can select/deselect more sorting columns. One in paticular that I have started using is the "AlbumArtist" tab. I have these settings:

Artist = Artist or group that is actually performing
Album= Name of album
AlbumArtist= the core artist that I sort by

For example....
AlbumArtist = Dave Matthews
Artist = Dave Matthews Band
Album = Remember Two Things

Since Dave has his self titled CD's and some with other guests like Tim Reynolds, It's easier for me to sort.

Now it seems to me that the names or functions of these tabs (AlbumArtist and Artist) should be swapped, just for making more since.
I also warn you to becareful to only change the AlbumArtist if you like this idea. It seems that if you edit the Artist, then the AlbumArtist mirrors the change.

I believe what I have said, to be essentially correct.

On another note can anyone tell me what the itm.? is for the AlbumArtist tag in MM for scripting purposes? I'm having a hard time finding it...
Thanks
- Plethora
- 160 GB and Counting!!!
Plethora
Posts: 50
Joined: Tue Feb 24, 2004 6:03 pm
Location: Alabama
Contact:

Web Site Galore

Post by Plethora »

Ok,

I need to know what MM calls the AlbumArtist so I can access it in scripting. Maybe I am blind but I can't find it anywhere... I have tried looking at the scripting help reference page but I am still lost...

Thanks...
- Plethora
- 160 GB and Counting!!!
Post Reply