Page 99 of 99

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Mon May 27, 2019 12:19 pm
by ed.j
Hopefully someone can give me a hand with this - I'm trying make a script that swaps A and B but only if B exists (ie B is not empty).

Swapping A and B is a preset but I'll be if I understand Reg expressions and where to put the "if B exists" part!

Can anyone give me a pointer please?

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Wed May 29, 2019 12:44 pm
by Erwin Hanzl
' A simple script that swaps the content of Title and Artist fields of selected tracks
' DEMO

Code: Select all

  Set list = SDB.SelectedSongList  
  if list.count<1 then exit sub
  For i=0 To list.count-1
    Set itm = list.Item(i)
    A = itm.Title
    B = itm.ArtistName
    if B<>"" then                   'String is Not Null And Not Empty
    	itm.Title = B
    	itm.ArtistName = A
    end if
  Next
  list.UpdateAll

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Mon Jun 03, 2019 4:26 pm
by ed.j
Erwin Hanzl wrote:
Wed May 29, 2019 12:44 pm
' A simple script that swaps the content of Title and Artist fields of selected tracks
' DEMO

Code: Select all

  Set list = SDB.SelectedSongList  
  if list.count<1 then exit sub
  For i=0 To list.count-1
    Set itm = list.Item(i)
    A = itm.Title
    B = itm.ArtistName
    if B<>"" then                   'String is Not Null And Not Empty
    	itm.Title = B
    	itm.ArtistName = A
    end if
  Next
  list.UpdateAll
champion! thanks

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Mon Jun 10, 2019 5:57 am
by cokehearth
I'm driving myself mad trying to figure this one out.

I'm trying to set "Custom 4" field to display the TOTAL number of tracks for an entire album - and not just on the one disc.

E.g.

If Disc 1 has 10 tracks, and Disc 2 has 15, I would want to Custom 4 to display "25".

Is there any way to display this?

And optionally, to make the number be at least four numbers long? (e.g. 0025 instead of 25)?

Many thanks.

UPDATE:

I figured out getting the total number of tracks:

SQLQuery("SELECT Count(CAST(TrackNumber AS integer)) FROM Songs WHERE IDAlbum = " & oSongData.Album.ID & " GROUP BY IDAlbum")

All I need now is to find out how I ensure the result comes out as a four-figure number?

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Mon Jun 10, 2019 12:30 pm
by Erwin Hanzl
strgVar=right(10000+ResultFromSQL,4)

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Wed Jun 12, 2019 3:53 am
by cokehearth
Erwin Hanzl wrote:
Mon Jun 10, 2019 12:30 pm
strgVar=right(10000+ResultFromSQL,4)
Works beautifully!

Many thanks, Erwin!!

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Wed Jun 12, 2019 11:37 am
by Erwin Hanzl
Bingo
Thanks for the feedback.
It is always nice to know if suggestions could be implemented

You could also try to build your SQL query instead of "ResultFromSQL"

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Wed Jul 24, 2019 5:23 am
by cokehearth
Excuse me if this has been asked before, but I couldn't find an answer thus far.

Is it possible to use this add-on to have multiple fields copied to a single field?

For example:
Year -> Genre, Album Artist -> Genre, Grouping -> Genre

So that the resulting Genre field would display:

2000; Madonna; Album
(which is <Year>; <Album Artist>; <Grouping>)

Many thanks.

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Wed Jul 24, 2019 11:14 am
by Erwin Hanzl

Code: Select all

  Set list = SDB.SelectedSongList  
  if list.count<1 then exit sub
  For i=0 To list.count-1
    Set itm = list.Item(i)
    itm.Genre=itm.Year & "; " & itm.AlbumArtistName & "; " & itm.AlbumName
  Next
  list.UpdateAll
https://www.mediamonkey.com/wiki/index.php/SDBSongData

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Thu Jul 25, 2019 11:19 am
by cokehearth
Erwin Hanzl wrote:
Wed Jul 24, 2019 11:14 am

Code: Select all

  Set list = SDB.SelectedSongList  
  if list.count<1 then exit sub
  For i=0 To list.count-1
    Set itm = list.Item(i)
    itm.Genre=itm.Year & "; " & itm.AlbumArtistName & "; " & itm.AlbumName
  Next
  list.UpdateAll
https://www.mediamonkey.com/wiki/index.php/SDBSongData
Very much appreciated, thank you!

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Sat Aug 03, 2019 5:57 am
by tm806891
I have upgraded my computer from Windows 7 to Windows 10. Now the RegExp Find & Replace app takes almost a minute (or more) just to load. Does anyone have advice on what to do about this? Perhaps I should re-install the app. If so, where is the most up-to-date version of it? Or is there something else I can do? I know that with the Windows upgrade more memory is required and so other things have slowed on the computer, but only a little bit. This one has become categorically different in terms of slowness since I upgraded. Please advise.

Re: RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Posted: Mon Aug 05, 2019 8:57 am
by Erwin Hanzl
DOWNLOAD RegExp Find and Replace Version 4.4.9: http://solair.eunet.rs/~zvezdand/RegExpReplace.htm