RSS Forums RSS
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 2377 | Replies: 9
Reply
Join Date: May 2006
Posts: 6
Reputation: creex is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
creex creex is offline Offline
Newbie Poster

timer or something diffrent

  #1  
May 2nd, 2006
Hey, I need to write program, which will do some action after 11 minutes.
I have that action done, but I dont know how to write to wait 11 minutes, and how to write to wait 20 secs after 1 action.

      Private Sub Command1_Click()
Dim hWnd As Long

  hWnd = FindWindowByCaption("welcome to mia's website  - Mozilla Firefox")
    If hWnd = 0 Then
      MsgBox "Window not found", vbCritical, "Fehler"
    Else
      
      Call BringWindowToTop(hWnd):
      Call SendKeys("TAB", True)
      Call SendKeys("{ENTER}", True)
      Call SendKeys("{F5}", True)
    
    End If
End Sub

It need to wait 20 secs after Call SendKeys("{ENTER}", True) and it need to wait 11 minutes after F5 then it need to do the same action (TAB > 20 secs, ENTER). Thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2005
Location: West Yorkshire, England
Posts: 72
Reputation: purplegerbil is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 6
purplegerbil's Avatar
purplegerbil purplegerbil is offline Offline
Junior Poster in Training

Re: timer or something diffrent

  #2  
May 2nd, 2006
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
 
 
Public Sub Wait(Seconds As Single)
 Dim lMilliSeconds As Long
 lMilliSeconds = Seconds * 1000
 Sleep lMilliSeconds
End Sub




wait 660
this will wait for 11 minutes.
Reply With Quote  
Join Date: May 2006
Posts: 6
Reputation: creex is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
creex creex is offline Offline
Newbie Poster

Re: timer or something diffrent

  #3  
May 2nd, 2006
thanks And how to make loop?
Reply With Quote  
Join Date: May 2006
Posts: 6
Reputation: creex is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
creex creex is offline Offline
Newbie Poster

Re: timer or something diffrent

  #4  
May 2nd, 2006
how to make loop? It need to do that action all the time
Reply With Quote  
Join Date: Apr 2005
Location: West Yorkshire, England
Posts: 72
Reputation: purplegerbil is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 6
purplegerbil's Avatar
purplegerbil purplegerbil is offline Offline
Junior Poster in Training

Re: timer or something diffrent

  #5  
May 2nd, 2006
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


Private Sub Command1_Click()
Dim hWnd As Long

  hWnd = FindWindowByCaption("welcome to mia's website  - Mozilla Firefox")
    If hWnd = 0 Then
      MsgBox "Window not found", vbCritical, "Fehler"
    Else
      
      Call BringWindowToTop(hWnd):
      Call SendKeys("TAB", True)
      Call SendKeys("{ENTER}", True)
      Wait 20
      Call SendKeys("{F5}", True)
      Wait 660

    End If
End Sub





Public Sub Wait(Seconds As Single)
     Dim lMilliSeconds As Long
     lMilliSeconds = Seconds * 1000
     Sleep lMilliSeconds
End Sub


Not sure what you mean about looping?
Do you want to repeat

      Call SendKeys("TAB", True)
      Call SendKeys("{ENTER}", True)
      Wait 20
      Call SendKeys("{F5}", True)
      Wait 660

A set number of times?
If so you could wrap it in a for..Next loop




pG
Reply With Quote  
Join Date: May 2006
Posts: 6
Reputation: creex is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
creex creex is offline Offline
Newbie Poster

Re: timer or something diffrent

  #6  
May 2nd, 2006
I want to make something, what can repeat that program action all the time. I dont want want to copy and paste that code 1000 times
Reply With Quote  
Join Date: May 2006
Posts: 6
Reputation: creex is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
creex creex is offline Offline
Newbie Poster

Re: timer or something diffrent

  #7  
May 2nd, 2006
sipmly, I want to repeat

Call SendKeys("TAB", True)
Call SendKeys("{ENTER}", True)
Wait 20
Call SendKeys("{F5}", True)
Wait 660
Reply With Quote  
Join Date: Apr 2005
Location: West Yorkshire, England
Posts: 72
Reputation: purplegerbil is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 6
purplegerbil's Avatar
purplegerbil purplegerbil is offline Offline
Junior Poster in Training

Re: timer or something diffrent

  #8  
May 2nd, 2006
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


Private Sub Command1_Click()
Dim hWnd As Long
Dim iCounter as Integer

  hWnd = FindWindowByCaption("welcome to mia's website  - Mozilla Firefox")
    If hWnd = 0 Then
      MsgBox "Window not found", vbCritical, "Fehler"
    Else
      
      For iCounter = 1 to 1000
          Call BringWindowToTop(hWnd):
          Call SendKeys("TAB", True)
          Call SendKeys("{ENTER}", True)
          Wait 20
          Call SendKeys("{F5}", True)
          Wait 660
    Next iCounter

    End If
End Sub

This will repeat 1000 times.

pG
Reply With Quote  
Join Date: May 2006
Posts: 6
Reputation: creex is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
creex creex is offline Offline
Newbie Poster

Re: timer or something diffrent

  #9  
May 2nd, 2006
Thanks alot You are very helpful There should be more ppl like you on our planet ;]
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 108
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: timer or something diffrent

  #10  
May 2nd, 2006
or don't use a button, use a timer control.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 4:16 pm.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC