1 person found this helpful
As I mentioned in the video export thread last week, it is not possible to reliably pre-generate the filename that will be used in a export or publish service. If the user chooses a preset that includes a sequence number then there is no way you can guarantee the name returned will be the same as the one the export/publish chooses.
I have tried this once before. From memory I iterated each filename preset retrieved from LrApplication's method, stored the preset and its tokens, then compared the export's tokens to those for the presets I knew about, and used that to determine which preset to pass to the name via preset method. Very back-to-front way of using the available data but there was no other option available to me at the time.
What makes this even harder is that some of the filename presets returned by the LrApplication method won't be accepted by name via preset. From memory some presets return something other than an ID so the naming function can't understand which preset you are referring to. So if the user chose one of those naming presets in the export then you are, again, out of luck.
In case you were wondering I did report these bugs/limitations to Adobe some time ago.