Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Scripts fuctions, class, msgbox, for next, do loop, ...

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,59396
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
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!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Scripts fuctions, class, msgbox, for next, do loop, ... - 4/23/2008 2:57:00 AM   
  drawls

 

Posts: 4
Score: 0
Joined: 2/11/2008
Status: offline
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 >
 
 
Revisions: 1 | Post #: 1
 
 RE: Scripts fuctions, class, msgbox, for next, do loop,... - 4/23/2008 3:06:00 AM   
  ebgreen


Posts: 4408
Score: 29
Joined: 7/12/2005
Status: offline
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.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to drawls)
 
 
Post #: 2
 
 RE: Scripts fuctions, class, msgbox, for next, do loop,... - 4/23/2008 3:17:25 AM   
  ebgreen


Posts: 4408
Score: 29
Joined: 7/12/2005
Status: offline
Ok, some further comments:

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.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Scripts fuctions, class, msgbox, for next, do loop,... - 4/23/2008 5:19:55 AM   
  TNO


Posts: 974
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Code blocks please...

_____________________________

Consolidated Script Component: Now in Testing stage!

A universe of complexity...

(in reply to ebgreen)
 
 
Post #: 4
 
 RE: Scripts fuctions, class, msgbox, for next, do loop,... - 4/23/2008 5:48:54 AM   
  ebgreen


Posts: 4408
Score: 29
Joined: 7/12/2005
Status: offline
Done. Although I think it actually makes the post longer.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to TNO)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Scripts fuctions, class, msgbox, for next, do loop, ... Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts