writing scripts (not movie scripts)

225 views

I see people saying “I wrote a script to automate my job” or “I wrote a script to search for xxxx” and I have no idea what that means besides “computer stuff.”

In: 10

12 Answers

Anonymous 0 Comments

A “script” is just a small (often scrappy) piece of computer code to solve a specific problem.

Anonymous 0 Comments

A little bit of computer code. Like a small program.

Programming is a pretty simple task, at least to start with, and so it doesn’t take a whole lot of education to automate simple tasks. Things with spreadsheets, for instance, are pretty straightforward.

Anonymous 0 Comments

Imagine you had to copy and paste the same data from one place to another every day.

A script is series of commands that automates this for you broken down into small steps that are scripted via some programming language.(vba in excel, bash in Linux, Python etc…)

One piece of the script goes to the program where to date is stored, another selects the data and so on until the whole process is completed.

This script can be run by a simple command automating all that manual work. It is a lot of upfront work to get it to work and some work to maintain it if things the script uses change but still less work on the daily.

Anonymous 0 Comments

Scripting languages are those understood by the user shells of operating systems, as opposed to being compiled into binary code that the computer hardware understands natively. Let me back up.

Usually when you write software you use a _compiler_ which takes human readable code and crunches it into the binary instructions that make sense to a computer chip. To grossly oversimplify things when you launch an application in any operating system, the operating system just tells the computer hardware “start executing this”, and the hardware starts at the program’s instruction 1.

An operating system’s shell is simply yet another program that is designed to allow the user to interact with operating system components and the computer. In Windows, the Windows Explorer program is that shell – it provides a desktop like environment, the start menu, task bar, handles running multiple programs at the same time and allows you to switch between. It also lets you open the file system in folders.

What a scripting language does is allows you to automate interactions with the operating system or various programs, so you the user don’t have to do it. And instead of compiling a program to do it (since compiled programs can interact with the operating system and other programs too) the instructions of the script are simply executed each time you “run” the script.

For example, lets say part of my job is to copy some files from one folder to another and print them to PDF, then email the PDFs to an email address. I could do each one at a time manually. Or I could write a script to do this, one file (but only 1 step instead of several), or I could write a script that just does it for however many files are in that folder. Heck, I could write a script that just sits there forever and as soon as a file shows up in that folder it PDFs it and emails it automatically.

In a similar way, lots of applications and games have their own scripting languages. Video games for example might let you script weapon auto-switches or quick hit weapon combos. Macros in Microsoft Office programs are just scripts in this context. They’re not compiled, but they are interpreted by the program or the operating system on demand.

Anonymous 0 Comments

If you have a series of commands you need to type over and over again to complete a task, you can add them to a file and “run” that file instead of typing those commands.

You can also add conditional commands to do different things based on the results of previous commands, arguments you add to the end of the script command, time of day, etc Scripts can get very complex and sophisticated… to the point where it is indistinguishable from a program.

Most software installation programs are actually scrips.

Anonymous 0 Comments

Have you ever bought a piece of furniture from IKEA? If so, you’re probably familiar with that little booklet that comes with it that shows you how to assemble it. At a high level, it’s a script. It’s a set of instructions that tell you how to accomplish a task. Sometimes those instructions are even conditional, like only needing to attach mounting brackets when you’re attaching furniture to a wall and that step can be skipped if you’re using the furniture as a free-standing item.

A computer script is basically the same thing as that instruction booklet. The only difference is that instead of being written for a human to do each step, a computer script is written for a computer to execute each step. Therefore you can build up from small things that someone else has programmed the computer to know how to do into more complex tasks that have more steps. And you can use conditional steps to make the script adapt to the current conditions or desired result.

Anonymous 0 Comments

Imagine you’re writing instructions for a 5 year old on how to make coffee. In easy to follow step by step instructions you write every step involved in making the coffee. That’s basically what ‘writing a script’ is like for a computer. Just a list of simple steps for doing a simple task written for a simple person.

It’s something that seems simple in theory but in practice can be hard to do without getting someone burnt somehow.

Anonymous 0 Comments

Just like movie scripts, computer scripts are a sequence of instructions describing what to do.

Movies:
Stand here. Say this. Wait for this to happen.

Computers:
Copy that file into that folder. Send an email to this person with this text in it.

Movie scripts are written by humans for other humans to interpret and execute/perform. This is why they use plain language and have a clear structure indicating who speaks, when, and the tone/emotion to use.

Computer scripts are written by humans (mostly) for computers to interpret and execute. So they use specific languages that are a compromise between human and computer readability.

That’s it! Just like in a movie, you can get impressive, unique, and useful results by combining a bunch of simple instructions.
It’s nice because you don’t need to act well to help make a good movie and you don’t need to be good at toggling nanoscopic transistors to copy a file. You can just write a script and give it to someone/something that CAN do it!

Anonymous 0 Comments

9 times out of 10, in my experience, what people mean by that is that they downloaded and learned how to use the program “Autohotkey”

Anonymous 0 Comments

Computer code is like a recipe. If you want to make a chocolate cake, you need ingredients, utensils and cookware, and follow a list of steps. A code is something like that, but instead of manipulating ingredients, you manipulate data through a series of steps: you store it, transform it, show it through the screen, save it in a file…

The word “script” is a bit generic in your examples, for instance it could be a macro in Excel that fetchs data from the web, formats it, paste it into a spreadsheet, calculate other cells, and save it as a file. Or it may be instructions for program that simulates user input (moving the mouse, clicking, writing…) to navigate through screens.