AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Most simple script

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
LuckyPimp



Joined: 12 Jan 2009
Posts: 1

PostPosted: Mon Jan 12, 2009 8:38 pm    Post subject: Most simple script Reply with quote

I want to create a script that clicks once at a specified time

So far all I have is this:

Click 1580 , 62

I can't seem to find the time function.

Thanks in advance
Back to top
View user's profile Send private message
DataLife



Joined: 27 Apr 2008
Posts: 369

PostPosted: Mon Jan 12, 2009 8:56 pm    Post subject: Reply with quote

Code:
FormatTime, SavedTimeVar ,   , HH:mm:ss
MsgBox Current Time is %SavedTimeVar%

_________________
Unless otherwise stated, all code is untested

Check out my scripts.
http://www.autohotkey.net/~DataLife/MyIpChanger/MyIpChanger.ahk
http://www.autohotkey.net/~DataLife/XPSnap.ahk
http://www.autohotkey.net/~DataLife/SavePictureAs.ahk
Back to top
View user's profile Send private message Send e-mail
niwi



Joined: 27 Feb 2005
Posts: 139
Location: Heidelberg, Germany

PostPosted: Tue Jan 13, 2009 10:47 am    Post subject: Reply with quote

Hi,

have a look at SetTimer.

Or, the easy way: use the task scheduler from Windows and call your script.

Regards, Nils.
Back to top
View user's profile Send private message
Tseik



Joined: 09 Oct 2008
Posts: 180
Location: Finland

PostPosted: Tue Jan 13, 2009 11:09 am    Post subject: Reply with quote

Code:
SetTimer, TODO, 3000 ; run every third second
Return

TODO:
   Click 1580 , 62
Return
Back to top
View user's profile Send private message
SpiderGames



Joined: 09 Jun 2008
Posts: 936
Location: Canada

PostPosted: Tue Jan 13, 2009 3:21 pm    Post subject: Reply with quote

Code:

Loop,
{
Sleep, 5000  ; checks every 5 seconds

if A_Hour = %what hour you want%
 {
   if A_Min = %what minet you want%
   {
     if A_sec = %what second u want%
     {
      MouseClick, Left, 1580, 62
     }
   }
 }
}

_________________

I know i have 6 legs. It's cuz I'm special.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
DataLife



Joined: 27 Apr 2008
Posts: 369

PostPosted: Tue Jan 13, 2009 4:19 pm    Post subject: Reply with quote

SpiderGames wrote:
Code:

Loop,
{
Sleep, 5000  ; checks every 5 seconds

if A_Hour = %what hour you want%
 {
   if A_Min = %what minet you want%
   {
     if A_sec = %what second u want%
     {
      MouseClick, Left, 1580, 62
     }
   }
 }
}
What are the chances that the seconds will match if your checking every 5 seconds. It very easily could skip the specified second.

Nice example though.

I think to match the second you would have to sleep for less then a second. Every second seems like it would work but you have to account for the time it takes to run the loop. If you sleep for 1 second, the loop probably would take 1 second and 40 milliseconds. Based on each line of code taking 10 milliseconds to complete.
_________________
Unless otherwise stated, all code is untested

Check out my scripts.
http://www.autohotkey.net/~DataLife/MyIpChanger/MyIpChanger.ahk
http://www.autohotkey.net/~DataLife/XPSnap.ahk
http://www.autohotkey.net/~DataLife/SavePictureAs.ahk
Back to top
View user's profile Send private message Send e-mail
SpiderGames



Joined: 09 Jun 2008
Posts: 936
Location: Canada

PostPosted: Wed Jan 14, 2009 12:28 pm    Post subject: Reply with quote

Quote:
What are the chances that the seconds will match if your checking every 5 seconds. It very easily could skip the specified second.

Nice example though.

I think to match the second you would have to sleep for less then a second. Every second seems like it would work but you have to account for the time it takes to run the loop. If you sleep for 1 second, the loop probably would take 1 second and 40 milliseconds. Based on each line of code taking 10 milliseconds to complete.


Set the seconds to 5 10 15 20 or something like that. Or you can just omit them if you dont really care. Setting the Sleep command to 900 would work too.
_________________

I know i have 6 legs. It's cuz I'm special.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Lighthouse



Joined: 12 Jan 2009
Posts: 55
Location: Southern Ca, USA

PostPosted: Thu Jan 15, 2009 4:21 pm    Post subject: Reply with quote

In the Seconds area you could easily make it work using:

If seconds >0 AND <=10
do this
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group