[WINDOWS] problems with variables when launching from mpv #15589
Replies: 3 comments 1 reply
-
I think this question will be a long trip to "we need all info" and/or "I don't understand" kind of replies so I'm going to keep posting my findings alone and if somebody knows whats going on, please reply. Now, to focus on this: The batch is acting weird. The file below IS NOT in the folder that it checks, but it still returns "true" as if the file was there:
To dissect this: The batch is erratically thinking the file "2020-09-27_09-02-16_178~1__-seg37.mkv" is inside "E:\Perfil\Desktop[TEST_2]" which is not true. The batch evaluates if the file is already in the destination folder and if its true, it renames it then moves it; if it's not true it just moves it. In this case, the batch is wrongly evaluating that the file IS in the destination. WEIRD. At this point I want to say that this batch job works in windows directly; it only fails when launched from mpv. The script decides that the file must be renamed cause it "thinks" that a file with the same name is already in the destination, but pay close attention to what happened:
I will highlight it for you: mpv for some reason is changing "%1" (in this case %1 = The 3rd command obviously fails since the "renamed file" was never renamed:
So up until here, I see many strange things: |
Beta Was this translation helpful? Give feedback.
-
It seems that when One less to troubleshoot. Sadly, the script is still evaluating wrong and insists on renaming the file:
|
Beta Was this translation helpful? Give feedback.
-
Well, just discovered something: For some magical reason that I do not comprehend because my limited knowledge, "if exist" is being evaluated wrongly when launching the batch file from mpv. I assure you that this script worked without changes if used inside windows directly. So I will answer my own questions for people that end up here:
Black magic. Mpv does something when executing batch files that changes the native behaviour. The fix: using "if not exist" and flipping around the actions after it.
Auto-answered above, It was my fault in my script. Mpv was trying to "fix" my typo with "it's own separator". This is specified somewhere in the manual, but was a little vague and ambiguous. Still, it was a "typo" because I forgot to add a separator there.
No freaking idea. Still a mistery but I suppose it has something to do with for example "%1" not working properly and having to declare it into a new variable. This is important "%1" argument variables (something like "current selected file") is not playing nice with mpv and needs to be re-declared into another "formal" variable e.x. I will close this because I think I solved my issue, feel free to see if this can be fixed in the future or at least answered to me here if I'm missing something. |
Beta Was this translation helpful? Give feedback.
-
I use input.conf to launch certain cmd batch files to do stuff with files being played in mpv.
for example I use a 4 letter trigger to launch a script:
T-E-S-T run "E:\\Perfil\\Desktop\\0005.TEST.c.ms.CMD" "${path}"; show-text "TEST"
The script uses "%1" variable to deal with the file currently playing. It seems that mpv doesn't like "%1" and just says nothing is there ONLY IF I PLAY A WHOLE FOLDER (it's contents). The variable WORKS (and the whole script too) if I only play ONE file (a single video).
To be clear; files are always played by mpv, what fails is my manually launched CMD that moves the files currently being played.
TLDR: seems like mpv is not passing variables correctly to my batch file, in this case "%1" variable.
Beta Was this translation helpful? Give feedback.
All reactions