AutoHotkey Community

It is currently May 26th, 2012, 11:52 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: buttons in random time
PostPosted: November 3rd, 2009, 3:33 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 4:13 pm 
Offline

Joined: May 12th, 2005, 8:20 am
Posts: 331
Location: Münster, Germany
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2009, 10:38 pm 
one question more, is it possible to get randomized in pressing F1 (1-2sec) and in F2?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 8th, 2009, 12:49 pm 
yes

Code:
Random, s, 1000, 2000 ;1-2 sec
sleep %s%


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 8th, 2009, 4:52 pm 
where should I put this?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2009, 4:38 pm 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
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%
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2009, 5:02 pm 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
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.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2009, 5:45 pm 
You both didn't get my point :P 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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 12th, 2009, 2:44 pm 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
We did already post how to randomize the sleep command.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: hyper_, Leef_me, patgenn123, Pulover, rbrtryn, tidbit, XstatyK and 19 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group