15.04.2018 Views

programming-for-dummies

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Scripting Languages 75<br />

In comparison, typeless languages don’t care what type of data the program<br />

stores at any given time. This makes writing programs much easier because<br />

your program assumes if it’s going to yank data from a particular program,<br />

such as Microsoft Excel, the data is probably going to be the right “type”<br />

anyway, so type-checking would just be restrictive and tedious.<br />

Scripting languages are typically used in four different ways:<br />

✦ To automate repetitive tasks<br />

✦ To customize the behavior of one or more programs<br />

✦ To transfer data between two or more programs<br />

✦ To create standalone programs<br />

Book I<br />

Chapter 3<br />

Types of<br />

Programming<br />

Languages<br />

Automating a program<br />

At the simplest level, scripting languages (also called macro languages) can<br />

automate repetitive tasks that essentially record your keystrokes so you can<br />

play them back at a later time. For example, if you regularly type the term<br />

Campylobacteriosis (a disease caused by the Campylobacter bacteria), you<br />

have two choices:<br />

✦ Type that phrase manually and hope that you spell it correctly each time.<br />

✦ Type this phrase just once (the easier solution), record your keystrokes,<br />

and use those captured keystrokes to create a scripting language<br />

program that you can save and run in the future.<br />

Figure 3-6 shows a scripting language, VBA (Visual Basic <strong>for</strong> Applications), that’s<br />

captured keystrokes and saved them in a VBA scripting language program.<br />

Figure 3-6:<br />

Recording<br />

keystrokes<br />

automatically<br />

creates<br />

the<br />

equivalent<br />

VBA code in<br />

Microsoft<br />

Word.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!