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 

macro help needed

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





PostPosted: Tue Nov 03, 2009 4:30 pm    Post subject: macro help needed Reply with quote

Not sure if this is possible but i have been trying to figure out a macro that can do the following keystrokes

3 every 15 seconds
5 every 10 seconds
4 every 12 seconds
contine to hit 0 if none of the timers are up


Does anyone know if this is possible
Back to top
HotKeyIt



Joined: 18 Jun 2008
Posts: 1994
Location: GERMANY

PostPosted: Tue Nov 03, 2009 5:20 pm    Post subject: Reply with quote

Try:
Code:
#Persistent
SetTimer, Send0,100
SetTimer, Send3, 15000
SetTimer, Send5, 10000
SetTimer, Send4, 12000
Return
Send0:
Send3:
Send4:
Send5:
Thread,NoTimers
;SendInput % "{" . SubStr(A_ThisLabel,0) . "}"
ToolTip % "Sending " . SubStr(_ .= SubStr(A_ThisLabel,0),-100)
Return
Escape::ExitApp

_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
rotti
Guest





PostPosted: Tue Nov 03, 2009 6:42 pm    Post subject: Reply with quote

That seems to be very close

Im not sure what this does

Thread,NoTimers
;SendInput % "{" . SubStr(A_ThisLabel,0) . "}"
ToolTip % "Sending " . SubStr(_ .= SubStr(A_ThisLabel,0),-100)
Return

i just need it to send the key strokes in whatever program i am in
notepad for example
Back to top
Carcophan



Joined: 24 Dec 2008
Posts: 768
Location: :noitacoL

PostPosted: Tue Nov 03, 2009 6:50 pm    Post subject: Reply with quote

rotti wrote:

Thread,NoTimers
WinActivate, your_window_name_here (use WindpwSpy)
SendInput % "{" . SubStr(A_ThisLabel,0) . "}" ;uncomment this
;ToolTip % "Sending " . SubStr(_ .= SubStr(A_ThisLabel,0),-100) ;comment this out
Return

i just need it to send the key strokes in whatever program i am in
notepad for example


Tell it to activate your window, and use the 'send input' as opposed to the 'tool tip' in the example which was a test/demonstration.
_________________
"Unfortunately a "COM for Dummies" book would be a little like "Neurosurgery for Dummies," in the end you're just gonna have to learn" ~Tank
Back to top
View user's profile Send private message AIM Address
rotti
Guest





PostPosted: Tue Nov 03, 2009 7:15 pm    Post subject: Reply with quote

Tried this using 2 as my hotkey but doesn't seem to work

2::
while GetKeyState("2", "P")
SetTimer, Send0,100
SetTimer, Send3, 15000
SetTimer, Send5, 10000
SetTimer, Send4, 12000
Return
Send0:
Send3:
Send4:
Send5:
Thread,NoTimers
WinActivate, New Text Document.txt - Notepad,
Return
Escape::ExitApp
Back to top
rtcvb32



Joined: 17 Feb 2008
Posts: 125

PostPosted: Tue Nov 03, 2009 7:54 pm    Post subject: Reply with quote

I suggest you surround your code in blocks.

First, your while doesn't have brackets {} so the surrounding code isn't blocked together, rather the line IMMEDIATELY following will be looped, not the whole thing. I think where you placed your while block is probably wrong.

Second, if it were to include the whole thing, it only activates the Notepad, nothing else. Tooltip was a good idea as it would let you see the timing

Why does WinActivate have an comma at the end?
Lastly i suggest you read from the helpfile what the commands do, it's very well documented. We can assist if you don't understand.

The first posted suggestion looks great in my opinion, uncomment the sendinput and add a IfWinActive check.
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   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