Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 19th, 2007, 01:40 PM
keep_it_simple's Avatar
keep_it_simple keep_it_simple is offline
KIS
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jul 2007
Location: USA
Posts: 1,185 keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 12 h 19 m 12 sec
Reputation Power: 490
Send a message via Yahoo to keep_it_simple
Cannot get window.setInterval logic (VBS)

hey all...i have no idea why i can't get the logic down with this...

i have an hta...in which cannot use sleep so ended up choosing window.setInterval

the problem: i have successfully displayed the loader however...my logic was off...i was displaying the loader delay>loop>display loop results

i would have said screw it...however...with large returns...this is not feasible...so...

how do i simply show a loader(animated.gif) WHILE the loop is collecting data? ...it's rather embarrassing to say...but i simply cannot get it to work

thanks

Code:
<html>
 <head>
  <title>Student Account</title>
   <style>
    div.results {width:100%;height:300px;overflow-y:scroll;}
    table {border:1px solid black;width:75%;}
    th {width:33%;background:#eee;padding-left:75px;}
    table.results {border:none;width:100%;}
    td {text-align:center;}
    img.loader {position:relative;left:50px;top:25px;}
   </style>

   <hta:application 

    windowState="normal">

  <script language="VBScript">
    Dim oConn, iTimerID
    Sub DisplayStudentAccts(sUserInput)

     If Len(sUserInput) > 0 Then     
       
      Set oRootDSE = GetObject("LDAP://RootDSE")
      sConfig = oRootDSE.Get("configurationNamingContext") 
      sDomainAdsPAth = oRootDSE.Get("defaultNamingContext")
      sAdsPath = "OU=Student Users," & sDomainAdsPAth
      Set oConn = CreateObject("ADODB.Connection")
      oConn.Provider = "ADsDSOObject"
      oConn.Open "Active Directory Provider"

      on error resume next
 
      Set oRs = oConn.Execute("SELECT cn, adspath " & _
                              "FROM 'LDAP://" & sAdsPath & "'" & _
                              "WHERE cn='" & sUserInput & "*'")

      If Not oRs.EOF Then       
       
       sRowColor = "white"  
       
       iTimerID = window.setInterval("DisplayLoader", 500,"vbscript")
       Do While Not oRs.EOF
        
        iCount = iCount + 1
        iStuAcctTot = oRs.Recordcount
        sAdsPath = oRs("ADsPath")
        Set oStudentAcct = GetObject(sAdsPath)
        dPwdLastChanged = oStudentAcct.PasswordLastChanged

       If iCount < iStuAcctTot Then 

        DisplayLoader
        
        If Len(dPwdLastChanged) = 0 Then dPwdLastChanged = "Password never set"

        sResults = sResults & "<tr bgcolor=""" & sRowColor & """>" & _
			      " <td>" & iCount & "</td>" & _
                              " <td>" & oRs("cn") & "</td>" & _
                              " <td>" & dPwdLastChanged & "</td>" & _
                              " <td><input type=""checkbox"" name=""stuacctck"" value=""" & oRs("cn") & """>" & _
                              "</tr>"

        If sRowColor = "white" Then
         sRowColor = "#eeeeee"
        Else
         sRowColor = "white"
        End If

       Else
        window.clearInterval(iTimerID)
       End If
        
       oRs.MoveNext
       Loop       

       results.innerhtml = "<table cellspacing=""1"">" & _
                           " <tr>" & _
			   "  <th>#</th>" & _
                           "  <th>Student Account</th>" & _
			   "  <th>Password Last Changed</th>" & _
                           "  <th><a href=""#"" onclick=""checkAll(stuacctck)"">Select All</th>" & _
                           " </tr>" & _
                           " <tr>" & _
                           "  <td colspan=""4"">" & _
                           "   <div class=""results"">" & _
                           "    <table class=""results"">" & _
                                  sResults & _
                           "    </table>" & _
                           "   </div>" & _
                           "  </td>" & _
                           " </tr>" & _
                           "</table>"
      Else
       results.innerhtml = "<img src=""http://webs.wichita.edu/depttools/depttoolsmemberfiles/accomp/question_mark%20(WinCE).jpg"">"
      End If
     End If
    End Sub

    Sub DisplayLoader               
     results.innerHtml = "<img class=""loader"" src=""http://www.dzone.com/images/std/ajax-loader-85.gif"">"     
    End Sub
   </script>
 </head>
 <body>
  
 
  Student Account: <input id="stuacct">
                   <input type="button" value="Go" onclick="DisplayStudentAccts(stuacct.value)">
                
  <div id="results"></div>  
 
 </body>
</html>

Reply With Quote
  #2  
Old October 20th, 2007, 11:20 PM
keep_it_simple's Avatar
keep_it_simple keep_it_simple is offline
KIS
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jul 2007
Location: USA
Posts: 1,185 keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)keep_it_simple User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 12 h 19 m 12 sec
Reputation Power: 490
Send a message via Yahoo to keep_it_simple
guess i may have posted in the wrong forum hence no replies...but if interested here is the bare boned version i came up w/ ...it may come in handy for an ad/database admin

<edit>forgot to mention...this code satifies my request....although it's a stripped down version of what i have...it does accurately display an animated gif while the process is running in the background</edit>
Code:
<html>
 <head>
  <hta:application />

  <script language="VBScript">
   Option Explicit 

   Dim oConn, oRs
   Dim oRootDSE, sRootAdsPath
   Dim i, iTimerID, iStuAcctTot, aStuAccts, sResults, sUserInput 
    
   Function CollectStudentAccts
    sUserInput = stuacct.value
       
    If Len(sUserInput) > 0 Then
     OpenActDir
     Set oRs = oConn.Execute("SELECT cn " & _
                             "FROM 'LDAP://" & GetAdsPath & "'" & _
                             "WHERE cn='" & sUserInput & "*'")
     If Not oRs.EOF Then      
      CollectStudentAccts = oRs.GetRows   
     End If 
    End If
   End Function    
   
   Sub DisplayStuAccts      
    If i <= iStuAcctTot Then       
     If i = i mod 2 Then DisplayLoader
      sResults = sResults & "<tr>" & _
                             " <td>" & aStuAccts(0,i) & "</td>" & _
                            "</tr>"
     i = i + 1
     
    Else                 
     window.clearInterval(iTimerID)          
     results.innerhtml = "<table border=""1"">" & sResults & "</table>"
     sResults = ""     
    End If          
   End Sub

   Sub DisplayLoader                   
    results.innerHtml = "<img class=""loader"" src=""http://www.dzone.com/images/std/ajax-loader-85.gif"">"     
   End Sub

   Sub Main
    If Len(stuacct.value) > 0 Then
     aStuAccts = CollectStudentAccts    
 
     If isArray(aStuAccts) Then     
      iStuAcctTot = UBound(aStuAccts,2)      
      i = 0      
      iTimerID = window.setInterval("DisplayStuAccts",1,"vbscript")
     Else      
      results.innerhtml = "No Recs"
     End If
    Else
     results.innerhtml = "Data Entry Required"
    End If      
   End Sub
   
   Function GetAdsPath
    Set oRootDSE = GetObject("LDAP://RootDSE")
    sRootAdsPath = oRootDSE.Get("defaultNamingContext")
    GetAdsPath = "CN=Users," & sRootAdsPath
   End Function

   Function OpenActDir
    Set oConn = CreateObject("ADODB.Connection")
    oConn.Provider = "ADsDSOObject"
    oConn.Open "Active Directory Provider"
   End Function       
  </script>
 </head>
 <body> 
  Student Account: <input id="stuacct">
                   <input type="button" value="Go" onclick="Main">
                
  <div id="results"></div> 
 </body>
</html>

Last edited by keep_it_simple : October 20th, 2007 at 11:23 PM.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Cannot get window.setInterval logic (VBS)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT