Login Script to Pause

Change Page: 12 > | Showing page 1 of 2, messages 1 to 20 of 23
Author Message
cjwallace

  • Total Posts : 549
  • Scores: 0
  • Reward points : 0
  • Joined: 3/5/2005
  • Location: United Kingdom
  • Status: offline
Login Script to Pause Monday, March 07, 2005 9:17 AM (permalink)
0
Hi Guys, i have a login script that opens a html IE window to display what groups a user is in + what drives have been mapped ,

What i am trying to do is once the script has mapped all the drives instead of closing i would like it to wait for about 10 seconds before the windows closes down.

Does anyone know how to make a script pause for say 10 seconds?

I can post the .vbs script and the html code if this helps?

Many thanks

Craig
 
#1
    tnoonan

    • Total Posts : 364
    • Scores: 0
    • Reward points : 0
    • Joined: 12/14/2004
    • Location:
    • Status: offline
    Re: Login Script to Pause Monday, March 07, 2005 10:00 AM (permalink)
    0
    SecondsToDelay = "10"
    Wscript.Sleep(SecondsToDelay * 1000)
     
    #2
      token

      • Total Posts : 1917
      • Scores: 0
      • Reward points : 0
      • Joined: 1/14/2005
      • Location:
      • Status: offline
      Re: Login Script to Pause Monday, March 07, 2005 11:17 AM (permalink)
      0
      wscript.sleep 10000

      Yup, it is that easy!

      :D
       
      #3
        tnoonan

        • Total Posts : 364
        • Scores: 0
        • Reward points : 0
        • Joined: 12/14/2004
        • Location:
        • Status: offline
        Re: Login Script to Pause Monday, March 07, 2005 1:22 PM (permalink)
        0
        I always do it the way I posted incase someone who does not know vbs needs to edit the script. Should have shown both. Thnx Token
         
        #4
          token

          • Total Posts : 1917
          • Scores: 0
          • Reward points : 0
          • Joined: 1/14/2005
          • Location:
          • Status: offline
          Re: Login Script to Pause Monday, March 07, 2005 2:46 PM (permalink)
          0
          I just posted what I know and what comes to mind, the requester decides what she or he wishes to use :)

          Cheers
           
          #5
            tnoonan

            • Total Posts : 364
            • Scores: 0
            • Reward points : 0
            • Joined: 12/14/2004
            • Location:
            • Status: offline
            Re: Login Script to Pause Monday, March 07, 2005 3:01 PM (permalink)
            0
            Just stating I'm a contractor so I have to make it idoit proof. So I have to document everything and make it easy for them to alter.
             
            #6
              cjwallace

              • Total Posts : 549
              • Scores: 0
              • Reward points : 0
              • Joined: 3/5/2005
              • Location: United Kingdom
              • Status: offline
              Re: Login Script to Pause Monday, March 07, 2005 10:17 PM (permalink)
              0
              Hi Guys, Thank for your reply on this matter. I have tried both methods but my login script runs but does not pause. Below is my script can anyone please see what is wrong with it?

              Many thanks

              On Error Resume Next
              Dim WshNetwork, asdPath, User
              Dim strMappedDrives, strStatus
              Dim IE

              set shell = createobject("wscript.shell")

              shell.run ("net time \\atlas /set /yes")

              Const ADS_READONLY_SERVER = 5

              ' Display IE status window

              Call CreateIE()
              strStatus = "Withers LLP London Login Script " & Date()
              ie.document.all.wstatus.InnerText = strMsg3

              ' Get the User ID

              Set WSHNetwork = WScript.CreateObject("WScript.Network")
              strUser = ""
              While strUser = ""
              strUser = WSHNetwork.UserName
              Wend

              ie.document.all.Msg1.InnerText = strUser

              call main()

              strStatus = strStatus & vbCRLF & "Network Logon Complete..."
              ie.document.all.wstatus.InnerText = strStatus


              ' Close IE status window

              If not ie.document.all.holdit.checked then
              ie.quit()
              End if

              ' End of logon script

              Public Sub Main()

              'Main loop to detect group that user belongs to
              adsPath = "WinNT://London/" & strUser
              Set dso = GetObject("WinNT:")
              Set objUser = dso.OpenDSObject(adsPath,"","", ADS_READONLY_SERVER)
              For Each Prop In objUser.groups
              Select Case Prop.Name

              Case "Domain Users"
              Call DomainUsers()

              Case "Photos"
              Call Photos()

              Case "DigitalPhotos"
              Call DigitalPhotos()

              Case "Helpdesk"
              Call Helpdesk()

              Case "London Systems"
              Call LondonSystems()

              'etc
              End Select
              Next 'Prop

              End Sub

              Sub DomainUsers()

              strStatus = strStatus & vbCRLF & "Member of Domain Users..."
              ie.document.all.wstatus.InnerText = strStatus

              MapDrive "S:", "\\poseidon\data"
              MapDrive "V:", "\\poseidon\apps"

              shell.run ("net use \\zeus\zenapps")
              shell.run ("net use \\atlas\crispdata")

              End Sub

              Sub Photos()

              strStatus = strStatus & vbCRLF & "Member of Hebe Photos Group..."
              ie.document.all.wstatus.InnerText = strStatus

              MapDrive "P:", "\\hebe\photos"

              End Sub

              Sub DigitalPhotos()

              strStatus = strStatus & vbCRLF & "Member of Hebe JDM DigitalPhotos..."
              ie.document.all.wstatus.InnerText = strStatus

              MapDrive "Q:", "\\hebe\digitalphotos"

              End Sub

              Sub Helpdesk()

              strStatus = strStatus & vbCRLF & "Member of Hyperion ITSTUFF..."
              ie.document.all.wstatus.InnerText = strStatus

              MapDrive "I:", "\\Hyperion\itstuff"

              End Sub

              Sub LondonSystems()

              strStatus = strStatus & vbCRLF & "Member of London Systems Team..."
              ie.document.all.wstatus.InnerText = strStatus

              MapDrive "I:", "\\Hyperion\itstuff"

              End Sub

              Sub CreateIE()

              On Error Resume Next
              Set IE = CreateObject("InternetExplorer.Application")
              With IE
              .navigate "\\atlas\netlogon\uk\logon.htm"
              .resizable=0
              .height=470
              .width=350
              .menubar=0
              .toolbar=0
              .statusBar=0
              .visible=1
              End With
              Do while ie.Busy
              ' wait for page to load
              SecondsToDelay = "120"
              Wscript.Sleep(SecondsToDelay *120)
              Loop

              End Sub

              Sub MapDrive(strDrive,strShare)

              On Error Resume Next
              WSHNetwork.MapNetworkDrive strDrive, strShare

              If Err.Number Then

              WSHNetwork.RemoveNetworkDrive strDrive
              WSHNetwork.MapNetworkDrive strDrive, strShare

              End If

              strMappedDrives = strMappedDrives & strDrive & " "
              ie.document.all.Msg2.InnerText = strMappedDrives

              End Sub
               
              #7
                Zifter

                • Total Posts : 315
                • Scores: 0
                • Reward points : 0
                • Joined: 1/5/2005
                • Location: Belgium
                • Status: offline
                Re: Login Script to Pause Monday, March 07, 2005 11:04 PM (permalink)
                0
                From [url="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthsleep.asp"]msdn[/url]
                quote:
                object.Sleep(intTime)
                Arguments
                object
                WScript object.
                intTime
                Integer value indicating the interval (in milliseconds) you want the script process to be inactive

                That means you should have used tnoonan's function like this

                SecondsToDelay = "120" Wscript.Sleep(SecondsToDelay * 1000)
                HTH
                 
                #8
                  cjwallace

                  • Total Posts : 549
                  • Scores: 0
                  • Reward points : 0
                  • Joined: 3/5/2005
                  • Location: United Kingdom
                  • Status: offline
                  Re: Login Script to Pause Monday, March 07, 2005 11:19 PM (permalink)
                  0
                  Zifter, Thanks for the reply.

                  Please tell me to piss off for being thick here but why is SecondsToDelay = "120" 1000 and not 120?

                  Sorry if this is a silly question
                   
                  #9
                    Zifter

                    • Total Posts : 315
                    • Scores: 0
                    • Reward points : 0
                    • Joined: 1/5/2005
                    • Location: Belgium
                    • Status: offline
                    Re: Login Script to Pause Monday, March 07, 2005 11:54 PM (permalink)
                    0
                    Don't feel bad for asking questions, that's the purpose of this forum. And like they say, there aren't silly questions, only silly answers...

                    Actually this statement is enough: WScript.Sleep 120000 (you have to give the interval in milliseconds).

                    tnoonan made it like this

                    SecondsToDelay = "120" Wscript.Sleep(SecondsToDelay * 1000)
                    So people less comon with programming, know how to change the interval, using seconds in stead of milliseconds.
                    Both solutions give the same result. The script will pause for 2 minutes = 120 seconds = 120000 milliseconds

                    HTH
                     
                    #10
                      cjwallace

                      • Total Posts : 549
                      • Scores: 0
                      • Reward points : 0
                      • Joined: 3/5/2005
                      • Location: United Kingdom
                      • Status: offline
                      Re: Login Script to Pause Tuesday, March 08, 2005 4:38 AM (permalink)
                      0
                      Thanks Zifter for letting me know, Only problem i have now is that the script does not pause it just continues.

                      Any ideas why this may be?
                       
                      #11
                        drbelden

                        • Total Posts : 109
                        • Scores: 0
                        • Reward points : 0
                        • Joined: 12/21/2004
                        • Location: USA
                        • Status: offline
                        Re: Login Script to Pause Tuesday, March 08, 2005 5:06 AM (permalink)
                        0
                        You have used this code
                        SecondsToDelay = "120"
                        Wscript.Sleep(SecondsToDelay *120)
                        

                        This is only pausing for 120 * 120 milliseconds (a fraction of a second). The second line in the above click should be
                        Wscript.Sleep(SecondsToDelay * 1000)
                        

                        Try that
                         
                        #12
                          token

                          • Total Posts : 1917
                          • Scores: 0
                          • Reward points : 0
                          • Joined: 1/14/2005
                          • Location:
                          • Status: offline
                          Re: Login Script to Pause Tuesday, March 08, 2005 5:56 AM (permalink)
                          0
                          Actually, 120*120 = 14400, which it should pause for 14.4 seconds.

                          However, I have no clue why it wasn't working for him though.

                           
                          #13
                            beaker

                            • Total Posts : 82
                            • Scores: 0
                            • Reward points : 0
                            • Joined: 1/27/2005
                            • Location: USA
                            • Status: offline
                            Re: Login Script to Pause Tuesday, March 08, 2005 6:06 AM (permalink)
                            0
                            He has the code inside of a conditional loop whose entry criteria may not be met, so the code never runs.
                             
                            #14
                              cjwallace

                              • Total Posts : 549
                              • Scores: 0
                              • Reward points : 0
                              • Joined: 3/5/2005
                              • Location: United Kingdom
                              • Status: offline
                              Re: Login Script to Pause Tuesday, March 08, 2005 6:13 AM (permalink)
                              0
                              Guys, thanks for all your replies i cant tell you how helpfull you all have been.

                              Beaker: your right it is in a conditional loop, should this be placed else where? if so where do you think would be best?

                              Many thanks to everyone in advanced
                               
                              #15
                                beaker

                                • Total Posts : 82
                                • Scores: 0
                                • Reward points : 0
                                • Joined: 1/27/2005
                                • Location: USA
                                • Status: offline
                                Re: Login Script to Pause Tuesday, March 08, 2005 6:20 AM (permalink)
                                0
                                If you always want the script to pause at that point, get rid of the loop and just leave the pause there. Easy.
                                 
                                #16
                                  cjwallace

                                  • Total Posts : 549
                                  • Scores: 0
                                  • Reward points : 0
                                  • Joined: 3/5/2005
                                  • Location: United Kingdom
                                  • Status: offline
                                  Re: Login Script to Pause Tuesday, March 08, 2005 6:29 AM (permalink)
                                  0
                                  Beaker: Cheers mate for your help i will give it a go when i get in the office tomorrow, and let you know how i go

                                  Can i just say everyone on this site has been really useful and has not made me feel a total noob for asking questions. I just hope one day to give back to new users of the board all the help i have been getting.

                                  Thanks everyone
                                   
                                  #17
                                    token

                                    • Total Posts : 1917
                                    • Scores: 0
                                    • Reward points : 0
                                    • Joined: 1/14/2005
                                    • Location:
                                    • Status: offline
                                    Re: Login Script to Pause Tuesday, March 08, 2005 9:17 AM (permalink)
                                    0
                                    Sure. You're welcome.
                                     
                                    #18
                                      cjwallace

                                      • Total Posts : 549
                                      • Scores: 0
                                      • Reward points : 0
                                      • Joined: 3/5/2005
                                      • Location: United Kingdom
                                      • Status: offline
                                      Re: Login Script to Pause Tuesday, March 08, 2005 11:08 PM (permalink)
                                      0
                                      Hi Beaker: I have removed the loop as you said but now i get the following error message

                                      Script: Location of script
                                      Line: 141
                                      Char: 1
                                      Error: Expected Statement
                                      Code: 800A0400
                                      Source: Microsoft VBScript compilation error

                                      Any ideas whats gone wrong?
                                       
                                      #19
                                        beaker

                                        • Total Posts : 82
                                        • Scores: 0
                                        • Reward points : 0
                                        • Joined: 1/27/2005
                                        • Location: USA
                                        • Status: offline
                                        Re: Login Script to Pause Wednesday, March 09, 2005 12:23 AM (permalink)
                                        0
                                        Yes, you have to get rid of both halves of the loop, meaning the 'Do While' clause as well as the 'Loop' statement. This error happens when a loop or a decision block (If..End If) is not closed. Observing good indentation practices usually will help you catch these errors easily.
                                         
                                        #20

                                          Online Bookmarks Sharing: Share/Bookmark
                                          Change Page: 12 > | Showing page 1 of 2, messages 1 to 20 of 23

                                          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