All Forums >> [Scripting] >> Post a VBScript >> Scripts fuctions, class, msgbox, for next, do loop, ... Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
T1 1. Write a script that produces a messagebox that says "Problem 1" in the titlebar and "CPT 180" in the body of the messagebox. msgbox
-------------------------------------------------------------------------------------------------------------- 2. Write a script that will receive 2 numbers from 2 inputboxes and output the difference of the two numbers in a messagebox. inputbox, msgbox, dim
------------------------------------------------------------------------------------------------------------- 3. Write a script that will produce a messagebox stating the scriptname and the directory the script is in. The scriptname and directory should be on separate lines in the messagebox. Wscript -> Scriptname, WshShell -> CurrentDirectory
-------------------------------------------------------------------------------------------------------------- 4. Write a script that will place an Informational Event in the Event Log. The event should say "Problem 4". WshShell -> LogEvent
------------------------------------------------------------------------------------------------------------- 5. Write a script that will produce a messagebox with the buttons Abort, Retry and Ignore. The body of the message box should say "Problem 5" and the Title Bar should say "ARI". msgbox
6. Write a script that will activate Wordpad and Notepad, and then place Wordpad in the foreground. WshShell -> Run, WshShell -> AppActivate
------------------------------------------------------------------------------------------------------------ 7. Write a program that will receive two numbers from two inputboxes. The script should then create an array of the dimension of the first number inputted, and then resized to the dimension of the second number inputted. inputbox, ArrayName(dimension), Redim
------------------------------------------------------------------------------------------------------------ T2 1. Write a script that will receive a grade from an inputbox. The script should then msgbox a letter grade based upon the size of the number. Use a 10 point scale (A = 90-100). If the input is not a number or lower than zero, the script should chide the user. Use either an IF or CASE statement.
----------------------------------------------------------------------------------------------------------- 2. Write a script that receives positive numbers as input until a negative number is inputted. The script should then output a msgbox with the sum, ave, hi and lo of the inputted numbers.
------------------------------------------------------------------------------------------------------------ 3. Write a script that receives 2 numbers as input. The script should then output into a msgbox the sum of all the numbers including and between the 2 numbers. ex 1, 5 -> 15
------------------------------------------------------------------------------------------------------------- 4. a. Write a script that creates a folder called c:\test2. b. The script should then receive a file and string as input. c. The script should create the file in c:\test2, put the string into the file and then close the file. d. The script should then make a copy of the file called test2copy.txt. e. The script should then delete the original file. f. The script should then open test2copy.txt, read the contents of the file, and place the output into a msgbox.
----------------------------------------------------------------------------------------------------------- 5. Write a script that will take in a number as input. The script should then create an array of that size and then load it with the numbers 1-inputted number.
------------------------------------------------------------------------------------------------------------- 6. Write a script that attempts to send an inputbox to the screen. Mispell the command, have an error handler catch the error and send a msgbox to the screen, apologizing for the error. The script should then log the event in the event log, stating the event description and err number. The script should then reset the err object.
-------------------------------------------------------------------------------------------------------------- T3 1. Write a script that creates a class called Doctor. Doctor should have a property of Specialty and a StateSpecialty method that msgboxes the words "My specialty is <Specialty>". The script should then pass Doctor a specialty received from an inputbox and then call it's method.
------------------------------------------------------------------------------------------------------------ 2. Write a script that will create a key in HKLM\Software\Microsoft\Mynumber called MyIncrement. The script should place the number 1 as the key value. Every subsequent time the script is executed, the number should be incremented.
------------------------------------------------------------------------------------------------------------- 3. Write a script that receives a string as input. The script should search the string for the word "test3". If test3 is found, the script should replace test3 with "cpt180test3" and msgbox the resultant string. If test3 is not found, the script should msgbox "not found" to the user.
------------------------------------------------------------------------------------------------------------- 4. Write a script that will receive a name from an inputbox. The script should then create a user account based upon that received name.
------------------------------------------------------------------------------------------------------------- 5. Write a script that will map a network drive to the folder \\****i\courses\***** to the letter T.
< Message edited by ebgreen -- 4/23/2008 5:48:13 AM >
We normally don't let people post homework here. In this case I say we make an exception. Thanks for posting this. I will point out however that T2.1 is technically wrong.
T2.3, T2.4, and T2.5 do not satisfy the problem as stated.
T2.6, T3.2, and T3.5 use On Error Resume Next without using a matching On Error Goto 0 statement. This is a habit that you shouls get into as early as possible.