Quick and dirty, funktioniert aber.... die Pings sind dafür da, weil die Datei wohl etwas braucht, bis sie geschrieben wird... hoffentlich macht das noch jemand eleganter... ich hab keine Zeit mehr für so was...
This script is finally working. It converts all JNT files in the current directory (where the script is executed) to pdf.
REM Skript sthet unter GPLv3 by jcol11
REM you need PDFCreator, and Windows to run it
REM for commandline Argument
cd %1
REM create a fresh directory, delete it if it already exists. This should be rewritten. Timestamps should be compared instead of deleting a PDFprint of an unchanged jnt.
echo %cd%
mkdir PDFs_JNT
del /q PDFs_JNT
REM set your default printer, remember this printer
SET %alterdrucker="MYPRINTER"
REM set PDFCreator as your default printer (temporarily)
rundll32 printui.dll,PrintUIEntry /y /n "PDFCreator"
REM activate Autosave
REG ADD HKEY_CURRENT_USER\Software\PDFCreator\Program /f /v UseAutosave /d 1
REG ADD HKEY_CURRENT_USER\Software\PDFCreator\Program /f /v Autosavefilename /d print
REM Ausgabeverzeichnis setzen
REG ADD HKEY_CURRENT_USER\Software\PDFCreator\Program /f /v Autosavedirectory /d "%cd%\PDFs_JNT\\"
FOR %%f IN (*.jnt) DO (
REM PrintFile to pdf
"%ProgramFiles%\Windows Journal\Journal.exe" /p "%cd%\%%f"
ping microsoft.com
ren "%cd%\PDFs_JNT\print.pdf" "%%f.pdf")
REM restore your default printer
rundll32 printui.dll,PrintUIEntry /y /n %alterdrucker%
Hat man mehrere Verzeichnisse, in denen JNTs liegen, so kann man in diesen eine Verknüpfung auf die cmd anlegen und unter Eigenschaften der Verknüpfung das Ausführungsverzeichnis in "%cd%" (ohne Anführungszeichen) ändern. Dann wird das Skript in dem Ordner der Verknüpfung ausgeführt.
Alternativ kann man eine weitere CMD anlegen. Diese geht dann durch alle Unterverzeichnisse von dem Verzeichnis in dem sie liegt und konvertiert alle JNTs, die in Unterverzeichnissen liegen in PDFs.
REM my is the directory that should be worked through recursively (only goes through all subdirectories)
set my=%cd%
dir /s /ad /b "%my%" >"%my%"/list.txt
For /F "tokens=*" %%d IN (%my%/list.txt) DO (
cd %%d
IF EXIST *.jnt (
"PATHTO\JNTtoPDF.cmd" "%%d")
)
del %my%\list.txt