summaryrefslogtreecommitdiff
path: root/support/csvtolatex/configcreator-ctl.vbs
blob: 4a33e122ac8a348e800f736ca57fb11e7ce00832 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Option Explicit 

'J:\Eigene Dateien\Dokumente\Hannes\Visual Basic\csvtolatex\config.ctl
'Test.csv
'\LaTeXTest

Const version = "1.2"

Dim sPath, input, output, mode, title, msg, ende, options, comma
title = "csvtolatex configuration creator " & version
ende = True

sPath = InputBox("Please write here the full path and the name with extension of the configuration-file. Example: 'C:\user\documents\LaTeX\config.ctl'", title)

If InStr(sPath, ":\")	Then
	If InStr(Right(sPath, 4), ".ctl")	Then
	
	Else
		sPath = sPath + ".ctl"
	End If
Else
	ende = False
End If


input = InputBox("Please write here the name of the inputfile with extension like written in the documentation. Example: '\csv-tables\input.csv'", title)

If StrComp(input, "")	Then
Else
	ende = False
End If

If ende Then
	output = InputBox("Please write here the relative or absolute Path for the outputfiles. Example: '\LaTeX-tables\' If you want the path relative to your configuration file write 'config=' before the path. Example: 'config=\LaTeX-tables\'", title)


	mode = InputBox("Please write here weather 'text' for textmode or 'math' or nothing for mathmode", title)

	If InStr(mode, "nothing")	Then
		mode = ""
		msg = MsgBox("If you wanted mathmode by writing 'nothing' I have set it to blank, because nothing is no reserved word", 0, title)
	End If


	Dim Fso, sFile

	Set  Fso  =  CreateObject("Scripting.FileSystemObject")
	Set  sFile  =  Fso.CreateTextFile(sPath)

		sFile.WriteLine	"input=" & input
	If StrComp(output, "")	Then
		output = "output=" & output
		sFile.WriteLine output
	End If
	If StrComp(mode, "")	Then
		mode = "mode=" & mode
		sFile.WriteLine mode
	End If
	
	options = InputBox("Please write here the option you choose. Example: 'nolines' to have no \hline at the end of the lines", title)
	
	If StrComp(options, "")   Then
		options = "options=" & options
		sFile.WriteLine options
	End If
	
	sFile.WriteLine InputBox("If you wish write here the comma/point replacement you want, if you do not want to replace it, just leave it out. Write >commatopoint< if you want to convert all commas to points, or >pointtocomma> if you want to have it the other way around", title)
	
	
	sFile.Close

	msg = MsgBox("I have written in: >" & sPath & "< input: >" & input & "< output: >" & output & "< and mode: >" & mode & "< I hope this is all right.", 0 , title)
Else
	msg = MsgBox("There has to be a correct configurationfilename with absolute path and at least a correct inputfilename. Your configurationfilepath and -name was: >" & sPath & "< And your inputfile was: >" & input & "<", 0, title)
End If