dom.pl
1.55 KB
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
76
77
78
use Getopt::Long;
GetOptions("cfg|configs:s", "dox|Doc-o-MaticProjectFile:s");
$dom_exe = 'C:\\Program Files\\Doc-O-Matic 6 Professional\\dmcc.exe';
if( $opt_cfg !~ /html|pdf|chm|all/io )
{ # Not a valid argument
if ($opt_cfg eq "")
{
print "\n\nError : Configuration must be specified by -cfg option.\n";
}
else
{
print "\n\nInvalid argument : '$opt_cfg'\n";
}
exit;
}
if( !$opt_dox )
{ # must specify a project file
print "\n\nMissing Doc-o-Matic project file. Use -dox to specify project file.\n";
exit;
}
# change options to lowercase
$opt_cfg =~ s/HTML/html/igo;
$opt_cfg =~ s/PDF/pdf/igo;
$opt_cfg =~ s/CHM/chm/igo;
$opt_cfg =~ s/ALL/all/igo;
$cmd = "" ;
if ($opt_cfg eq "html")
{
$cmd = "\"${dom_exe}\" -config \"MTKDocConfig-HTML\" -noshow -w3";
}
elsif ($opt_cfg eq "pdf")
{
$cmd = "\"${dom_exe}\" -config \"MTKDocConfig-PDF\" -noshow -w3";
}
elsif ($opt_cfg eq "chm")
{
$cmd = "\"${dom_exe}\" -config \"MTKDocConfig-CHM\" -noshow -w3";
}
else
{
$cmd = "\"${dom_exe}\" -all -noshow -w3";
}
$cmd = "$cmd $opt_dox";
print "$cmd\n";
system($cmd);
$a = &getTime;
$t = time - $^T;
print "\n$a, Program took $t secs\n";
sub getTime()
{
my ($sec, $min, $hour, $mday, $mon, $year) = localtime(time);
my $timeStr;
if (defined($_[0]) && ($_[0] ne ""))
{
# return timestamp as part of filename
$timeStr = sprintf("%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d", $year+1900, $mon+1, $mday, $hour, $min, $sec);
}
else
{
$timeStr = sprintf("%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d", $year+1900, $mon+1, $mday, $hour, $min, $sec);
}
return $timeStr;
}