You might try a User macro implementation of whatever you're trying to achieve, which should hopefully work.
ps. I should note that the following macro was written with Windows 10 OS in mind -- do make the appropriate changes for other OS yourself. I'll describe the outputs of each line of the script so hopefully it is easy for you to work out what you need to change.
I am also assuming you are copying your
.pdf file from your working directory (i.e., where your master/root
.tex file is) to a folder in D drive called
folder (i.e., location
Macros -> Edit Macros, click
Add on the bottom left corner of the popup window, and paste the following:
full_dir = editor.fileName().replace(/\//,"\\")
file_name = full_dir.split(".tex")
system('cmd /C "copy '+file_name+'.pdf D:\\folder"')
and give it an event trigger,
?after-command-run, as shown in the pic below:
Ok, then now, whenever a command run has ended (e.g. at the end of a
Build and View call), this script will automatically be activated, and it should copy to the designated folder.
A short explanation
editor.filename() returns a string containing the full directory of the master
.tex file (which should also be where the
.pdf is generated). For example, it could be something like
... is just the relevant paths leading to your
- I then changed all the
/ (forward slash) in the directory string to a
\ (backslash) via regex replacement, because Windows uses backslashes. I'm guessing this isn't the case for other OS, so you can leave the
.replace(...) statement out in that case.
Line 2: Note also the result of
editor.filename() leaves a
.tex extension at the end. So I removed it in this line.
Line 3: Here, the
system command passes its argument to the command line, and we need to invoke shell explicitly and is OS-dependent: (Read the TXS user manual, under Section 1.3.2, Shell functionality, for more info):
For Mac OS / Linux:
sh -c "<cmds>"
cmd /C "<cmds>"
Lastly, note the
D:\\folder part of Line 3. Just change that to whatever directory/folder you wish to copy the
.pdf to. Make sure that folder actually exists.
If it is actually successful in running, you should see a message
1 file(s) copied appear in the Messages box at the bottom.