Count Down Timer

Need Timer that counts 10 to 0

Page 1 of 1

3 Replies - 5929 Views - Last Post: 29 July 2008 - 02:11 PM Rate Topic: -----

#1 koolazngy94  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 119
  • Joined: 29-July 08

Count Down Timer

Posted 29 July 2008 - 11:53 AM

Hi, Im making an Auto-Clicker. What I have so far is a Button, timer, and a Text. It works but what I want to add another textbox so in that text box, i put the number 10 then i click the button and it will countdown the timer then when it reaches 0, it will stop clicking. Sorry, bad english any help?

Source:
Private Sub Command1_Click()
	If Command1.Caption = "Start" Then
		Timer1.Enabled = True
		Command1.Caption = "Stop"
		Text1.Enabled = False
	Else
		Timer1.Enabled = False
		Command1.Caption = "Start"
		Text1.Enabled = True
	End If
End Sub




Private Sub Form_Load()

End Sub

Private Sub Label4_Click()

End Sub

Private Sub Text1_Change()
If Val(Text1.Text) < 0.0001 Then
		Text1.Text = ""
	End If
	Timer1.Interval = Val(Text1.Text) * 1000
End Sub

Private Sub Timer1_Timer()
  LeftClick
End Sub


Private Sub txtSec_Change()

End Sub


Moncular
Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
	Public Const MOUSEEVENTF_LEFTDOWN = &H2
	Public Const MOUSEEVENTF_LEFTUP = &H4
	Public Const MOUSEEVENTF_MIDDLEDOWN = &H20
	Public Const MOUSEEVENTF_MIDDLEUP = &H40
	Public Const MOUSEEVENTF_RIGHTDOWN = &H8
	Public Const MOUSEEVENTF_RIGHTUP = &H10
	Public Const MOUSEEVENTF_MOVE = &H1
Public Type POINTAPI
	X As Long
	Y As Long
	End Type
Public Function GetX() As Long
	Dim n As POINTAPI
	GetCursorPos n
	GetX = n.X
End Function
Public Function GetY() As Long
	Dim n As POINTAPI
	GetCursorPos n
	GetY = n.Y
End Function
Public Sub LeftClick()
	LeftDown
	LeftUp
End Sub
Public Sub LeftDown()
	mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
End Sub
Public Sub LeftUp()
	mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
Public Sub MiddleClick()
	MiddleDown
	MiddleUp
End Sub
Public Sub MiddleDown()
	mouse_event MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0
End Sub
Public Sub MiddleUp()
	mouse_event MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0
End Sub
Public Sub RightClick()
	RightDown
	RightUp
End Sub
Public Sub RightDown()
	mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
End Sub
Public Sub RightUp()
	mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
End Sub
Public Sub MoveMouse(xMove As Long, yMove As Long)
	mouse_event MOUSEEVENTF_MOVE, xMove, yMove, 0, 0
End Sub
Public Sub SetMousePos(xPos As Long, yPos As Long)
	SetCursorPos xPos, yPos
End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: Count Down Timer

#2 Zhalix  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 260
  • Joined: 07-May 08

Re: Count Down Timer

Posted 29 July 2008 - 12:19 PM

Well, are you going to use another timer to countdown, or use the same timer for counting as the one that's doing the clicking?

Make an integer variable at the top of your code. Then, when the person clicks the "Start" button, set the integer's value to whatever is in the textbox, and then start the timer. In the timer, have it minus one from the number every time it ticks. When it reaches zero, have it stop/start or whatever this is for.
Was This Post Helpful? 0
  • +
  • -

#3 koolazngy94  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 119
  • Joined: 29-July 08

Re: Count Down Timer

Posted 29 July 2008 - 01:51 PM

well idk but here the img
Posted Image


U see the number of clicks? That wat im trying to do. When they click start it will start clicking and will start the timer.

---EDIT---
either get the countdown or the hotkey. If you know how to add the hotkey please tell me or give me the code. I need F2 to start and F1 to stop.

This post has been edited by koolazngy94: 29 July 2008 - 01:56 PM

Was This Post Helpful? 0
  • +
  • -

#4 koolazngy94  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 119
  • Joined: 29-July 08

Re: Count Down Timer

Posted 29 July 2008 - 02:11 PM

View Postkoolazngy94, on 29 Jul, 2008 - 01:51 PM, said:

well idk but here the img
Posted Image


U see the number of clicks? That wat im trying to do. When they click start it will start clicking and will start the timer.

---EDIT---
either get the countdown or the hotkey. If you know how to add the hotkey please tell me or give me the code. I need F2 to start and F1 to stop.


---EDIT---
nvm got the F1 to stop and F2 to start but one problem.. How do I click F2 outside of the program n it will start?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1