This repository contains helper scripts for AutoWikiBrowser to automatically push/pull templates to/from a wiki.
- Download and setup AutoWikiBrowser according to the official instructions.
- Clone this repository anywhere on the same machine.
- Install Python 3.6.2 or above, then run the following command to download required packages:
python -m pip install -r requirements.txt
- Find the name of the template you want to process (without prefix and suffix).
- Open AutoWikiBrowser and log in your account.
- Use the
Make List
feature to select the pages you wish to import from. For convenience, it is recommended that you use a system to group all pages that contain the template so that you could generate the list of pages automatically. - Select
Tools > External Processing
. In the dialog box:- Enable the
Enabled
andSkip if no change
options. - Click on
Select program/script
and selectmain_minimized.bat.lnk
in this repository. - Set
Arguments/Parameters
topull <template_name> "%%fullpagename%%" "%%file%%"
where<template_name>
is the name of the template. - You can choose any valid path for
Input/Output file
, as long as it does not overwrite other content.
- Enable the
- Go to the
Skip
tab and perform the following:- Enable
No changes were made
in theGeneral skip options
section.
- Enable
- Go to the
Start
tab and start the bot to read from the wiki. - An Excel file with the same name as the template should be generated under
data
in this repository.
- Find the name of the template you want to process (without prefix and suffix).
- Create the list of page names to process and save them to a file using this command:
where
python main.py list-pages <template_name> > <file_path>
<template_name>
is the name of the template, and<file_path>
is the path to the save file (e.g.,temp.txt
). - Open AutoWikiBrowser and log in your account.
- Use the
Make List
feature to import the text file created in Step 2. If there are existing pages in the wiki not included in the Excel file that you wish to delete templates from, add them to the list as well. - Select
Tools > External Processing
. In the dialog box:- Enable the
Enabled
andSkip if no change
options. - Click on
Select program/script
and selectmain.bat
in this repository.- If you do not wish a new window to pop up each time the script is run, you can instead select a shortcut to the script that is configured to run in minimized mode. You can configure a shortcut as such by right-clicking it and modifying the setting under
Properties > Shortcut > Run
to "Minimized".
- If you do not wish a new window to pop up each time the script is run, you can instead select a shortcut to the script that is configured to run in minimized mode. You can configure a shortcut as such by right-clicking it and modifying the setting under
- Set
Arguments/Parameters
topush <template_name> "%%fullpagename%%" "%%file%%"
where<template_name>
is the name of the template. - You can choose any valid path for
Input/Output file
, as long as it does not overwrite other content.
- Enable the
- Go to the
Skip
tab and perform the following:- Enable
No changes were made
in theGeneral skip options
section. - Select
Don't care
in thePage
section.
- Enable
- Go to the
Start
tab and start the bot to update the wiki.
Excel files containing template data are located in the data
directory under this repository. Each file has the same name as the corresponding template (without prefix and suffix).
Each file contains at least one spreadsheet. For templates without suffixes in their names, the first spreadsheet stores its data. For templates with suffixes in their names, the spreadsheet with the same name as that of the suffix stores its data.
For illustration, consider an Excel file named Item.xlsx
and having three spreadsheets: main
, info
and extra
. According to the specifications, the main
spreadsheet holds data for Template:Item
(and/or Template:Item/main
), the info
spreadsheet holds data for Template:Item/info
, while the extra
spreadsheet holds data for Template:Item/extra
.
Each spreadsheet begins with a header row containing _pageName
(the {{FULLPAGENAME}}
of the parent page) and _indexInPage
(the index of the template instance with respect to the list containing all instances of this template in the page), with the remaining fields corresponding to the template's parameters. Each entry in the spreadsheet corresponds to an instance of the template.