Who can translate JScript to VBScript? 
Author Message
 Who can translate JScript to VBScript?

see inline...

If I made any goofs, I'll leave it up to you to figure them out.  I'm sure you'll see a pattern emerging as you go.  Translating JScript to VBScript is pretty mechanical and predictable ;-)...

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--

Quote:
> I have allredy Translated a Part of It.
> But cant translate all, see this code:

> <%
> function Disconnect(objRS)
> set objRS.ActiveConnection = nothing
> end function

> function TreeCount(objRSCats, objRSLinks, intID)
> Dim arrSons, intLinks, i
> intLinks="0"
> objRSCats.Filter = "PARENT_ID = " & intID
> if objRSCats.EOF then
> -|||||   arrSons = new VBArray(objRSCats.GetRows(adGetRowsRest,
> adBookmarkFirst, 'CAT_ID')).toArray();

        arrSons = objRSCats.GetRows(adGetRowsRest, adBookmarkFirst, "CAT_ID")

Quote:
> -|||||   for (i = 0; i < arrSons.length; i++)

    For i=0 to UBound(arrSons)-1

Quote:
> -|||||    intLinks += TreeCount(objRSCats, objRSLinks, arrSons[i]);

        intLinks = intLinks + TreeCount(objRSCats, objRSLinks, arrSons(i))

where the arrSons[i] array element reference translates to arrSons(i)

Quote:
> objRSLinks.Filter = "LINK_CAT_ID = " & intID
> -|||||  intLinks += objRSLinks.RecordCount;

        intLinks = intLinks + objRSLinks.RecordCount

Quote:
> -|||||  if (intID > 0){

        If (intID > 0) Then

Quote:
> objRSCats.Filter = "CAT_ID = " & intID
> -|||||   objRSCats.Update('LinkCount', intLinks);

        objRSCats.Update "LinkCount", intLinks

Quote:
> -|||||  }

        End If

Quote:
> -|||||  return intLinks;

        TreeCount = intLinks

Quote:
> -||||| }

    End Function

Quote:
> -||||| function Dump(objRS){

    Function Dump(objRS)

Quote:
> -|||||  objRS.Filter = adFilterNone;

        objRS.Filter = adFilterNone

Quote:
> -|||||  Response.Write(objRS.GetString(2, -1, ', ', '<br>', ''));

        Response.Write objRS.GetString(2, -1, ", ", "<br>", "")

Quote:
> end function

> function Calc()
> Dim strCon, strSQL, objCon, objRSCats, objRSLinks
> strCon = 'Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data
> Source=E:\\SERVER\\WWWROOT\\tdnod\\db\\test.mdb'
> objCon = Server.CreateObject("ADODB.Connection")
> objCon.Open(strCon)
> strSQL = "SELECT CAT_ID, CAT_NAME, PARENT_ID, CAT_ID AS LinkCount FROM CATS"
> objRSCats = Server.CreateObject("ADODB.Recordset")
> objRSCats.CursorType = adUseClient
> objRSCats.CursorLocation = adOpenStatic
> objRSCats.LockType = adLockOptimistic
> objRSCats.Open(strSQL, objCon)
> -|||||  objRSCats(0).Properties('Optimize') = true;
> -|||||  objRSCats(2).Properties('Optimize') = true;
> -|||||  Disconnect(objRSCats);

        objRSCats(0).Properties("Optimize") = true
        objRSCats(2).Properties("Optimize") = true
        Disconnect objRSCats

Quote:
> strSQL = "SELECT LINK_ID, LINK_NAME, LINK_CAT_ID FROM LINKS"
> objRSLinks = Server.CreateObject("ADODB.Recordset")
> objRSLinks.CursorType = adUseClient
> objRSLinks.CursorLocation = adOpenStatic
> objRSLinks.LockType = adLockReadOnly
> objRSLinks.Open(strSQL, objCon)
> -|||||  objRSLinks(2).Properties('Optimize') = true;
> -|||||  Disconnect(objRSLinks);
> -|||||  TreeCount(objRSCats, objRSLinks, 0);
> -|||||  Dump(objRSCats);

        objRSLinks(2).Properties("Optimize") = true
        Disconnect objRSLinks
        TreeCount objRSCats, objRSLinks, 0
        Dump objRSCats

- Show quoted text -

Quote:
> objRSCats.Close
> objRSLinks.Close
> objCon.Close
> end function
> %>

> -|||||  = not translated JScript Code
> in Attachment is the Orginal JScript Code.

> Thanx
> Michael Roth



Sun, 29 Aug 2004 09:19:43 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. How Can I translate this vbscript to Jscript

2. Help translate short VBscript to JScript?

3. Urgent: How to Translate VBScript to JScript.

4. VBScript translated to JScript

5. How to translate this from VBscript into JavaScript?

6. translating from vba to vbscript

7. Translating Old Source Code to VBScript - Fortran 77

8. Please help to translate Javascript to VBscript

9. Translating PostScript to EPS

10. Translating MacDraw/Paint to Postscript

11. Illustrator clips and translates my PostScript

12. basic formulas for scale, translate, ... needed

 

 
Powered by phpBB® Forum Software