Sign in to follow this  
Followers 0
Joshuaaaa

Code to: Press F1 every... 60 seconds?

7 posts in this topic

I've been looking for a code that will click F1 every 60 seconds or so. Anybody?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Ok..

This is untested, but it should work. :P

HotKeySet("{ESC}", "MyExit")
While 1
Sleep(60000)
Send("{F1}")
WEnd
Func MyExit ()
Exit
EndFunc

Edit: Press Escape to close it.

Edited by JustinReno

Share this post


Link to post
Share on other sites

I've been looking for a code that will click F1 every 60 seconds or so. Anybody?

Generally people don't like making code for you when it appears you haven't tried anything yourself. However, this is so simple I'll give it a 10 second try:

While 1 
Sleep(60 * 1000)
Send('{F1}')
WEnd

Check the helpfile for Sleep, Send and While if you don't understand anything.


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

I've been trying everything actually, I just can't find something. It's a little more complicated... what I'm trying to do is have a checkbox, saying "auto reload" for example, and when checked and "Run" is clicked, it will press down once every 60 seconds. These are what I came up with... but still wrong. Here it is:

Case $Run
            If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) Then
 Send("{F1 Down}")
Sleep(6000); 60 seconds
Send("{F1 Up}")
                EndIf

I realize what it's doing is holding F1 down for 60 seconds, or atleast I think it is, but I still can't fix it up.

Share this post


Link to post
Share on other sites

Case $Run
If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) Then
While 1
Sleep(60 * 1000)
Send('{F1}')
WEnd
EndIf

That kind of freezes your program but a work around would be simple.


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Got it! Though when I use it along with my first code, it is cancelled out. I've tried changing sleep times, but I don't think that has anything to do with it. This is how it looks. PS: Final question.

If BitAND(GUICtrlRead($Checkbox3), $GUI_CHECKED) Then
                 Do
     MouseClick ("SECONDARY") 
     Sleep(1); 1= .01sec
 Until _IsPressed ("09")
           EndIf
If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) Then
While 1
Sleep(60000)
Send("{F1}")
Wend
EndIf
       
       EndSwitch
       WEnd

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Try looking in the helpfile for the AdlibEnable function.

You would want to put this:

Func _SendF1()
Send("{F1}")
EndFunc

As a function, and then use something like:

AdLibEnable('_SendF1', 60 *1000)
That would go where the loop used to be. Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0