vbscript based MathPad - just type and get answers; use all vbs + user defined functions.

Author Message
u jayakodi

  • Total Posts : 17
  • Scores: 0
  • Reward points : 0
  • Joined: 9/30/2010
  • Status: offline
vbscript based MathPad - just type and get answers; use all vbs + user defined functions. Wednesday, October 26, 2011 11:28 PM (permalink)
0
Impressed by the Immediate Window of vba / vb6 IDE, that not only debugs - but is a math-pad, I set out to make this tiny utility enclosed as zip file.
Feedback / suggestions to jayakodiu@yahoo.com
 
#1
    u jayakodi

    • Total Posts : 17
    • Scores: 0
    • Reward points : 0
    • Joined: 9/30/2010
    • Status: offline
    Re:vbscript based MathPad - just type and get answers; use all vbs + user defined function Wednesday, October 26, 2011 11:36 PM (permalink)
    0
    I could not attach the zip file; the full text of html+vbs is:
     
    <html>
    <head><title>vbsMathPad   ...by jayakodi</title></head>
    <body onload="mpd.focus();"><font color="#FF0000" size="4">vbs</font><font face="Arial" size=6>MathPad</font>
    <input style="position:absolute;left:400;top:25" type="button" value="Clear" onclick="document.location.reload();">
    <input style="position:absolute;left:460;top:25" type="button" value="Help" onclick="window.open('mathlp.htm',null,'left=0,top=0,width=550,height=520,status=no,toolbar=no,menubar=no,location=no');"><br>
    <textarea rows=15 cols=60 onkeyup=kup() style="background:#eeeeee;font-family: Courier New; border-style: solid; border-width: 1" name="mpd"></textarea><br>
    </body>
    <script language=vbs>
    dim zx(100),zy(100)
    dim zl,pi
    zl=1
    pi=4*atn(1)
    sub kup()
    kk=window.event.keycode:zs=mid(mpd.value,zl)
    if kk=13 then
    on error resume next
    v=instr(zs,"?")
    if v>0 then
     if v=1 then mpd.value=mpd.value+cstr(eval(mid(zs,v+1)))+vbcrlf
     if v>1 then
    zs=ucase(zs):zsn=1:zen=1
    if instr(zs,"FOR")>0 then
    zm=left(zs,instr(zs,":")-1):zsn=instr(zm,"="):zn=instr(zm,"TO")
    zen=csng(mid(zm,zn+3)):zsn=csng(mid(zm,zsn+1,zn-zsn-2))
    zsr=mid(zs,1+instr(zs,":")):zn2=instr(zsr,"NEXT")
    zs=mid(zsr,1,zn2-2)
    end if
    zt=split(zs,":"):znu=ubound(zt)
    for i=zsn to zen
    for j=0 to znu
    zz=zt(j):zk=instr(zz,"?")
    if zk>0 then mpd.value=mpd.value+cstr(eval(mid(zz,2)))+vbcrlf else execute zz
    next
    next
     end if
     else execute zs
    end if
    zl=len(mpd.value)+1:v=0:mpd.scrolltop=10000
    end if
    end sub
    function rtd(zg)
    zdg=180*zg/(4*atn(1))
    mpd.value=mpd.value+cstr(zdg)+vbcrlf
    end function
    Function dtr(zg)
    zdg=4*atn(1)*zg/180
    mpd.value=mpd.value+cstr(zdg)+vbcrlf
    End Function
    Function ang(x1, y1, x2, y2)
    dx = x2 - x1
    dy = y2 - y1
    pi=4*atn(1)
    If Abs(dx) < 1E-16 Then
    zg = pi / 2
    Else
    zg = Abs(Atn(dy / dx))
    End If
    If dx < 0 Then zg = pi - zg
    If dy < 0 Then zg = 2 * pi - zg
    zg=rtd(zg)
    mpd.value=mpd.value+cstr(zg)+vbcrlf
    End Function
    </script>
    </html>
     
    #2
      u jayakodi

      • Total Posts : 17
      • Scores: 0
      • Reward points : 0
      • Joined: 9/30/2010
      • Status: offline
      Re:vbscript based MathPad - just type and get answers; use all vbs + user defined function Wednesday, October 26, 2011 11:47 PM (permalink)
      0
      The Zip file that failed to attach to original post had this help text:
       
      vbsMathPad Help Note:
      VBA / VB6 IDE has an Immediate Window for debugging a program being written there; it can also be used as a mathpad for calculations and all VB functions, except that the Dim statements shall be in the module for using dimensioned variables. Such math pad functionality is available in this tiny utility using vbs.
       
      In our Mathpad you can query with "?" to get answers; you can use variables and all vbs functions like sin, log etc; use colon ":" for compound statements; dimensioned variables shall be initiated first like the built-in Dim zx(100), zy(100) in the program.
       
      Constants can be defined like the built-in maths constant pi; such names as zx, zy, pi and keywords of VBS shall not be used as ordinary variables. Create and use your own functions like the 3 model built-in functions ang, rtd and dtr for angles between 2 points, radianToDegrees and degreesToRadians; call them merely as
      ang 100,100,200,200
      Variables are remembered throughout the session
      Click 'Clear' for clearing all values and for new set; Click 'Help' for this help.
      Sample usage:
      ?45.2*1.2
      54.24
      a=45
      b=15
      c=a*b
      ?c
      675
      r=4:area=pi*r*r:peri=2*pi*r
      ?area
      50.2654824574367
      ?peri
      25.1327412287183
      a=atn(1)
      rtd a
      45
      ?sin(0.5)
      0.479425538604203
      ?1.25^2.75
      1.84715158008433
      ?log(2)
      0.693147180559945
      ?formatnumber(1/3,3)
      0.333
      for i=0 to 10:zx(i)=i:next
      for i=4 to 8:?zx(i):next
      4
      5
      6
      7
      8
      a="asf"
      b="wer"
      ?a+b
      asfwer
      ?instr(a+b,"w")
      4
       
      #3
        59cobalt

        • Total Posts : 981
        • Scores: 91
        • Reward points : 0
        • Joined: 7/17/2011
        • Status: offline
        Re:vbscript based MathPad - just type and get answers; use all vbs + user defined function Thursday, October 27, 2011 7:31 AM (permalink)
        0
        Basically, this is a VBScript shell. I use something similar that runs in a command prompt (pimped it a little after stealing it from here).
         
        #4
          wenbibi

          • Total Posts : 11
          • Scores: 0
          • Reward points : 0
          • Joined: 12/18/2011
          • Status: offline
          Re:vbscript based MathPad - just type and get answers; use all vbs + user defined function Sunday, December 18, 2011 4:28 PM (permalink)
          0

          One is always on a strange road, watching strange scenery and listening to strange music.   Edmonton Escort Then one day, you will find that the things you try hard to forget are already gone. Edmonton EscortHappiness is not about being immortal nor having food or rights in one's hand.  Edmonton Asian Escort It’s about having each tiny wish come true, or having something to eat when you are hungry or having someone's love when you need love. Edmonton Asian Escort
           
          #5

            Online Bookmarks Sharing: Share/Bookmark

            Jump to:

            Current active users

            There are 0 members and 1 guests.

            Icon Legend and Permission

            • 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
            • Read Message
            • Post New Thread
            • Reply to message
            • Post New Poll
            • Submit Vote
            • Post reward post
            • Delete my own posts
            • Delete my own threads
            • Rate post

            2000-2012 ASPPlayground.NET Forum Version 3.9