Automating Multiple Accounts with Uniuploader
Posted: Fri Jul 03, 2015 6:00 am
EDIT (10/31/15): Updated to perform a fixed time upload based on task scheduler as well as updating errors in batch script. Removed download links in favor of purely manual setup. Now using basic task creation.
This uses Windows Task Scheduler and a simple Batch file that sits in your main World of Warcraft install folder. It will give Uniuploader the recent CensusPlus SV of two, three, or four accounts to upload.
Notice: you need your Windows System account date/time settings in a certain way for this to work. More info in step 12.
1) Make a text file in your main World of Warcraft directory named wow.
2) Right click the file, open with Notepad. If you have a desired text editor, you may use that.
3) Paste the following code in that file. Change the ACCOUNT1/2/3/4 parts inside the dashed lines to what account folders you have in your World of Warcraft\WTF\Account folder. If you have more than two accounts, remove the two colons :: from the beginning of the lines you need, so three accounts would delete the colons in front of the line that starts with "set $cpp3" and four would delete the ones in the "set $cpp4" line. Save and close.
What the top part should look like if you have two accounts:
Three accounts:
And four accounts:
As a note, the first five lines of the large main code above are to log the most recent output of this script into a census.log file located in your World of Warcraft Logs folder. The contents of this file get overwritten every time this script runs. This is for debugging purposes, just in case. It is not uploaded anywhere, unless you manually do so. Everything logged in this file can be viewed in plain text in any text editor. If you don't want this log file, remove all five lines above setlocal enableDelayedExpansion. It is very important you leave that setlocal line there.
4) Now choose "Save as...", select "All Files" in the bottom dropdown, and add .bat to the filename. Make sure the file saves in the WoW install folder.
5) Type "taskschd.msc" in the Start menu and hit Enter.
6) Click "Create Basic Task..." on the right.
7) Name it something like "wowcensus", description is optional, then click Next.
8) You can have this trigger in any way you want, just keep in mind that if there's a new file, the upload will happen. Click Next after selecting a trigger then Next again after you're done setting up the trigger. I have it set to daily. Keep in mind that WarcraftRealms has a 15 minute limit between uploads.
9) Make sure "Start a program" is selected and click Next. Click the Browse button and find the .bat file you made above. Click Open then click Next.
10) Check "Open the Properties dialog" box and click Finish.
11) Click "Change User or Group..." then type SYSTEM into the bottom box and click OK then OK again.
12) Batch and Windows CMD is fickle. In order for the batch script to properly work, you actually need your Windows system short times set a certain way. Now, if you have the Task Scheduler set to your user account, which the last step changed, the batch file uses your date settings, but if the Task Scheduler is set to SYSTEM, it uses SYSTEM's date setting.
In your system control panel, find "Region and Language". Set the short date format to "yy/MM/dd" and short time to "HH:mm".
http://i.imgur.com/jSJ8fsZ.png
If you don't want to change your displayed dates and times, then you can set the Task Scheduler to use SYSTEM. Change your display dates/times anyways and do the following to copy them to SYSTEM.
http://i.imgur.com/SEv9QGk.png
http://i.imgur.com/NhC8n8i.png
Then, change your display dates/times back to how you want them.
13) You may have noticed "censusdummy" in the script. The way this automation works is it checks for the most recent CensusPlus.lua file in your two/three account folders and copies it into a bare "account" folder named "censusdummy". Uniuploader works by checking when the CensusPlus.lua file changes, so when the recent file gets copied to "censusdummy", Uniuploader triggers and uploads. Check the following pictures to set this fake folder up:
http://i.imgur.com/DrsXXeK.png
http://i.imgur.com/KUgg5m8.png
http://i.imgur.com/i3E8vSt.png
SavedVariables.lua can be empty or filled with random data, as long as it's there. Uniuploader checks for that file to "verify" a correct account folder. The CensusPlus.lua file can also be empty or random, as long as it's there for you to check it in Uniuploader's right SV window.
If you had Uniuploader running, close and reopen it. You should see a "censusdummy" option in the account dropdown. Select that, the auto-upload option, and make sure CensusPlus.lua is selected in the SV list.
That's it!
This uses Windows Task Scheduler and a simple Batch file that sits in your main World of Warcraft install folder. It will give Uniuploader the recent CensusPlus SV of two, three, or four accounts to upload.
Notice: you need your Windows System account date/time settings in a certain way for this to work. More info in step 12.
1) Make a text file in your main World of Warcraft directory named wow.
2) Right click the file, open with Notepad. If you have a desired text editor, you may use that.
3) Paste the following code in that file. Change the ACCOUNT1/2/3/4 parts inside the dashed lines to what account folders you have in your World of Warcraft\WTF\Account folder. If you have more than two accounts, remove the two colons :: from the beginning of the lines you need, so three accounts would delete the colons in front of the line that starts with "set $cpp3" and four would delete the ones in the "set $cpp4" line. Save and close.
Code: Select all
cd "%~dp0"
call :logstart > "%~dp0Logs\census.log" 2>&1
exit
:logstart
^======================================== %date% %time% ========================================
setlocal enableDelayedExpansion
::
::------------------------------------------------------------------------------
set $dump="%~dp0WTF\Account\censusdummy\SavedVariables\CensusPlus.lua"
set $cpp1="%~dp0WTF\Account\ACCOUNT1\SavedVariables\CensusPlus.lua"
set $cpp2="%~dp0WTF\Account\ACCOUNT2\SavedVariables\CensusPlus.lua"
::set $cpp3="%~dp0WTF\Account\ACCOUNT3\SavedVariables\CensusPlus.lua"
::set $cpp4="%~dp0WTF\Account\ACCOUNT4\SavedVariables\CensusPlus.lua"
::------------------------------------------------------------------------------
::
for %%T in (%$dump%) do set $dumt=%%~tT
for %%T in (%$cpp1%) do set $cpt1=%%~tT
for %%T in (%$cpp2%) do set $cpt2=%%~tT
if defined $cpp3 (for %%T in (%$cpp3%) do set $cpt3=%%~tT)
if defined $cpp4 (for %%T in (%$cpp4%) do set $cpt4=%%~tT)
call :filecompare %$cpt1% %$cpt2%
set $cp12=!errorlevel!
if defined $cpp3 (
call :filecompare %$cpt1% %$cpt3%
set $cp13=!errorlevel!
call :filecompare %$cpt2% %$cpt3%
set $cp23=!errorlevel!)
if defined $cpp4 (
call :filecompare %$cpt1% %$cpt4%
set $cp14=!errorlevel!
call :filecompare %$cpt2% %$cpt4%
set $cp24=!errorlevel!
call :filecompare %$cpt3% %$cpt4%
set $cp34=!errorlevel!)
if not defined $cpp3 (
if not defined $cpp4 (
if %$cp12% equ 1 (
call :copyfile %$cpt1% %$cpp1%)
if %$cp12% equ 2 (
call :copyfile %$cpt2% %$cpp2%)))
if defined $cpp3 (
if not defined $cpp4 (
if %$cp12% equ 1 (
if %$cp13% equ 1 (
call :copyfile %$cpt1% %$cpp1%))
if %$cp12% equ 2 (
if %$cp23% equ 1 (
call :copyfile %$cpt2% %$cpp2%))
if %$cp13% equ 2 (
if %$cp23% equ 2 (
call :copyfile %$cpt3% %$cpp3%))))
if defined $cpp3 (
if defined $cpp4 (
if %$cp12% equ 1 (
if %$cp13% equ 1 (
if %$cp14% equ 1 (
call :copyfile %$cpt1% %$cpp1%)))
if %$cp12% equ 2 (
if %$cp23% equ 1 (
if %$cp24% equ 1 (
call :copyfile %$cpt2% %$cpp2%)))
if %$cp13% equ 2 (
if %$cp23% equ 2 (
if %$cp34% equ 1 (
call :copyfile %$cpt3% %$cpp3%)))
if %$cp14% equ 2 (
if %$cp24% equ 2 (
if %$cp34% equ 2 (
call :copyfile %$cpt4% %$cpp4%)))))
exit
:copyfile
call :filecompare %1 %2 %$dumt%
if %errorlevel% neq 3 copy %3 %$dump%
exit
:filecompare
set $file1=%1 %2
set $file2=%3 %4
if "%$file1%" equ "%$file2%" exit /b 3
if %$file1:~0,2% gtr %$file2:~0,2% exit /b 1
if %$file1:~0,2% lss %$file2:~0,2% exit /b 2
if %$file1:~3,2% gtr %$file2:~3,2% exit /b 1
if %$file1:~3,2% lss %$file2:~3,2% exit /b 2
if %$file1:~6,2% gtr %$file2:~6,2% exit /b 1
if %$file1:~6,2% lss %$file2:~6,2% exit /b 2
if %$file1:~9,2% gtr %$file2:~9,2% exit /b 1
if %$file1:~9,2% lss %$file2:~9,2% exit /b 2
if %$file1:~12,2% gtr %$file2:~12,2% exit /b 1
if %$file1:~12,2% lss %$file2:~12,2% exit /b 2
if %$file1:~12,2% equ %$file2:~12,2% exit /b 3
Code: Select all
::------------------------------------------------------------------------------
set $dump="%~dp0WTF\Account\censusdummy\SavedVariables\CensusPlus.lua"
set $cpp1="%~dp0WTF\Account\ACCOUNT1\SavedVariables\CensusPlus.lua"
set $cpp2="%~dp0WTF\Account\ACCOUNT2\SavedVariables\CensusPlus.lua"
::set $cpp3="%~dp0WTF\Account\UNUSED\SavedVariables\CensusPlus.lua"
::set $cpp4="%~dp0WTF\Account\UNUSED\SavedVariables\CensusPlus.lua"
::------------------------------------------------------------------------------
Code: Select all
::------------------------------------------------------------------------------
set $dump="%~dp0WTF\Account\censusdummy\SavedVariables\CensusPlus.lua"
set $cpp1="%~dp0WTF\Account\ACCOUNT1\SavedVariables\CensusPlus.lua"
set $cpp2="%~dp0WTF\Account\ACCOUNT2\SavedVariables\CensusPlus.lua"
set $cpp3="%~dp0WTF\Account\ACCOUNT3\SavedVariables\CensusPlus.lua"
::set $cpp4="%~dp0WTF\Account\UNUSED\SavedVariables\CensusPlus.lua"
::------------------------------------------------------------------------------
Code: Select all
::------------------------------------------------------------------------------
set $dump="%~dp0WTF\Account\censusdummy\SavedVariables\CensusPlus.lua"
set $cpp1="%~dp0WTF\Account\ACCOUNT1\SavedVariables\CensusPlus.lua"
set $cpp2="%~dp0WTF\Account\ACCOUNT2\SavedVariables\CensusPlus.lua"
set $cpp3="%~dp0WTF\Account\ACCOUNT3\SavedVariables\CensusPlus.lua"
set $cpp4="%~dp0WTF\Account\ACCOUNT4\SavedVariables\CensusPlus.lua"
::------------------------------------------------------------------------------
4) Now choose "Save as...", select "All Files" in the bottom dropdown, and add .bat to the filename. Make sure the file saves in the WoW install folder.
5) Type "taskschd.msc" in the Start menu and hit Enter.
6) Click "Create Basic Task..." on the right.
7) Name it something like "wowcensus", description is optional, then click Next.
8) You can have this trigger in any way you want, just keep in mind that if there's a new file, the upload will happen. Click Next after selecting a trigger then Next again after you're done setting up the trigger. I have it set to daily. Keep in mind that WarcraftRealms has a 15 minute limit between uploads.
9) Make sure "Start a program" is selected and click Next. Click the Browse button and find the .bat file you made above. Click Open then click Next.
10) Check "Open the Properties dialog" box and click Finish.
11) Click "Change User or Group..." then type SYSTEM into the bottom box and click OK then OK again.
12) Batch and Windows CMD is fickle. In order for the batch script to properly work, you actually need your Windows system short times set a certain way. Now, if you have the Task Scheduler set to your user account, which the last step changed, the batch file uses your date settings, but if the Task Scheduler is set to SYSTEM, it uses SYSTEM's date setting.
In your system control panel, find "Region and Language". Set the short date format to "yy/MM/dd" and short time to "HH:mm".
http://i.imgur.com/jSJ8fsZ.png
If you don't want to change your displayed dates and times, then you can set the Task Scheduler to use SYSTEM. Change your display dates/times anyways and do the following to copy them to SYSTEM.
http://i.imgur.com/SEv9QGk.png
http://i.imgur.com/NhC8n8i.png
Then, change your display dates/times back to how you want them.
13) You may have noticed "censusdummy" in the script. The way this automation works is it checks for the most recent CensusPlus.lua file in your two/three account folders and copies it into a bare "account" folder named "censusdummy". Uniuploader works by checking when the CensusPlus.lua file changes, so when the recent file gets copied to "censusdummy", Uniuploader triggers and uploads. Check the following pictures to set this fake folder up:
http://i.imgur.com/DrsXXeK.png
http://i.imgur.com/KUgg5m8.png
http://i.imgur.com/i3E8vSt.png
SavedVariables.lua can be empty or filled with random data, as long as it's there. Uniuploader checks for that file to "verify" a correct account folder. The CensusPlus.lua file can also be empty or random, as long as it's there for you to check it in Uniuploader's right SV window.
If you had Uniuploader running, close and reopen it. You should see a "censusdummy" option in the account dropdown. Select that, the auto-upload option, and make sure CensusPlus.lua is selected in the SV list.
That's it!