INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Send To -> Expression to only send Folder name once  (Read 529 times)

dmance

  • Recent member
  • *
  • Posts: 8
Send To -> Expression to only send Folder name once
« 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
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2619
Re: Send To -> Expression to only send Folder name once
« Reply #1 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.
Logged

dmance

  • Recent member
  • *
  • Posts: 8
Re: Send To -> Expression to only send Folder name once
« Reply #2 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.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2619
Re: Send To -> Expression to only send Folder name once
« Reply #3 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
Logged
Pages: [1]   Go Up