Jump to content

Wikipedia talk:AutoWikiBrowser/Create new pages

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

A way to solve some limitations with .bat-file

[edit]

I had some problems to follow the instructions fully (editing existing bot-written files at sv.wikipedia.org), and found out that I had to improve the .bat-script in order to also handle the needed charterers "():/". The parenthesis broke the script and colon and slash are not accepted in Windows-file names. To solve the parenthesis issue I had to rewrite the .bat-file. The other problem I solved by replacing ":" with "~colon~" and "/" with "~slash~" in the Windows-files, while keeping the Wikipedia article-names in the list and so let the .bat-file do the same replacement to find the corresponding Windows-file. BTW: Another issue is that white-space can not be replaced with "_", either in the list or in the windows-filenames...

@echo off
chcp 65001
setlocal enableextensions enabledelayedexpansion
set concat=%*
set SEARCHTEXT=:
set REPLACETEXT=~colon~
SET modified=!concat:%SEARCHTEXT%=%REPLACETEXT%!
set SEARCHTEXT=/
set REPLACETEXT=~slash~
SET concat=!modified:%SEARCHTEXT%=%REPLACETEXT%!
copy /Y "C:\[...PATHWAY TO YOUR FOLDER...]\%concat%.txt" iofile.txt
echo %concat% >> log.txt

(no, I am not uset with the bat-language, so it can certainly be improved alot...) Taxelson (talk) 13:21, 11 February 2017 (UTC)[reply]