wiki:wikitaxi:wikitaxi_import_script
Delphi 12 Athens Updates Available!
To download, click your product: DIContainers, DIConverters, DICreole, DIFileFinder, DIGoogleReader, DIHtmlLabel, DIHtmlParser, DIMime, DIRegEx, DISQLite3, DITidy, DIUcl, DIUnicode, DIXml, YuBrotli, YuImage, YuNetSurf, YuOpenSSL, YuPcre2, YuPdf, YuStemmer, YuXmlSec, YuZip.
To download, click your product: DIContainers, DIConverters, DICreole, DIFileFinder, DIGoogleReader, DIHtmlLabel, DIHtmlParser, DIMime, DIRegEx, DISQLite3, DITidy, DIUcl, DIUnicode, DIXml, YuBrotli, YuImage, YuNetSurf, YuOpenSSL, YuPcre2, YuPdf, YuStemmer, YuXmlSec, YuZip.
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | wiki:wikitaxi:wikitaxi_import_script [2016/01/22 15:09] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== WikiTaxi: Batch Import ====== | ||
+ | {{page>: | ||
+ | {{page>: | ||
+ | |||
+ | Some people routinely use WikiTaxi as an offline backup for their personal Wiki and need to convert their uncompressed MediaWiki XML dumps to a WikiTaxi *.taxi file on a regular basis. The following script provides a solution to simplify this process. | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | * Run 7-Zip to compress the *.xml file to *.xml.bz2 | ||
+ | * Launch '' | ||
+ | * Invoke '' | ||
+ | |||
+ | < | ||
+ | ; Automated MediaWiki XML to WikiTaxi converter. Compile with AutoIt. | ||
+ | ; Requires WikiTaxi in same directory as compiled .exe, also requires 7-Zip installed on PC. | ||
+ | |||
+ | ; Match partial Window titles to support different versions of WikiTaxi | ||
+ | Opt(" | ||
+ | |||
+ | ; This will load the Main Page after importing, change to your preference. | ||
+ | $startpage = "Main Page" | ||
+ | |||
+ | ; 7-Zip is required | ||
+ | If Not FileExists(@ProgramFilesDir & " | ||
+ | MsgBox(16, " | ||
+ | Exit | ||
+ | EndIf | ||
+ | |||
+ | ; Drag and drop enabled | ||
+ | If $CmdLine[0] <> 0 Then | ||
+ | ; Assume cmdline input is file location | ||
+ | $wiki_xml = $CmdLine[1] | ||
+ | Else | ||
+ | ; Let user browse to .xml file to choose | ||
+ | $wiki_xml = FileOpenDialog(" | ||
+ | @WorkingDir, | ||
+ | If $wiki_xml = "" | ||
+ | ; Exit if canceled | ||
+ | Exit | ||
+ | EndIf | ||
+ | EndIf | ||
+ | |||
+ | ; To make formatting code better for .taxi file | ||
+ | $wiki_taxi = StringTrimRight($wiki_xml, | ||
+ | |||
+ | ; I'd rather not overwrite a Wiki, personal preference | ||
+ | If FileExists($wiki_taxi) Then | ||
+ | MsgBox(16, " | ||
+ | @CRLF & " | ||
+ | Exit | ||
+ | EndIf | ||
+ | |||
+ | ; Compress the .xml to bzip so that the importer will take it | ||
+ | Run('"' | ||
+ | $wiki_xml & ' | ||
+ | ProcessWaitClose(" | ||
+ | |||
+ | ; Launch Importer | ||
+ | Run(" | ||
+ | |||
+ | ; Make sure WikiTaxi is focus and activate it | ||
+ | WinActivate(" | ||
+ | WinWaitActive(" | ||
+ | |||
+ | ; Type in newly compressed xml | ||
+ | ControlSetText(" | ||
+ | " | ||
+ | |||
+ | ; Type in .taxi | ||
+ | ControlSetText(" | ||
+ | " | ||
+ | |||
+ | ; Click Import | ||
+ | ControlClick(" | ||
+ | " | ||
+ | |||
+ | ; --- If you have issues after importing, adjust or remove lines below --- | ||
+ | |||
+ | ; Adjust to your needs. I use a small wiki, not the Wikipedia, | ||
+ | ; so the timing is right for my situation. | ||
+ | Sleep(1000) | ||
+ | |||
+ | ; AutoIt can't see this text otherwise we'd wait for it. | ||
+ | ; To pause script, uncomment line below for larger wikis: | ||
+ | ; | ||
+ | |||
+ | ; Start WikiTaxi and navigate to specified start page | ||
+ | Run(' | ||
+ | |||
+ | ; Again, adjust below for larger wiki. | ||
+ | Sleep(2000) | ||
+ | |||
+ | ; Timing may be off and close Importer too early for larger wiki. | ||
+ | ProcessClose(" | ||
+ | |||
+ | ; Remove temporary file. You could also remove .xml, | ||
+ | ; but I keep it since WikiTaxi strips out history. | ||
+ | FileDelete($wiki_xml & " | ||
+ | </ |
wiki/wikitaxi/wikitaxi_import_script.txt · Last modified: 2016/01/22 15:09 by 127.0.0.1