Sandbox: Difference between revisions
		
		
		
		Jump to navigation
		Jump to search
		
| No edit summary |  (Added source code samples) | ||
| Line 8: | Line 8: | ||
| {{MethodParameters}} | {{MethodParameters}} | ||
| <source lang="csharp"> | |||
| // Hello World in Microsoft C# ("C-Sharp"). | |||
| using System; | |||
| class HelloWorld | |||
| { | |||
|     public static int Main(String[] args) | |||
|     { | |||
|         Console.WriteLine("Hello, World!"); | |||
|         return 0; | |||
|     } | |||
| } | |||
| </source> | |||
| <source lang="vb"> | |||
| ' A simple script that swaps the content of Title and Artist fields of selected tracks | |||
| Sub SwapArtistTitle | |||
|   ' Define variables | |||
|   Dim list, itm, i, tmp | |||
|   ' Get list of selected tracks from MediaMonkey | |||
|   Set list = SDB.CurrentSongList  | |||
|   ' Process all selected tracks | |||
|   For i=0 To list.count-1 | |||
|     Set itm = list.Item(i) | |||
|     ' Swap the fields | |||
|     tmp = itm.Title | |||
|     itm.Title = itm.ArtistName | |||
|     If itm.AlbumArtistName = itm.ArtistName Then     ' Modify Album Artist as well if is the same as Artist | |||
|       itm.AlbumArtistName = tmp | |||
|     End If | |||
|     itm.ArtistName = tmp | |||
|   Next | |||
|   ' Write all back to DB and update tags | |||
|   list.UpdateAll | |||
| End Sub | |||
| </source> | |||
Revision as of 11:18, 20 March 2007
This page is purely for testing
Main Page
Main Page
Main Page
Main Page
| Name | Type | Description | 
|---|
// Hello World in Microsoft C# ("C-Sharp").
using System;
class HelloWorld
{
    public static int Main(String[] args)
    {
        Console.WriteLine("Hello, World!");
        return 0;
    }
}' A simple script that swaps the content of Title and Artist fields of selected tracks
Sub SwapArtistTitle
  ' Define variables
  Dim list, itm, i, tmp
  ' Get list of selected tracks from MediaMonkey
  Set list = SDB.CurrentSongList 
  ' Process all selected tracks
  For i=0 To list.count-1
    Set itm = list.Item(i)
    ' Swap the fields
    tmp = itm.Title
    itm.Title = itm.ArtistName
    If itm.AlbumArtistName = itm.ArtistName Then     ' Modify Album Artist as well if is the same as Artist
      itm.AlbumArtistName = tmp
    End If
    itm.ArtistName = tmp
  Next
  ' Write all back to DB and update tags
  list.UpdateAll
End Sub