Forgot your password?

Reasons To Learn How to Script Windows Or Mac OSX

By Edited Feb 29, 2016 0 0

We are use computers every day. Many of us are now glued to them for over eight hours a day, often doing repetitive tasks like searching certain websites or uploading/moving files. Basic scripting skills can help us to be more productive by automating some aspects of our work. In this article we are going to look at how scripting might be able to help us to achieve more at work and why you might want to learn a little bit about how to do it.

Reasons you might want to learn how to script

Some of the reasons I wanted to learn how to script included:

  • Making applications interact with each other quickly - such as converting PowerPoint’s to OneNote documents with text intact.
  • Activating certain work mode - close all applications then only open certain ones such as office apps and load a couple of folders up.
  • A basic introduction to how to program a computer - I always wanted to learn how to program but didn’t really get much "usable" results from learning languages like Python (even though that language is regarded as a scripting language).
  • You don’t want to write a new program - linking programs can get the same results as expensive pieces of software, and by scripting you can get only the results you really want out of the program.

When you shouldn’t be scripting things

Sadly, I am going to start out saying which situations you should stop thinking about scripting. A script is dumb, that is it can only do what it is programmed to do. If you make decisions, even very small ones, on an item by item basis then en-masse scripting wont help you. If parts of your workflow are very reproducible and take in X, do the same things to X the spit Y out - you are likely to be in business with something capable of being completely or partially scripted.

If you are really struggling on whether you can script your workflow or not, write down every step you do in a bulleted list, down to the minute details like opening an application and selecting the bold font design. If you see patterns then those are what could be scripted.

Your options on Mac or Windows

Mac OSX and Windows are the platforms I am going to talk about now. Linux does have its own scripting languages (some of what I will talk about have "ports" to Linux) but I have no experience of them so I would rather you search the interwebs for additional information than follow someone who knows very little.

Scripting on Windows is how I was introduced to programming and showed that it could do something really useful for me. I found a language called AutoHotkey, installed it and fell in love with its simplicity in creating certain things. The main aspect is the ease at which you can produce basic Windows GUIs - that is the application windows. Languages like Python can take a lot of time, but AutoHotkey has the support built in and makes it really easy to link the GUI to the script. Its most basic function is as a text expander utility, and I’m sure most people use the language for purely that. You can type text like "brb" and have it automatically expand to "be right back", or any combination imaginable. You can save a lot of time doing things like that - think standardized replies to people or anything to save you writing out lots of text again and again. However I think you will be wasting the language's power if that is all you do, when you use it to start "gluing" Windows applications together is when it becomes most powerful. The only issue with AutoHotkey is that unlike Applescript, it isn’t built into the operating system so certain applications and things might need more tweaking, but it does enable you to interact with everything on the screen like a user does - including recording mouse movements, clicks and keyboard strokes.

Mac OSX has a built in language called AppleScript. It was introduced with OSX and it is the popular way of writing quick scripts for use in OSX. It relies on application developers writing AppleScript libraries that can be used to do certain fixed things. In this aspect it is very similar to AutoHotkey and is in fact more powerful, but it also lacks AutoHotkey’s basic scripting functions such as clicking the mouse and sending certain keys/text to applications. I regard AppleScript as more of a programming language, and in deed whole programs have been produced using nothing but AppleScript. I currently use OSX with several AppleScripts - but still have Windows XP installed for basic applications that I have written from scratch in very little time.

Resources for each topic

I have never paid for any resources regarding both AppleScript and AutoHotkey. There aren’t really any books on using AutoHotkey, although there are many to do with AppleScript (but not many that seemed to have been launched recently using the current versions of OSX).

The best resource for both languages is forums. AutoHotkey has its own dedicated website where you can download the installation file for the language, but it also has examples of code and the best documentation for a language I have ever come across. The ease at which you can find how to do certain things is unbelievable and the forum will have examples of virtually everything you might possibly want to do, and more. It is also very helpful with a section for asking for help as well as an IRC channel for getting immediate feedback on scripts or problems you are struggling with.

AppleScript has an official forum as part of Apple's developer network, but there are also good website such as MacScripter.net and other, which offer lots of code examples and support for when you get stuck (and you inevitably will become).

How to learn the topic

I think the best way of learning any language is to learn by example. Look at basic bits of code, run them to see what they do (make sure they are from a reputable source), mess with them, fix them and so on. Write your own versions of the code and see how things can be done differently. Ask lots of questions but make sure you do your research first, most forums are helpful but not if a problem is answered in an FAQ - although ironically you probably wont know what to look for in the FAQ to fix your issue.

The stages or learning objectives

I would advise you follow the basic steps to learn a scripting language:

  • Write a hello world application - this is basic programming law!
  • Do something basic like make a GUI or the mouse move.
  • Start on the reason you wanted to learn how to script - but make sure you break your problem down into its smallest parts.

I am not a coding or scripting master. But I have learnt basic scripting skills over the last couple of years. I think I approached it the wrong way and so by following the above method I think you should be able to learn coding more quickly. My last tip - struggle on, ask for help and enjoy the learning process - but also think of the results when things get hard.



Add a new comment - No HTML
You must be logged in and verified to post a comment. Please log in or sign up to comment.

Explore InfoBarrel

Auto Business & Money Entertainment Environment Health History Home & Garden InfoBarrel University Lifestyle Sports Technology Travel & Places
© Copyright 2008 - 2016 by Hinzie Media Inc. Terms of Service Privacy Policy XML Sitemap

Follow IB Technology