 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
azio Guest
|
Posted: Tue Nov 03, 2009 2:33 pm Post subject: buttons in random time |
|
|
| 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
|
Posted: Tue Nov 03, 2009 3:13 pm Post subject: |
|
|
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 |
|
 |
azio Guest
|
Posted: Sat Nov 07, 2009 9:38 pm Post subject: |
|
|
| one question more, is it possible to get randomized in pressing F1 (1-2sec) and in F2? |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Nov 08, 2009 11:49 am Post subject: |
|
|
yes
| Code: |
Random, s, 1000, 2000 ;1-2 sec
sleep %s% |
|
|
| Back to top |
|
 |
Guest
|
Posted: Sun Nov 08, 2009 3:52 pm Post subject: |
|
|
| where should I put this? |
|
| Back to top |
|
 |
aaffe
Joined: 17 May 2007 Posts: 1002 Location: Germany - Deutschland
|
Posted: Wed Nov 11, 2009 3:38 pm Post subject: |
|
|
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 |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 3035 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Wed Nov 11, 2009 4:02 pm Post subject: |
|
|
| 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 |
|
 |
Guest
|
Posted: Wed Nov 11, 2009 4:45 pm Post subject: |
|
|
You both didn't get my point 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
|
Posted: Thu Nov 12, 2009 1:44 pm Post subject: |
|
|
| We did already post how to randomize the sleep command. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|