COMPUTER
Lab Creating a Script to Work with Folders and Files
In this lab you will create several basic scripts using Notepad++ editor and execute the scripts using Wscript host engine.
Lab #6-1—Create a script to search for MP3 or WMA files
This script will search all files in the My Music folder and any subfolders in your User profile and create a text file ‘Music Listings.txt’ listing the names of all the .MP3 and .WMA files that are found.
Note: The script refers to the folder name Music. That is the actual folder name in the Windows 7 directory. But the display name of the shortcut you see in the Library folder is My Music. Do not confuse the two.
Step 1
Open the Notepad++.
a. From the File menu select New.
b. From the Language menu, under “V” select VB.
c. Type the following commands:
Click the thumbnail below to get a larger view of the image.
Managing Windows with Objects
a.
b. Save the script in the c:\scripts folder using Save As selection from the File menu and name the script Lab6-1.vbs.
NOTE: When saving a file created with the Notepad++ editor, make sure to type the .vbs extension after the file name, otherwise the file will be saved with the wrong extension.
Click the thumbnail below to get a larger view of the image.
Step 2
Verify that there are MP3 or WMA music files in My Music folder on your computer. In there are no music files located in your profile, simply copy a few .MP3 files (from the Public Music folder) to My Music folder prior to executing the script.
Click the thumbnail below to get a larger view of the image.
Step 3
Locate the Lab6-1.vbs script file and double click on it to execute the script. Click OK is asked by the UAC security box.
a. Take a screen print of the Wscript Host search box. ? Then Click OK in the search box.
a.
Take a screen print of the Output Message box showing successful completion of the lab.
b. Locate the ‘Music Listings.txt’ file in the My Music folder.
c.
Display the content of the file in the Notepad window. Take a screen print of the file’s content.
Click the thumbnail below to get a larger view of the image.
Lab #6-2—Create a script using WScript.Shell object to run a program
This script will run a default Calculator program.
Step 4
Open the Notepad++.
a. From the File menu select New.
b. From the Language menu, under “V” select VB.
c. Type the following commands:
Click the thumbnail below to get a larger view of the image.
d. Save the script in the c:\scripts folder using Save As selection from the File menu and name the script Lab6-2.vbs.
NOTE: When saving a file created with the Notepad++ editor, make sure to type the .vbs extension after the file name, otherwise the file will be saved with the wrong extension.
Click the thumbnail below to get a larger view of the image.
Step 5
Locate the Lab6-2.vbs script file and double click on it to execute the script. Click OK is asked by the UAC security box.
a. Make sure that the Calculator program is open on the desktop.
Step 6
Paste the screen prints showing successful completion of steps 3a, 3b & 3d in a SINGLE Word document. Name the Word document according the naming conversion listed below. Combine the Word document with Lab6-1.vbs & Lab6-2.vbs script files in a single ZIP file and submit it to the Lab #6 dropbox.
Save ALL screen prints in a SINGLE Word document and submit this document to the Lab #6 dropbox.
Submission Instructions
FOR YOUR ASSIGNMENTS TO BE DONE AT A CHEAPER PRICE PLACE THIS ORDER OR A SIMILAR ORDER WITH US NOW