Start a new topic
Implemented

Add indicator for script processing (how many in total)

Can you please add a indicator how many files will be processed in the execution of a script?


Executing scripts popup:


Processing script 1/1

Processing file 1/XXX


Just a corrections for imperfections :)


This should already be possible by calling:


 

host.UpdateProgress(string.Format("Processing file {0}", idx));

 

Update: Added to documentation :)

Sorry, maybe i described it wrong.

I wanted to set a "in total" indicator.

  

host.UpdateProgress(string.Format("Processing file {0} of {0}", idx, total));

  But I'm too stupid to get it working in the CalculateMusicKey.cs, because i can't find out how to get the count of the list for the foreach loop.. like sizeof() e.g.





You should try:


 

using System;
using NeonScripting;
using System.Collections;
using System.IO;
using System.Text;
using System.Linq;

namespace Neon
{
	public class Script
	{
		public bool Run(INeonScriptHost host)
		{
			var total = host.Tracks.Count();
			var idx = 1;
			foreach(var track in host.Tracks) 
			{
				host.UpdateProgress(string.Format("Processing file {0}/{1}", idx, total));
                if (track.InitialKey == "") 
                {
                    var key = host.RemoteCalls.CalculateMusicKey(track.FullFilename);
                    track.InitialKey = key;
                }
                else
                {
                    track.IgnoreChanges = true;
                }
				idx++;
			}
			host.RemoteCalls.CommitAllChanges(host.Tracks);
			
			return true;
		}

	}
}

 

I have updated this script for the upcoming build.


1 person likes this

Thanks a lot!

Login or Signup to post a comment