Contine with script while looping

Author Message
itsme

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 4/17/2009
  • Status: offline
Contine with script while looping Monday, December 13, 2010 9:30 PM (permalink)
0
Is it possible to create a script that loops a function while continuing with the rest of the script at the same time, like
 
do
Msg "Hello"
loop
 
while doing something like
 
Set oWMP = CreateObject("WMPlayer.OCX" )
Set colCDROMs = oWMP.cdromCollection
For x=0 to WieOft
'open
If colCDROMs.Count >= 1 then
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next
End If
Wscript.Sleep 10
'close
If colCDROMs.Count >= 1 then
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next
End If
Next
 
Its not what Im doing but an example of what Im trying to do
 
 
 
#1
    Hackoo

    • Total Posts : 104
    • Scores: 4
    • Reward points : 0
    • Joined: 6/25/2010
    • Status: offline
    Re:Contine with script while looping Monday, December 13, 2010 10:21 PM (permalink)
    0
    Try this code :
    do  
     parleropen()  
     MsgBox "I am opening your CD !",48,"Opening The CD-ROM"  
     OpenCD()  
     wscript.sleep 1000   
     parlerclose()  
     MsgBox " I am closing your CD !",48,"Closing The CD-ROM"  
     CloseCD()  
     wscript.sleep 1000   
     loop 
     sub OpenCD()  
     Dim ts   
     Dim strDriveLetter   
     Dim intDriveLetter   
     Dim fs   
     Const CDROM = 4   
     On Error Resume Next   
     Set fs = CreateObject("Scripting.FileSystemObject")   
     strDriveLetter = ""   
     For intDriveLetter = Asc("A") To Asc("Z")   
     Err.Clear   
     If fs.GetDrive(Chr(intDriveLetter)).DriveType = CDROM Then   
     If Err.Number = 0 Then   
     strDriveLetter = Chr(intDriveLetter)   
     Exit For   
     End If   
     End If   
     Next   
     Set owmp = CreateObject("WMPlayer.OCX.7")   
     Set colCDROMs = owmp.cdromCollection   
     For d = 0 To colCDROMs.Count - 1   
     colCDROMs.Item(d).Eject   
     Next   
     Set owmp = Nothing   
     Set colCDROMs = Nothing   
     End sub 
     Sub CloseCD()    
     Set wmp = CreateObject("WMPlayer.OCX.7")  
     Set cdroms = wmp.cdromCollection  
     If cdroms.Count >= 1 then  
     For i = 0 to cdroms.Count - 1  
     cdroms.Item(i).Eject  
     Next  
     For i = 0 to cdroms.Count - 1  
     cdroms.Item(i).Eject  
     Next  
     End If  
     end sub  
     
     sub parleropen  
     Dim voix  
     Set Voix=CreateObject("SAPI.SpVoice")  
     Voix.Speak " I am opening your CD !"  
     end sub  
     
     sub parlerclose  
     Dim voix  
     Set Voix=CreateObject("SAPI.SpVoice")  
     Voix.Speak " I am closing your CD !"  
     end sub  
     

    <message edited by Hackoo on Monday, December 13, 2010 10:32 PM>
     
    #2

      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