My very first practical Sikuli program with Python scripting

The thought of creating this little program starts from a very simple and funny thing; as you might not know, most of the colleges in Taiwan has internet usage limitation (around 6 ~ 8 GB per day) and NCKU is no exception. But, we have a special unlimited usage time from 5:00 AM ~ 8:00AM every day. Recently I just want to download a very large game (approximately 67 GB) and I want to maximize the download efficiency utilizing the morning unlimited time. I know that I cannot just wake up at 5 AM just for downloading a stupid game, so I decided to automate the whole process with a little program.

I first start with the logic structure of the program (only used while loop, if/else statement, simple but gold), then I realized that I need to code a time activation with codes scanning current time and comparing it to the target time I set; I dived into the python documentation and some coding notes on the Internet, and I found a way to call time and convert it into string in order to do a simple comparison (in most programming languages, different types of variables or data cannot be in any form of calculation with any operators and that includes == or = for judging the equality of two variables). After that, it just went really smooth until a final bug blocked my path to destination success. The time activation part wouldn’t work! Luckily, right before I started to write my weekly summary of English Literature, it stroke me that I put the current time variable outside the while loop, so it would only get “current time” once and that was why it failed. There is still more component I can add to this little program (user-inserted target time, even a GUI though I am not sure how to do it exactly) to make it a better tool, but the main functions and structure are completed and I am really happy and proud about it.

I’ve only learned a little bit about Python and other programming languages, but with basic coding knowledge and accurate information finding and document reading, I am able to code a tool I want. This proofs my viewpoint again: everyone has the ability to learn coding or computer science, just like learning any other things in this world; See it as a great tool for everyone, not just a hard subject for programmers and nerds.

Source Code: I uploaded it on my Github



2 thoughts on “My very first practical Sikuli program with Python scripting

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s