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 

buttons in random time

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





PostPosted: Tue Nov 03, 2009 2:33 pm    Post subject: buttons in random time Reply with quote

Hi! I'd like to know if it's possible to make a script which could press two hotkeys in random time, It means that F1 between 1-15 min and F2 between 1-15 min aswell. If it's possible , and you're able to do this script I'll be grateful for posting it here.
Back to top
Klaus



Joined: 12 May 2005
Posts: 325
Location: Münster, Germany

PostPosted: Tue Nov 03, 2009 3:13 pm    Post subject: Reply with quote

Hi, azio,
have a look at this
Code:
; initialize two timers to do the typing
SetTimer, pushF1, 100
SetTimer, pushF2, 100

; an infinite loop to keep the programme alive
Loop
{
a=1
}

; the action for the first timer
; send the desired key
; get a new random value between 1 and 15
; calculate milliseconds
; set the timer to a new period
pushF1:
Send, a ; replace with {F1}
Random, val1, 1, 15
val1 *= 60000
SetTimer, pushF1, %val1%
return

; same as above
pushF2:
Send, b ; replace with {F2}
Random, val2, 1, 15
val2 *= 60000
SetTimer, pushF2, %val2%
return

and play around with it.
Have fun!
Klaus
Back to top
View user's profile Send private message Send e-mail
azio
Guest





PostPosted: Sat Nov 07, 2009 9:38 pm    Post subject: Reply with quote

one question more, is it possible to get randomized in pressing F1 (1-2sec) and in F2?
Back to top
Guest






PostPosted: Sun Nov 08, 2009 11:49 am    Post subject: Reply with quote

yes

Code:

Random, s, 1000, 2000 ;1-2 sec
sleep %s%
Back to top
Guest






PostPosted: Sun Nov 08, 2009 3:52 pm    Post subject: Reply with quote

where should I put this?
Back to top
aaffe



Joined: 17 May 2007
Posts: 1002
Location: Germany - Deutschland

PostPosted: Wed Nov 11, 2009 3:38 pm    Post subject: Reply with quote

The Settimer is already used with a random time in the script. Did you test it? I think, no.
Btw, I think this should do it:
Code:

Loop
{
  random,f1f2,1,2
  If f1f2=1
    Send,{F1}
  else
    Send,{F2}
  Random,sleepy,60000,900000
  sleep %sleepy%
}
Back to top
View user's profile Send private message
MasterFocus



Joined: 08 Apr 2009
Posts: 3035
Location: Rio de Janeiro - RJ - Brasil

PostPosted: Wed Nov 11, 2009 4:02 pm    Post subject: Reply with quote

Code:
Loop
{
  Random, f1f2, 1, 2
  Send, {F%f1f2%}
  Random, slp, 60000, 900000
  Sleep, %slp%
}

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"

Antonio França
My stuff: Google Profile
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Wed Nov 11, 2009 4:45 pm    Post subject: Reply with quote

You both didn't get my point Razz I'd like to use that command:
Sleep 1000 ; Keep it down for one second.
And I'd like to randomize 1000 (beetween 1-2 sec) but I'm new here and don't know how to randomize and where put this in 1st script posted by Klaus. I hope it's clear now and I'd be thankful to everyone who could help me.
Back to top
aaffe



Joined: 17 May 2007
Posts: 1002
Location: Germany - Deutschland

PostPosted: Thu Nov 12, 2009 1:44 pm    Post subject: Reply with quote

We did already post how to randomize the sleep command.
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