Das Skript für TM von gestern mit einer kleinen Korrektur:
Code: Alles auswählen
REM TM Automation Dateikonversion 2018
Set tm = CreateObject("TextMaker.Application")
tm.Application.Visible = True
DIM x, z AS Long
DIM Dateityp(22) AS String
Dateityp(0)="TextMaker-Dokument"
Dateityp(1)="TextMaker-Vorlage"
Dateityp(2)="Microsoft Word für Windows 97 und 2000"
Dateityp(3)="OpenDocument, OpenOffice.org, StarOffice"
Dateityp(4)="Rich Text Format"
Dateityp(5)="Pocket Word auf dem Pocket PC"
Dateityp(6)="Pocket Word auf dem Handheld PC"
Dateityp(7)="Textdatei mit Windows-Zeichensatz"
Dateityp(8)="Textdatei mit DOS-Zeichensatz"
Dateityp(9)="Textdatei mit Unicode-Zeichensatz"
Dateityp(10)="Textdatei mit UTF8-Zeichensatz"
Dateityp(11)="HTML"
Dateityp(12)="Microsoft Word fr Windows 6.0"
Dateityp(13)="Textdatei für UNIX, Linux, FreeBSD"
Dateityp(14)="Microsoft Word für Windows XP und 2003"
Dateityp(15)="TextMaker-Dokument, Version 2006"
Dateityp(16)="OpenXML (DOCX)"
Dateityp(17)="TextMaker-Dokument, Version 2008"
Dateityp(18)="OpenXML Vorlage (DOTX)"
Dateityp(19)="Microsoft Word-Vorlage für Windows XP und 2003"
Dateityp(20)="TextMaker-Dokument, Version 2012"
Dateityp(21)="TextMaker-Dokuemnt, Version 2016"
Dateityp(22)="TextMaker-Vorlage, Version 2016"
Begin Dialog DIALOG_1 147,49, 200, 92, "Zielformat"
Text 4,4,188,24, "Wählen Sie den Dateityp der Zieldateien aus der Liste unten aus."
DropListBox 4,36,144,32, Dateityp(), .DropDown_1
OKButton 160,60,24,20
End Dialog
DIM Dlg1 AS DIALOG_1
Set sl = CreateObject("Shell.Application")
Set ordner = sl.BrowseForFolder(0, "Bitte den zu konvertierenden Ordner auswählen.", 0, 0)
If not ordner is Nothing then
quellordnername = ordner.self.Path
Else
MsgBox "Kein Ordner gefunden!"
End
End If
x=Dialog(Dlg1)
z=Dlg1.DropDown_1
Select Case z
Case 0
endg="tmdx"
Case 1
endg="tmvx"
Case 2, 12, 14
endg="doc"
Case 3
endg="odt"
Case 4
endg="rtf"
Case 5
endg="psw"
Case 6
endg="pwd"
Case 11
endg="htm"
Case 7, 8, 9, 10, 13
endg="txt"
Case 15, 17, 20, 21
endg="tmd"
Case 16
endg="docx"
Case 18
endg="dotx"
Case 19
endg="dot"
Case 22
endg="tmv"
End Select
if z>10 then z=z+1
if z>18 then z=z+3
if z>23 then z=z+3
Set ordner = sl.BrowseForFolder(0, "Bitte den Ziel-Ordner auswählen.", 0, 0)
If not ordner is Nothing then
zielordnername = ordner.self.Path
Else
MsgBox "Kein Ordner gefunden!"
End
End If
Set fs = CreateObject("Scripting.FileSystemObject")
Set dr = fs.GetFolder(quellordnername)
For each dateiname in dr.files
tm.Documents.Open dateiname, Empty, Empty, Empty, 0
dname=tm.ActiveDocument.Name
l=len(dname)
test=Right(dname, 5)
test=Mid(test, 1, 1)
If test="." Then l=l-4 Else l=l-3
dname=Mid(dname, 1, l)
neuername=zielordnername+"\"+dname+endg
tm.ActiveDocument.SaveAs neuername, z
tm.ActiveDocument.Close smoDoNotSaveChanges
next
tm.Application.Quit
Set tm = Nothing
End
Und hier noch das Skript für PM:
Code: Alles auswählen
REM PM Automation Dateikonversion 2018
Set pm = CreateObject("PlanMaker.Application")
pm.Application.Visible = True
DIM x, y, z AS Long
DIM Dateityp(22) AS String
Dateityp(0)="PlanMaker-Dokument"
Dateityp(1)="PlanMaker-Vorlage"
Dateityp(2)="Excel 97/2000/XP"
Dateityp(3)="Excel 5.0/7.0"
Dateityp(4)="Excel-Vorlage"
Dateityp(5)="Sylk"
Dateityp(6)="Rich Text Format"
Dateityp(7)="HTML"
Dateityp(8)="dBASE-Datenbank im DOS-Zeichensatz"
Dateityp(9)="dBASE-Datenbank im Windows-Zeichensatz"
Dateityp(10)="Textdatei mit Windows-Zeichensatz (DIF)"
Dateityp(11)="Textdatei mit Windows-Zeichensatz (ANSI)"
Dateityp(12)="Textdatei mit DOS-Zeichensatz"
Dateityp(13)="Textdatei mit ANSI-Zeichensatz für UNIX, Linux und FreeBSD"
Dateityp(14)="Textdatei mit Unicode-Zeichensatz"
Dateityp(15)="dBASE-Datenbank mit Unicode-Zeichensatz"
Dateityp(16)="Textdatei mit UTF8-Zeichensatz"
Dateityp(17)="Excel-Dokument(XLSX)"
Dateityp(18)="Excel-Vorlage(XLTX)"
Dateityp(19)="PlanMaker-Dokument, Version 2008"
Dateityp(20)="PlanMaker-Dokument, Version 2010"
Dateityp(21)="PlanMaker-Dokument, Version 2012"
Dateityp(22)="PlanMaker-Vorlage, Version 2012"
Begin Dialog DIALOG_1 147,49, 200, 92, "Zielformat"
Text 4,4,188,24, "Wählen Sie den Dateityp der Zieldateien aus der Liste unten aus."
DropListBox 4,36,144,32, Dateityp(), .DropDown_1
OKButton 160,60,24,20
End Dialog
DIM Dlg1 AS DIALOG_1
Set sl = CreateObject("Shell.Application")
Set ordner = sl.BrowseForFolder(0, "Bitte den zu konvertierenden Ordner auswählen.", 0, 0)
If not ordner is Nothing then
quellordnername = ordner.self.Path
Else
MsgBox "Kein Ordner gefunden!"
End
End If
x=Dialog(Dlg1)
z=Dlg1.DropDown_1
Select Case z
Case 0
endg="pmdx"
y=0
Case 1
endg="pmvx"
y=1
Case 2, 3
endg="xls"
y=z
Case 4
endg="xlt"
y=4
Case 5
endg="slk"
y=6
Case 6
endg="rtf"
y=7
Case 7
endg="htm"
y=8
Case 8, 9
endg="dbf"
y=z+1
Case 10
endg="dif"
y=11
Case 11, 12, 13, 14
endg="txt"
y=z+1
Case 15
endg="dbf"
y=18
Case 16
endg="txt"
y=21
Case 17
endg="xlsx"
y=23
Case 18
endg="xltx"
y=24
Case 19, 20, 21
endg="pmd"
y=z+7
Case 22
endg="pmv"
y=29
End Select
Set ordner = sl.BrowseForFolder(0, "Bitte den Ziel-Ordner auswählen.", 0, 0)
If not ordner is Nothing then
zielordnername = ordner.self.Path
Else
MsgBox "Kein Ordner gefunden!"
End
End If
Set fs = CreateObject("Scripting.FileSystemObject")
Set dr = fs.GetFolder(quellordnername)
For each dateiname in dr.files
pm.Workbooks.Open dateiname, False, Empty
dname=pm.ActiveWorkbook.Name
l=len(dname)
test=Right(dname, 5)
test=Mid(test, 1, 1)
If test="." Then l=l-4 Else l=l-3
dname=mid(dname, 1, l)
neuername=zielordnername+"\"+dname+endg
pm.ActiveWorkbook.SaveAs neuername, y, Empty, Empty
pm.ActiveWorkbook.Close smoDoNotSaveChanges
next
pm.Application.Quit
Set pm = Nothing
End
Ich habe nun nicht jede denkbare Umwandlung selbst durchgespielt.
Falls bei der Anwendung Fehler auftreten sollten, bitte ich um Rückmeldung hier, damit ich diese ggf. beheben kann.