15.04.2018 Views

programming-for-dummies

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

76<br />

Scripting Languages<br />

Customizing a program<br />

Besides letting you automate a program, scripting languages also let you<br />

customize a program, which can make the program easier. For example, you<br />

might have a spreadsheet that calculates your company’s invoices. However,<br />

to use this spreadsheet, you need to know the specific place in the spreadsheet<br />

to type new invoice in<strong>for</strong>mation. Type this in<strong>for</strong>mation in the wrong<br />

place, and the spreadsheet doesn’t work right.<br />

To avoid this problem, you can write a program in a scripting language that<br />

can display a window with boxes to type in new invoice in<strong>for</strong>mation. Then<br />

the scripting language program automatically plugs that new in<strong>for</strong>mation in<br />

the correct place in the spreadsheet every time.<br />

For even more power, a scripting language can combine automation with<br />

customization to make programs per<strong>for</strong>m tasks on their own. If you use the<br />

Mac OS X operating system, you can use its built-in scripting language —<br />

AppleScript — to control your Macintosh.<br />

For example, you can write an AppleScript program that tells your computer<br />

to download files over the Internet at a specific time each day, move files from<br />

one folder to another while renaming those files in the process, or retrieve<br />

waiting e-mail messages and sort them into categories. Figure 3-7 shows an<br />

AppleScript program that can retrieve stock quotes off the Internet.<br />

Figure 3-7:<br />

AppleScript<br />

lets you<br />

customize<br />

and<br />

automate<br />

the Mac OS<br />

X operating<br />

system.

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

Saved successfully!

Ooh no, something went wrong!