PDF diff script - how to run configured Diff viewer?

143 views
Skip to first unread message

wwwald

unread,
Dec 18, 2015, 3:50:34 AM12/18/15
to us...@tortoisesvn.tigris.org
Hello,

I'm trying to produce a JS diff script for PDF files, based on pdftotext. I'm stuck on my last step - how to run TortoiseSVN's configured diff viewer, and compare the two TXT files that are produced.

Is the TortoiseSVN JS API documented somewhere? How can I determine the diff viewer path, to run it afterwards?

If I get this working, I'd be glad to contribute the script if appropriate.

Thanks for any advice,
wwwald

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=3151266

To unsubscribe from this discussion, e-mail: [users-un...@tortoisesvn.tigris.org].

Stefan Küng

unread,
Dec 18, 2015, 11:52:05 AM12/18/15
to us...@tortoisesvn.tigris.org
On 18.12.2015 09:48, wwwald wrote:
> Hello,
>
> I'm trying to produce a JS diff script for PDF files, based on pdftotext. I'm stuck on my last step - how to run TortoiseSVN's configured diff viewer, and compare the two TXT files that are produced.
>
> Is the TortoiseSVN JS API documented somewhere? How can I determine the diff viewer path, to run it afterwards?
>
> If I get this working, I'd be glad to contribute the script if appropriate.


To start the diff viewer (TortoiseMerge by default), just call
TortoiseProc.exe with the diff command:
https://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-automation.html#tsvn-automation-basics

example:

tortoiseproc.exe /command:diff /path1:"first.txt" /path2:"second.txt"


Or, you could also just start TortoiseMerge.exe directly:

TortoiseMerge.exe /base:"first.txt" /mine:"second.txt"
/basename:"first.pdf" /minename:"second.pdf"

When starting TortoiseMerge, you can as in the example above also pass a
descriptive name for the diffed files, which in your case would best be
the original pdf filenames.

Stefan

--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest interface to (Sub)version control
/_/ \_\ http://tortoisesvn.net

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=3151304

Niemann, Hartmut

unread,
Dec 21, 2015, 4:18:06 AM12/21/15
to us...@tortoisesvn.tigris.org, arnout.s...@gmail.com
Hello Wwwald!

It is fairly easy to call a custom diff program from TSVN.
Go to tortoiseSVN->Settings -> DiffViewer -> Advanced -> ADD... -> .pdf and the command line for diffing,
like d:\path\mypdfdiffer.bat %base %mine

You want to use jscript which I don't know - maybe have a look there how the excel differ
works which is AFAIK made in JS as well.

Have a look at
https://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-settings.html
and search for %base.

Mit freundlichen Grüßen
Dr. Hartmut Niemann

Siemens AG
MO MLT LM EN CCI 1
Werner-von-Siemens-Str. 67
91052 Erlangen, Deutschland
Tel.: +49 9131 7-34264
mailto:hartmut...@siemens.com

-----Ursprüngliche Nachricht-----
Von: wwwald [mailto:arnout.s...@gmail.com]
Gesendet: Freitag, 18. Dezember 2015 09:49
An: us...@tortoisesvn.tigris.org
Betreff: PDF diff script - how to run configured Diff viewer?
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=3151533

wwwald

unread,
Dec 21, 2015, 5:03:45 AM12/21/15
to us...@tortoisesvn.tigris.org
Yes, that does the trick to open the diff viewer.

One problem left: I still want to delete the temporary *.txt files (the output of pdftotext), after the diff viewer has been closed by the user.

Now, I'm using the Run() method of WScript.Shell to execute tortoiseproc. It has an option to wait for the called process to return, but this returns immediately after tortoiseproc has started the diff viewer, NOT after the diff viewer is closed by the user.
In other words, it waits for tortoiseproc to end, not for the diff viewer process to end.

Is it possible to have tortoiseproc NOT return, until after the diff viewer itself is closed?

Thanks,
wwwald
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=3151536

Stefan Küng

unread,
Dec 21, 2015, 1:40:43 PM12/21/15
to us...@tortoisesvn.tigris.org
On 21.12.2015 11:03, wwwald wrote:
> Yes, that does the trick to open the diff viewer.
>
> One problem left: I still want to delete the temporary *.txt files
> (the output of pdftotext), after the diff viewer has been closed by
> the user.

If you create the temp files in the temp folder, then Windows will clean
up eventually.

>
> Now, I'm using the Run() method of WScript.Shell to execute
> tortoiseproc. It has an option to wait for the called process to
> return, but this returns immediately after tortoiseproc has started
> the diff viewer, NOT after the diff viewer is closed by the user. In
> other words, it waits for tortoiseproc to end, not for the diff
> viewer process to end.

you could start the diff viewer directly (TortoiseMerge).

> Is it possible to have tortoiseproc NOT return, until after the diff
> viewer itself is closed?

No, sorry.

However:
TortoiseProc automatically deletes all files that are in the temp folder
and are
* match the filename mask "*svn*.*"
* are older than one day

so if you create your temp files accordingly, TortoiseProc will clean
them up as well after a day.

Stefan

--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest interface to (Sub)version control
/_/ \_\ http://tortoisesvn.net

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=3151612
Reply all
Reply to author
Forward
0 new messages