INTERACT FORUM

More => Old Versions => JRiver Media Center 27 for Windows => Topic started by: dmance on May 26, 2021, 10:11:00 pm

Title: Send To -> Expression to only send Folder name once
Post by: dmance on May 26, 2021, 10:11:00 pm
If I select 'Send To' on an album, my external program gets one invocation per file(track). What expression can I write that only does a single invocation of my external program with only the Folder (path) of the album?
Thanks
Dan
Title: Re: Send To -> Expression to only send Folder name once
Post by: zybex on May 27, 2021, 07:08:36 am
You can try using this as the external tool Parameters (with quotes, to handle paths with spaces):
Code: [Select]
"[Filename (path)]"or this to remove the trailing slash:
Code: [Select]
"removeright([Filename (path)],1)"
However, MC will still call the SendTo command once for each file in the Album - depending on what you are calling, it may work or not.
If it doesn't, you would need to create a small app/script to use as the SendTo target which would check the folder name and only run the actual application once for each group of calls. It's not too complex but it does require some proper programming skills as MC will still invoke it a bunch of times almost simultaneously - so inter-process sync/locking is required during the WasIAlreadyCalled() check.
Title: Re: Send To -> Expression to only send Folder name once
Post by: dmance on May 27, 2021, 09:10:34 am
You can try using this as the external tool Parameters (with quotes, to handle paths with spaces):
Code: [Select]
"[Filename (path)]"or this to remove the trailing slash:
Code: [Select]
"removeright([Filename (path)],1)"
However, MC will still call the SendTo command once for each file in the Album - depending on what you are calling, it may work or not.
If it doesn't, you would need to create a small app/script to use as the SendTo target which would check the folder name and only run the actual application once for each group of calls. It's not too complex but it does require some proper programming skills as MC will still invoke it a bunch of times almost simultaneously - so inter-process sync/locking is required during the WasIAlreadyCalled() check.

I was hoping to code a conditional expression where it only calls the external application for the first track (check if Track# == 1).  is this possible to avoid multiple calls?  If not, as you suggest, I will code a powershell script to invoke the application only once.
Title: Re: Send To -> Expression to only send Folder name once
Post by: zybex on May 27, 2021, 09:16:18 am
There doesn't seem to be any way to do that on the SendTo menu options.
You may need this:
https://stackoverflow.com/questions/7664490/interactively-using-mutexes-et-al-in-powershell