| View previous topic :: View next topic |
| Author |
Message |
Jammer Guest
|
Posted: Tue Mar 01, 2005 6:38 pm Post subject: Newbie questions. |
|
|
Is there such things as Functions? for example
a::LogKey(a)
Func LogKey(%var%)
FileAppend, %var, c:\log,txt
EndFun
or something like that....
1more thing...
a::LogKey(a)
it only sends the key to the function? how could i make it to send the key to the program witch is currently active? I do:
a::
LogKey(a)
Send, a
but it does not work...
maby something is wrong with the syntax? im new with the syntax... |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Tue Mar 01, 2005 6:46 pm Post subject: |
|
|
What is your proposed LogKey Function supposed to do?
Functions are currently not supported in AHK (but will come, see list of planned features). But there are several workarounds, since variables are global. Give us more details, and I'm sure someone can help. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Tue Mar 01, 2005 6:51 pm Post subject: |
|
|
if you want the key to be send to the window, you can use
~a::
PressedKey = a
MsgBox, You pressed %PressedKey%
return
You are not doing a passwordlogger, do you?
BTW: I'm not an expert for hotkeys. Someone else might correct me. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Mar 01, 2005 6:58 pm Post subject: |
|
|
Logkey should set all recieved letters to a var until enter is pressed when enter is pressed should write to file... if backspace is pressed should take one char from the vars end... if tab is pressed it should do the same as enter....
like i press:
i<space>am<space>a<space>noo<backspace><backspace>ewH<backspace>b<enter>
i'h<backspace>m<space>the<space>best<tab>letz<backspace>'s<space>go<space>anh<backspace>d<space>die<enter>
should equal to:
[TIMESTAMP HERE][ACTIVE WINDOW TITLE]i am a newb
[TIMESTAMP HERE][ACTIVE WINDOW TITLE]'m the best
[TIMESTAMP HERE][ACTIVE WINDOW TITLE]let's go and die
and for example if there is a word "Notepad" in the active window title it should put a ¤ symbol before each line.. |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Mar 01, 2005 6:59 pm Post subject: |
|
|
| toralf wrote: | if you want the key to be send to the window, you can use
~a::
PressedKey = a
MsgBox, You pressed %PressedKey%
return
You are not doing a passwordlogger, do you?
BTW: I'm not an expert for hotkeys. Someone else might correct me. |
im making a logger to log my game chat's.... |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Tue Mar 01, 2005 7:37 pm Post subject: |
|
|
Alright, I whipped something up quick. If you really want to, you could extend it to get all the keys, but I got tired about halfway through the punctuation. It should be usable now, though. It only logs in lowercase, you could probably fix that too. There's also a note in there on switching the time from 24-hour to 12-hour, if you care.
| Code: | ~*a:: ; Letters
~*b::
~*c::
~*d::
~*e::
~*f::
~*g::
~*h::
~*i::
~*j::
~*k::
~*l::
~*m::
~*n::
~*o::
~*p::
~*q::
~*r::
~*s::
~*t::
~*u::
~*v::
~*w::
~*x::
~*y::
~*z::
~*1:: ; Numbers
~*2::
~*3::
~*4::
~*5::
~*6::
~*7::
~*8::
~*9::
~*0::
~*.:: ; Basic punctuation,
~*,:: ; add more if you want.
~*;::
~*"::
~*'::
~*/::
~*?::
~*(::
~*)::
~*-::
stringtrimleft,thiskey,a_thishotkey,2
keys := keys thiskey ;Concat.
return
~*space::keys := keys " "
; Exclamation mark (!) has to be defined
; separately because it's an AHK symbol.
~*+1::keys := keys "!"
~*backspace::stringtrimright,keys,keys,1
~*enter::
if not keys ; Abort if keys is blank.
return
wingetactivetitle,title
; Use this line to get 12-hour time:
;formattime,timestamp,,h:mm:ss tt
; Or use this line (default) for 24-hour:
timestamp := a_hour ":" a_min ":" a_sec
timestamp := timestamp ", " a_mm "/" a_dd
fileappend,[%timestamp%][%title%]%keys%`n,test.log
keys=
return |
|
|
| Back to top |
|
 |
Jammer Guest
|
Posted: Tue Mar 01, 2005 7:42 pm Post subject: |
|
|
| well this clears alot of things out.. thnx... |
|
| Back to top |
|
 |
Jammer Guest
|
Posted: Tue Mar 01, 2005 7:48 pm Post subject: |
|
|
1 thing ...
if i type !@# i get !23 why ! is writen like ! and @ is writen like 2? |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Tue Mar 01, 2005 8:23 pm Post subject: |
|
|
| I only did part of the punctuation, 'cause I was only doing this for boredom's sake. ! seems like a more important thing than @. You can try to extend it yourself, or wait 'till I get bored again and make this a true key logger. That might be soon, or it might be never. Meh. |
|
| Back to top |
|
 |
Jammer Guest
|
Posted: Tue Mar 01, 2005 8:45 pm Post subject: |
|
|
oh... only now i understand what does
~*+1::keys := keys "!"
do.... |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Tue Mar 01, 2005 8:59 pm Post subject: |
|
|
| Ya, for most letters and symbols though, you can just put their actual name. The only time you need to do a work-around like is when it isn't valid. For instance, an exclamation mark signifies the Alt modifier (e.g. !r) so it wouldn't be a valid hotkey by itself. These special symbols include ! ^ + * ~ ` and $. |
|
| Back to top |
|
 |
|