Microsoft WSH and VBScript Programming for the Absolute Beginner Part 11

Microsoft WSH and VBScript Programming for the Absolute Beginner by Jerry Lee Ford Part 11. If you are new to programming with Microsoft WSH and VBScript and are looking for a solid introduction, this is the book for you. Developed by computer science professors, books in the for the absolute beginner series teach the principles of programming through simple game creation. You will acquire the skills that you need for more practical WSH and VBScript programming applications and will learn how these skills can be put to use in real-world scenarios. Best of all, by the time you finish this book,. | Microsoft WSH and VBScript Programming for the Absolute Beginner Second Edition Instantiate the VBScript FileSystemObject Set FsoObject Use the FileSystem Object object s GetDrive method to set up a reference to the computer s C drive Set DiskDrive c Main Processing Section Use the FileSystemObject FreeSpace property to determine the amount of free space in MB on the C drive AvailSpace 1024 1024 Use the VBScript FormatNumber Function to format the results as a whole number AvailSpace FormatNumber AvailSpace 0 Display the amount of free space on the C drive You need 100 MB of free space to play this game. _ vbCrLf Total amount of free space is currently AvailSpace MB The script begins by instantiating the FileSystemObject as shown here Set FsoObject The script then uses this instance of the FileSystemObject to execute its GetDrive method and set up a reference to the computer s C drive Set DiskDrive c The next statement uses the FileSystemObject object s FreeSpace property to retrieve the amount of free space on the C drive AvailSpace 1024 1024 This statement divides this value by 1 024 and then again by 1 024 to present the amount of free space in megabytes. The next statement formats this value further by eliminating any numbers to the left of the decimal point. Finally the last statement displays the final result as shown in Figure . Chapter 3 VBScript Basics Figure Using the FileSystem Object to access information about disk drives. For more information on how to use the VBScript FileSystemObject see Chapter 5 Conditional Logic in which I ll show you how to create and write to Windows files to produce reports and log files. In Chapter 8 Storing and Retrieving Data I ll cover how to open and read from Windows files. Examining .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.