ttml2ssa icon indicating copy to clipboard operation
ttml2ssa copied to clipboard

ttml2ssa.cmd

Open lhksoft opened this issue 2 years ago • 2 comments

To get the cmd working from any folder, it should be changed to following : python "%~dp0src/__main__.py" %*

If one add the folder where ttml2ssa.cmd is located in the PATH, so when calling this app from some other folder it won't give an error that it cannot find src/__main__.py.

This is a very good app, I don't know much about python but as a c++ coder it wasn't much headbreaking to get things working. And as I like my subs in a bit custom style, it's easy to change the defaults in the ttml2ssa.py to the way I prefer.

lhksoft avatar Jun 26 '23 06:06 lhksoft

Is this something on a specific platform? This doesn't seem to work:

diff --git a/ttml2ssa.sh b/ttml2ssa.sh
index 015236f..a68106a 100755
--- a/ttml2ssa.sh
+++ b/ttml2ssa.sh
@@ -1,2 +1,2 @@
 #!/usr/bin/env sh
-python3 src/__main__.py "$@"
+python "%~dp0src/__main__.py" %*

lg188 avatar Sep 30 '23 10:09 lg188

Is this something on a specific platform? This doesn't seem to work:

this one : python "%~dp0src/__main__.py" %* is for Windows. Assuming you had Python3 installed (so it's available through the global PATH). You should create a cmd (batch) file in some folder that's also available in the global path. In that cmd file you put the line as above. It could look like somthing as following :

@Echo Off python "%~dp0src/__main__.py" %*

then __main___.py (the actual python script) is located in a subfolder 'src' in the directory where your cmd-file is located. That's the code %~dp0src stands for, call the python script in subfolder src from the directory in which the calling cmd is located. The trailing '%*' means that any parameter you gave with your cmd file, it will be passed through to the python script.

But, this works only in Windows. Most likely, for linux you should write some other bash file.

lhksoft avatar Sep 30 '23 16:09 lhksoft