Skip to content

Instantly share code, notes, and snippets.

@wandersick
Last active August 21, 2016 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wandersick/d0403cc34b63bc99f77f5f3f452be39a to your computer and use it in GitHub Desktop.
Save wandersick/d0403cc34b63bc99f77f5f3f452be39a to your computer and use it in GitHub Desktop.
Publish quotes as tweets to Twitter using twt.exe (Windows)
:: Script: quotes_en.bat
:: Version: 2.0 - 20160820
:: Platform: Windows
:: Databases: quotes_en_number, quotes_en.ini
:: Creator: wandersick - https://wandersick.blogspot.com/2016/08/auto-posting-inspirational-quotes-on.html
:: Purpose: Publish quotes as tweets to Twitter using twt.exe (Windows)
::
:: Usage: Save this script and quotes in the same folder.
:: twt.exe should be in system enviromental path.
:: Change 'English Quotes' to your blog name.
:: Ensure write access is permitted to quotes_en_number (generated by script on first run)
::
:: Quotes formatted as below should be saved in a text file named quotes_en.ini. Run/schedule this script on Windows.
::
:: “Hold faithfulness and sincerity as first principles.”= Confucius
:: “Peace cannot be kept by force. It can only be achieved by understanding.”= Albert Einstein
::
:: Caution: Be careful of chars like " (not “ or ”) in quotes that could break this script
@echo off
:: go to working dir
cd /d %~p0
if not exist quotes_en_number echo 0 >quotes_en_number
for /f "usebackq" %%i in (`type quotes_en_number`) do set skip=%%i&set skipNum=%%i
if %skip% EQU 0 (
set skip=
) else (
set skip=skip=%skip%
)
for /f "%skip% usebackq tokens=1,2 delims==" %%i in (`type "quotes_en.ini"`) do (
twt.exe %%i%%j
goto :skip
)
:skip
set /a skipNum+=1
echo %skipNum% > quotes_en_number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment