AutoHotkey Community

It is currently May 27th, 2012, 10:00 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: particular window
PostPosted: June 30th, 2009, 7:12 pm 
hi,
I'm new to this and I was wondering how you can send a loop of keystrokes and mouseclicks to a particular window. I have already tried to use ControlSend and ControlClick but it doesn't seem to work because I'm using a loop. Could anyone help me please?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 30th, 2009, 7:41 pm 
post the code you have tried so far.


Report this post
Top
  
Reply with quote  
 Post subject: particular window
PostPosted: June 30th, 2009, 10:43 pm 
here's the code .. now I need just need it to be sent to 1 window
Code:
screen_x:=1024
screen_y:=768
x_from := (screen_x/2)-80
x_to := (screen_x/2)+80
y_from := screen_y*0.80
y_to := screen_y*0.80


SetKeyDelay 150
toggle := 1
count := 0

ControlSend,,{
Loop {



;      if (Mod(count,250)=0) {
;         Send {a}
;         Sleep 3500
;         Send {b}
;         Sleep 2500
;         Click 215, 1010
;         Sleep 2500
;         Click 1080, 840
;      }
}
}, WinTitle

      
      count++
      Send {c}
      Send {d}
      Random, rand,1,5000
      Sleep rand
      Send {d}
      Random, rand,1,5000
      Sleep rand
   }
   Sleep 250
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2009, 6:56 am 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
Quote:
ControlSend [, Control, Keys, WinTitle, WinText, ExcludeTitle, ExcludeText]

Keys - The sequence of keys to send (see the Send command for details).


I believe you can only send keys using ControlSend, not other commands. Maybe try using ControlSend inside the loop rather than a loop as a parameter of the ControlSend command.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2009, 12:00 pm 
Isn't there any other command that is able to send the whole to only 1 window? I don't really know how to start adjusting this code using ControlSend, ControlClick,..


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2009, 8:36 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
I'm not sure exactly how the code above is supposed to read, but perhaps this can help you out:
Code:
screen_x:=1024
screen_y:=768
x_from := (screen_x/2)-80
x_to := (screen_x/2)+80
y_from := screen_y*0.80
y_to := screen_y*0.80

SetKeyDelay 150
toggle := 1
count := 0

Loop {
   if (Mod(count,250)=0) {
      ControlSend, , a, WinTitle
      Sleep 3500
      ControlSend, , b, WinTitle
      Sleep 2500
      ControlClick, x215 y1010, WinTitle
      Sleep 2500
      ControlClick, x1080 y840, WinTitle
      }
   count++
   ControlSend, , c, WinTitle
   ControlSend, , d, WinTitle
   Random, rand,1,5000
   Sleep rand
   ControlSend, , d, WinTitle
   Random, rand,1,5000
   Sleep rand
   }
   Sleep 250

Note - There is no code in this example that breaks the loop


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, tomoe_uehara, XstatyK and 65 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