VBScript program using WshShl.Run "Calc" works in windows 2000 but not in winXP

Following is a math game my scripting/programming class is entering. The caluculaor buttons show that they are pressed in win2000 but in winXP you only see the reults in the display. Can anyone tell me what I need to do different for calc in XP?

Hint: You need to enter the wrong answer to get the calc, so for once in your math life, make a mistake.

'*************************************************************************
'Script Name: Mathgame.vbs
'
'Description: This script prompts the user to solve a mathematical
'expression and demonstrates how to solve it in the event that the user
'cannot
'*************************************************************************

'Initialization Section

Option Explicit

Dim WshShl, QuestionOne, Proveit

'Define the title bar message to be displayed in the script's
'pop-up dialog
Const cTitlebarMsg = "The Math Game"

'Instantiate an instance of the WshShell object
Set WshShl = WScript.CreateObject("WScript.Shell")

'Present the player with the equation
QuestionOne = InputBox("What is the sum of 1 + 5 * 9 / 3 ?", cTitlebarMsg)

'See if the player provided an answer
If Len(QuestionOne) = 0 Then
  MsgBox "Sorry. You must enter a number to play this game."
  WScript.Quit
End If

'Make sure that the player typed a number
If IsNumeric(QuestionOne) <> True Then
  MsgBox "Sorry. You must enter a number to play this game."
  WScript.Quit
End If

'Check to see if the player provided the correct answer  
If QuestionOne = 16 Then
  MsgBox "Correct! You obviously know your math!"
Else
  ProveIt = MsgBox("Incorrect. Do you want to see me solve the " & _
  "equation?", 36, cTitlebarMsg)

  If ProveIt = 6 Then 'Player wants to see the solution
 
    'Start the WordPad application
    WshShl.Run "WordPad"

    'Pause script execution to give Windows enough time to load WordPad
    WScript.Sleep 2000

    'Use WordPad to show the player how to solve the equation

    WshShl.SendKeys "To answer this question you must follow the " & _
      "correct order of precedence when performing your calculations."

    WScript.Sleep 2000
    WshShl.SendKeys "~~"
    WshShl.SendKeys "1st, working from left to right multiply 5 * 9."
    WScript.Sleep 2000
    WshShl.SendKeys "~~"
    WshShl.SendKeys "2nd, divide the result by 3."
    WScript.Sleep 2000
    WshShl.SendKeys "~~"
    WshShl.SendKeys "3rd, add 1."
    WScript.Sleep 2000
    WshShl.SendKeys "~~"
    WshShl.SendKeys "The final answer is 16."
    WScript.Sleep 2000
    WshShl.SendKeys "~~"
    WshShl.SendKeys "~~"
    WshShl.SendKeys "In case you question my math..... watch this!"
    WScript.Sleep 2000
    WshShl.SendKeys "%{F4}"
    WshShl.SendKeys "%{N}"

    'Start the Calculator application
    WshShl.Run "Calc"

    'Use the Calculator application to solve the equation
    WScript.Sleep 2000
    WshShl.SendKeys 5 & "{*}"
    WScript.Sleep 2000
    WshShl.SendKeys 9
    WScript.Sleep 2000
    WshShl.SendKeys "~"
    WScript.Sleep 2000
    WshShl.SendKeys "{/}" & 3
    WScript.Sleep 2000
    WshShl.SendKeys "~"
    WScript.Sleep 2000
    WshShl.SendKeys "{+}" & 1
    WScript.Sleep 2000
    WshShl.SendKeys "~"
    WScript.Sleep 2000
    WshShl.SendKeys "%{F4}"
  End If
End If
rivercityAsked:
Who is Participating?
 
grayeCommented:
Yep, it works... I just copied the CALC.EXE from Win2k to WinXP, and when I press a number key on the keyboard, it flashes on the calculator
0
 
sr75Commented:
I ran your script to see what you were talking about,  You want to get the calculator buttons to be shown as being pushed like they usually are in Windows 2000?

Well, XP's calc doesn't push the buttons when you use the keyboard to enter in the numbers.  So I don't think it is programically possible using the sendkeys method or any other method with vbscript.  Its the calc program itself that is the issue, not the script you are using.
0
 
dasmcseCommented:
Rivercity,
I have XP Sp2 and your script works perfectly from wcscript and cscript. You may want to check your XP installation make sure it's up to date.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
grayeCommented:
.... so just copy the calc.exe from Win2k and copy it somewhere on the WinXP box (don't overwrite the original).   Then modify the script to use the path to the older version of calc.exe
0
 
mackengaCommented:
graye: I'm unsure if that will work; I'm under the impression that calc.exe is the same in both cases anyway.  The difference is the way Windows shows the buttons.

I can't try it since I'm in the stone age and haven't got an XP box on my network, but I suggest trying swiching themes in XP - maybe you'll see the buttons move if you're in the Windows Classic style.  I can't test it, but if copying over calc doesn't work this must be worth a try.

Hope this helps.
0
 
Shane Russell2nd Line Desktop SupportCommented:
If you that badly want to make the buttons appear to be moving how you want ( and you have a programming enviroment of some description ( Even vb 2005 ) or something like that. why not make your own calculator with buttons that move ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.