mikesx4911
In Runtime
- Messages
- 356
- Location
- chicago, IL
Well I just started a new class COMP230 and I hate it, I do not understand really anything of the whole concept of programming I have read the book, and followed the excersies given to me. Currently I'm trying to work on a script here it is.
' VBScript:
' Written by: Michael Ikezoe
' Date: 5/9/2012
' Class: COMP230
' Professor:
' ==================================================================================
' Create name and age variables
name = "John Doe"
ageStr = 50
'Calculate Age+10 and assign to ageStr10
ageStr10 = CStr( CInt(ageStr)+10 )
' Build output as a signle string msgStr
msgStr = "Your name is " & vbTab & vbTab & name & _
vbCrLf & "Your age is " & vbTab & vbTab & ageStr & _
vbCrLf & vbCrLf & "Your Age in 10 years will be ...... " & _
ageStr10 & vbCrLf & vbCrLf & "End of Program"
WScript.Echo(vbCrLf & "Your Age in 10 years is ........... " & _
ageStr10 & vbCrLf)
WScript.Echo("End of Program")
' Pause Routine
WScript.Sleep(6000)
Here is what I am trying to accomplish. When I run my script it only shows, "Your age in 10 years is ...." I need it to say your name is John Doe, your age is 60, your age in 10 years will be 60. Where did I go wrong at? I put the name as John Doe, I put the age in at 60.
• Delete the “WScript.StdOut.WriteLine(“ portion of the remaining lines and replace it “WScript.Echo “. Also remove the closing parentheses from each of these lines. For example the line: WScript.StdOut.Writeline(“Your name is “ & vbTab & vbTab & name) would be replaced with WScript.Echo “Your name is “ & vbTab & vbTab & name. Make the same changes for the remaining lines.
• Also change the lines†name = “†to name = “John Doe†and AgeStr = “†to AgeStr = 50.
• Lastly remove WScript.StdIn.Read(1) line that we used for a pause replace it the statement WScript.Sleep(6000) which will give us a 6 second (6000 millisecs) delay before the console window closes.
• Save the program (<Ctrl>S) and press <F5>. Change “The Program to Run†to cscript C:\Scripts\PopUpWindow.vbs. Click Run. You should get the console output shown below.
I'm
' VBScript:
' Written by: Michael Ikezoe
' Date: 5/9/2012
' Class: COMP230
' Professor:
' ==================================================================================
' Create name and age variables
name = "John Doe"
ageStr = 50
'Calculate Age+10 and assign to ageStr10
ageStr10 = CStr( CInt(ageStr)+10 )
' Build output as a signle string msgStr
msgStr = "Your name is " & vbTab & vbTab & name & _
vbCrLf & "Your age is " & vbTab & vbTab & ageStr & _
vbCrLf & vbCrLf & "Your Age in 10 years will be ...... " & _
ageStr10 & vbCrLf & vbCrLf & "End of Program"
WScript.Echo(vbCrLf & "Your Age in 10 years is ........... " & _
ageStr10 & vbCrLf)
WScript.Echo("End of Program")
' Pause Routine
WScript.Sleep(6000)
Here is what I am trying to accomplish. When I run my script it only shows, "Your age in 10 years is ...." I need it to say your name is John Doe, your age is 60, your age in 10 years will be 60. Where did I go wrong at? I put the name as John Doe, I put the age in at 60.
• Delete the “WScript.StdOut.WriteLine(“ portion of the remaining lines and replace it “WScript.Echo “. Also remove the closing parentheses from each of these lines. For example the line: WScript.StdOut.Writeline(“Your name is “ & vbTab & vbTab & name) would be replaced with WScript.Echo “Your name is “ & vbTab & vbTab & name. Make the same changes for the remaining lines.
• Also change the lines†name = “†to name = “John Doe†and AgeStr = “†to AgeStr = 50.
• Lastly remove WScript.StdIn.Read(1) line that we used for a pause replace it the statement WScript.Sleep(6000) which will give us a 6 second (6000 millisecs) delay before the console window closes.
• Save the program (<Ctrl>S) and press <F5>. Change “The Program to Run†to cscript C:\Scripts\PopUpWindow.vbs. Click Run. You should get the console output shown below.
I'm