Scheduling the script
In this section, you'll learn how to schedule the script using the Windows Task Scheduler. Scheduling the script will require the creation of a batch file. Batch files can contain scripts and operating system commands. The batch file will then be added to the Windows Task Scheduler to run at a specific time interval. To do this follow these steps:
Open Notepad.
Add the following lines of text to the file. These lines of code will switch the directory where the Python script is stored and execute the script, passing in a name for the output feature class and the number of hours to be monitored for tweets. You can change this value if you'd like:
cd c:\ArcGIS_Blueprint_Python\ch9 python tweepy_stream.py Tweets 48
Save the file to your desktop as
MonitorTweets.bat
. Make sure you change the Save As Type drop-down list to All Files; otherwise, you'll end up with a file calledMonitorTweets.bat.txt
.Open the Windows Task Scheduler by navigating to Start | All Programs | Accessories...