diff --git a/BatchSubsitute.bat b/BatchSubsitute.bat new file mode 100644 index 0000000..a814dad --- /dev/null +++ b/BatchSubsitute.bat @@ -0,0 +1,32 @@ +@echo off + +REM -- Prepare the Command Processor -- +SETLOCAL ENABLEEXTENSIONS +SETLOCAL DISABLEDELAYEDEXPANSION + +if /I "%~1"=="/h" goto:help +if "%3"=="" goto:help + +if "%~1"=="" findstr "^::" "%~f0"&goto:help +for /f "tokens=1,* delims=]" %%A in ('"type %3|find /n /v """') do ( + set "line=%%B" + if defined line ( + call set "line=echo.%%line:%~1=%~2%%" + for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X >> %3_new + ) ELSE echo. +) +move /Y %3_new %3 >nul + +goto:eof + +:help +echo BatchSubstitude - parses a File line by line and replaces a substring +echo. +echo Usage: %0 [oldstr] [newstr] [filename] +echo. oldstr - string to be replaced +echo. newstr - string to replace with +echo. filname - file to be parsed +echo. +goto:eof + +:eof \ No newline at end of file diff --git a/full_generate.bat b/full_generate.bat new file mode 100644 index 0000000..34e25a9 --- /dev/null +++ b/full_generate.bat @@ -0,0 +1,34 @@ +@echo off + + +setlocal ENABLEDELAYEDEXPANSION +set /a total_quotes = 0; + +REM This generates the TRUMP tweets +set /a c =-1 +for /F "tokens=*" %%A in (resource/trumpisims.txt) do ( +set /a c = c + 2 +copy /Y resource\trump.svg resource\temp.svg +CALL BatchSubsitute.bat REPLACE "%%A" resource\temp.svg +inkscape --export-png=trump_tweets/trump_tweet_!c!.png resource/temp.svg +) +set /a trump_total_quotes = !c!/2 + +REM This generates the HILLARY Tweets +set /a c =0 +for /F "tokens=*" %%A in (resource/clintonsays.txt) do ( +set /a c = c + 2 +copy /Y resource\clinton.svg resource\temp.svg +CALL BatchSubsitute.bat REPLACE "%%A" resource\temp.svg +inkscape --export-png=clinton_tweets/clinton_tweet_!c!.png resource/temp.svg +) +set /a clinton_total_quotes = !c!/2 + +set /a total_quotes = 0 + %clinton_total_quotes% + %trump_total_quotes + +echo "END GENERATE TWEETS" + + +for /L %%i in (0,1,%total_quotes%) do ( + CALL makeboard.bat +) diff --git a/get_dirs.bat b/get_dirs.bat new file mode 100644 index 0000000..d9cd191 --- /dev/null +++ b/get_dirs.bat @@ -0,0 +1,2 @@ +echo off +for /d %%a in (*) do dir /ad /on /s /b "%%a" >> get_dirs.txt \ No newline at end of file diff --git a/get_files.bat b/get_files.bat new file mode 100644 index 0000000..9e451b5 --- /dev/null +++ b/get_files.bat @@ -0,0 +1,2 @@ +echo off +for /r %%a in (*) do echo %%a >> get_files.txt \ No newline at end of file diff --git a/loopPrint.bat b/loopPrint.bat new file mode 100644 index 0000000..425ced0 --- /dev/null +++ b/loopPrint.bat @@ -0,0 +1,96 @@ +@echo off + + +setlocal ENABLEDELAYEDEXPANSION +set /a total_quotes = 0; +REM This generates the TRUMP tweets +set /a c =-1 +for /F "tokens=*" %%A in (resource/trumpisims.txt) do ( +set /a c = c + 2 +copy /Y resource\trump.svg resource\temp.svg +CALL BatchSubsitute.bat REPLACE "%%A" resource\temp.svg +inkscape --export-png=trump_tweets/trump_tweet_!c!.png resource/temp.svg +) +set /a trump_total_quotes = !c!/2 + + +REM This generates the HILLARY Tweets +set /a c =0 +for /F "tokens=*" %%A in (resource/clintonsays.txt) do ( +set /a c = c + 2 +copy /Y resource\clinton.svg resource\temp.svg +CALL BatchSubsitute.bat REPLACE "%%A" resource\temp.svg +inkscape --export-png=clinton_tweets/clinton_tweet_!c!.png resource/temp.svg +) +set /a clinton_total_quotes = !c!/2 + +echo "END GENERATE TWEETS" + +set /a total_quotes = 0 + %clinton_total_quotes% + %trump_total_quotes + +REM echo %trump_total_quotes% +REM echo %clinton_total_quotes% +REM echo %total_quotes% + +setlocal enabledelayedexpansion enableextensions +set i=-1 +FOR /L %%G IN (1,1,%total_quotes%) DO ( + + set /a i=!i!+1 + set suffled_list[!i!]=%%G +) +set lastindex=!i! + +REM for /L %%G in (0,1,!lastindex!) do ( +REM echo !suffled_list[%%G]! +REM ) +echo THIS IS THE DEBUG LOCATION +set /A tot = %total_quotes% - 1 +echo the total is %tot% +set lis= + + +for /L %%i in (0,1,%tot%) do ( + set /A ran=!RANDOM! * %tot% / 32768 + 1 + set /A j=!ran! + REM SAVE THE ORGINAL VALUE + set /A TEM= !suffled_list[%%i]! + REM SAVE THE VALUE AT THE RANDOM LOCATION + for %%j in (!j!) do set /A TEMJ = !suffled_list[%%j]! + REM set i to be the J value + set /A suffled_list[%%i] = !TEMJ! + REM set j to be the value of i + for %%j in (!j!) do set suffled_list[%%j]=!TEM! +) +echo PRINT LIST +REM for /L %%G in (0,1,!lastindex!) do ( +REM echo !suffled_list[%%G]! +REM ) +REM WE GENERATE THE BOARD FROM THE FIRST 24 + +REM We need to loop through the 25 first elements. +REM For each value returned we check if it's even or odd +REM if even we put the hilary pretext, odd we put the trump +REM we then append the number to the end so we have something like %HIL_or_trump%_tweets\%hilary_or_trump%_tweet_%number%.png +REM then this massive string is put into IMAGE MAGIC. Special case is for element 24 we just use a fixed tweet + +for /L %%G in (0,1,24) do ( + set /A temp_var=!suffled_list[%%G]! %%2 + set other_var=!suffled_list[%%G]! + IF %%G == 12 ( + set lis= !lis!resource\free.png + ) ELSE ( + IF !temp_var! == 0 ( + set lis= !lis!clinton_tweets\clinton_tweet_!other_var!.png + + ) ELSE ( + set lis= !lis!trump_tweets\trump_tweet_!other_var!.png + ) + ) +) + + +echo ONCE +call magick montage !lis! -mode Concatenate -tile 5x5 montage_array.jpg +echo other +call magick montage resource\banner.png montage_array.jpg resource\footer.png -mode Concatenate -tile x3 montage_array_Result_%RANDOM%.jpg \ No newline at end of file diff --git a/makeboard.bat b/makeboard.bat new file mode 100644 index 0000000..9ec48c9 --- /dev/null +++ b/makeboard.bat @@ -0,0 +1,68 @@ +@echo off + +setlocal ENABLEDELAYEDEXPANSION +set /a total_quotes = 0; +REM This generates the TRUMP tweets +set /a c =-1 +for /F "tokens=*" %%A in (resource/trumpisims.txt) do ( +set /a c = c + 2 +) +set /a trump_total_quotes = !c!/2 + +REM This generates the HILLARY Tweets +set /a c =0 +for /F "tokens=*" %%A in (resource/clintonsays.txt) do ( +set /a c = c + 2 +) +set /a clinton_total_quotes = !c!/2 + +set /a total_quotes = 0 + %clinton_total_quotes% + %trump_total_quotes + +REM echo %trump_total_quotes% +REM echo %clinton_total_quotes% +REM echo %total_quotes% + +setlocal enabledelayedexpansion enableextensions +set i=-1 +FOR /L %%G IN (1,1,%total_quotes%) DO ( + + set /a i=!i!+1 + set suffled_list[!i!]=%%G +) +set lastindex=!i! + +REM for /L %%G in (0,1,!lastindex!) do ( +REM echo !suffled_list[%%G]! +REM ) +set /A tot = %total_quotes% - 1 +set lis= + +for /L %%i in (0,1,%tot%) do ( + set /A ran=!RANDOM! * %tot% / 32768 + 1 + set /A j=!ran! + REM SAVE THE ORGINAL VALUE + set /A TEM= !suffled_list[%%i]! + REM SAVE THE VALUE AT THE RANDOM LOCATION + for %%j in (!j!) do set /A TEMJ = !suffled_list[%%j]! + REM set i to be the J value + set /A suffled_list[%%i] = !TEMJ! + REM set j to be the value of i + for %%j in (!j!) do set suffled_list[%%j]=!TEM! +) + +for /L %%G in (0,1,24) do ( + set /A temp_var=!suffled_list[%%G]! %%2 + set other_var=!suffled_list[%%G]! + IF %%G == 12 ( + set lis= !lis!resource\free.png + ) ELSE ( + IF !temp_var! == 0 ( + set lis= !lis!clinton_tweets\clinton_tweet_!other_var!.png + + ) ELSE ( + set lis= !lis!trump_tweets\trump_tweet_!other_var!.png + ) + ) +) +call magick montage !lis! -mode Concatenate -tile 5x5 montage_array.jpg +call magick montage resource\banner.png montage_array.jpg resource\footer.png -mode Concatenate -tile x3 montage_array_Result_%RANDOM%.jpg \ No newline at end of file diff --git a/makeboard_org.bat b/makeboard_org.bat new file mode 100644 index 0000000..afa4e38 --- /dev/null +++ b/makeboard_org.bat @@ -0,0 +1,87 @@ +@echo off + + +setlocal ENABLEDELAYEDEXPANSION +set /a total_quotes = 0; +REM This generates the TRUMP tweets +set /a c =-1 +for /F "tokens=*" %%A in (resource/trumpisims.txt) do ( +set /a c = c + 2 +REM copy /Y resource\trump.svg resource\temp.svg +REM CALL BatchSubsitute.bat REPLACE "%%A" resource\temp.svg +REM inkscape --export-png=trump_tweets/trump_tweet_!c!.png resource/temp.svg +) +set /a trump_total_quotes = !c!/2 + + +REM This generates the HILLARY Tweets +set /a c =0 +for /F "tokens=*" %%A in (resource/clintonsays.txt) do ( +set /a c = c + 2 +REM copy /Y resource\clinton.svg resource\temp.svg +REM CALL BatchSubsitute.bat REPLACE "%%A" resource\temp.svg +REM inkscape --export-png=clinton_tweets/clinton_tweet_!c!.png resource/temp.svg +) +set /a clinton_total_quotes = !c!/2 + +set /a total_quotes = 0 + %clinton_total_quotes% + %trump_total_quotes + +REM echo %trump_total_quotes% +REM echo %clinton_total_quotes% +REM echo %total_quotes% + +setlocal enabledelayedexpansion enableextensions +set i=-1 +FOR /L %%G IN (1,1,%total_quotes%) DO ( + + set /a i=!i!+1 + set suffled_list[!i!]=%%G +) +set lastindex=!i! + +REM for /L %%G in (0,1,!lastindex!) do ( +REM echo !suffled_list[%%G]! +REM ) +set /A tot = %total_quotes% - 1 +set lis= + + +for /L %%i in (0,1,%tot%) do ( + set /A ran=!RANDOM! * %tot% / 32768 + 1 + set /A j=!ran! + REM SAVE THE ORGINAL VALUE + set /A TEM= !suffled_list[%%i]! + REM SAVE THE VALUE AT THE RANDOM LOCATION + for %%j in (!j!) do set /A TEMJ = !suffled_list[%%j]! + REM set i to be the J value + set /A suffled_list[%%i] = !TEMJ! + REM set j to be the value of i + for %%j in (!j!) do set suffled_list[%%j]=!TEM! +) +REM for /L %%G in (0,1,!lastindex!) do ( +REM echo !suffled_list[%%G]! +REM ) +REM WE GENERATE THE BOARD FROM THE FIRST 24 + +REM We need to loop through the 25 first elements. +REM For each value returned we check if it's even or odd +REM if even we put the hilary pretext, odd we put the trump +REM we then append the number to the end so we have something like %HIL_or_trump%_tweets\%hilary_or_trump%_tweet_%number%.png +REM then this massive string is put into IMAGE MAGIC. Special case is for element 24 we just use a fixed tweet + +for /L %%G in (0,1,24) do ( + set /A temp_var=!suffled_list[%%G]! %%2 + set other_var=!suffled_list[%%G]! + IF %%G == 12 ( + set lis= !lis!resource\free.png + ) ELSE ( + IF !temp_var! == 0 ( + set lis= !lis!clinton_tweets\clinton_tweet_!other_var!.png + + ) ELSE ( + set lis= !lis!trump_tweets\trump_tweet_!other_var!.png + ) + ) +) +call magick montage !lis! -mode Concatenate -tile 5x5 montage_array.jpg +call magick montage resource\banner.png montage_array.jpg resource\footer.png -mode Concatenate -tile x3 montage_array_Result_%RANDOM%.jpg \ No newline at end of file