Getting Help
They say that, "Good help is hard to find." And while that may be true for your human counterparts, help with computer automation is almost always just a simple internet search away, or even available on your own computer: no fancy internet required!
That programming stuff is too complicated. I wouldn’t know what I’m doing.
— Co-workers
Researching and Reading
Typically, you will be interacting with code written by other people as a tool to fulfill your automation objectives. In order to use that code, you will have to understand how to "talk" to it. This is where APIs (Application Programming Interfaces) and Documentation come in. Documentation is supposed to be a clear guide for how to interact with a function, application, or tool. This is why researching and reading are so important. So, where can you find this information?…
Built-in Help
Many command line tools, which are tools that don’t have (or don’t require) a Graphic User Interface (GUI), will have some documentation available by using /?
or -?
or --help
. On Windows, typing something like robocopy /?
will display help for the built-in "Robust Copy" program. Some commands/programs will accept a variety of things to get help. Java, for instance will take any of these: -? -h -help --help
, so java -?
or java --help
will both display the built-in help message. If have no idea how to use a command (even to get help) you can try typing only the command’s name and hitting enter. This will frequently display an error message telling you how to get help or may even display the help directly.
Online Help
Frequently you need to go online for full documentation of the programs you want to use. Microsoft API documentation is available at MSDN while many open source tools will have their documentation on their GitHub page or at the project’s website.
Here’s the problem: documentation isn’t always correct or helpful.; this is where forums can save your sanity. StackOverflow is a vast repository of answers to your random automation (and maybe even life) problems. There are many sites dedicated to a variety of applications or programming languages out there, far too many to list. One of the easiest ways to start resolving an issue is to search for it. Literally copy the error code or message that you are getting. Then go to a search engine, type the name of the command and paste the error that you received. Search.
If you’re trying to figure out how to do something, it’s often as simple as searching the language and what you want to do. For example, searching "powershell combine words" or "batch set a variable" will return more results than you could read in several lifetimes; however, one of the top results will almost certainly answer your question.
Some Words of Caution
Copying and pasting code from the internet without reading it is a recipe for disaster! So don’t do it. Read and understand what’s happening, especially with anything that deletes, copies, moves, or renames files or folders.
Similarly, you should protect yourself and your files while testing. It’s a good idea to make copies to test on or to back up files/data before you try something new. Better safe than sorry.
Be extra cautious with things that delete files or data; depending on the situation these commands may be irreversible!
In addition to protecting yourself from questionable code, understanding what’s happening can help you learn how to do things for yourself.
Here’s some more caution… Don’t try to be too clever! Doing something in an overly complex and/or convoluted way will eventually cause problems. If you find yourself doing something that you can’t clearly and concisely explain to another person in writing: stop and rethink your approach. In a few months or years when you or someone else has to make a change to your code, understanding what’s going on will be critical. If you were extremely clever the day you wrote it, you better hope you’re cleverer on the day you have to make that change.
Debugging is twice as difficult as writing the code in the first place.
Therefore, if you write code as cleverly as possible, you are, by definition, not smart enough to debug it.
— Brian Kernighan
Computer automation is a toolset that most people have access to but never actually learn how to use, which is extremely disappointing to me; it’s actually the reason that I started this blog! For more about how I plan to approach this, check out my initial post Hello World!. In my opinion most people are fully capable of automating mundane computer-based tasks out of their lives, it just takes some bravery and patience. I’ve also written about some built-in tools to help you start out command-line tools and automation.