Jump to content
Sign in to follow this  
autoitxp

_IsPressed make backspace work properly

Recommended Posts

autoitxp

Hi

i wanted to ask how we can make make backspace works properly for example i press "A" 4 times after this

i hit backspace it removes properly from right side (ofcourse coz of StringTrimRight) but if i wanted to remove char let say i press "A" 4 times again and wanted to remove mid second "A" then how to achive this .

#include <Misc.au3>
$dll = DllOpen("user32.dll")

Global $s_Text

While 1
    Sleep ( 250)
    If _IsPressed("41", $dll) Then _keys("a")
 If _IsPressed("08", $dll) Then _keys("_BackSpace")
WEnd

Func _keys($read)


    If $read <> "_BackSpace" Then
        Global $s_Text
        $s_Text &= $read
        TrayTip($s_Text, $s_Text, 5)

    Else
        If $read = "_BackSpace" Then

            $s_Text = StringTrimRight($s_Text, 1)

        EndIf
    EndIf


EndFunc;==>_keylog

DllClose($dll)
Edited by autoitxp

Share this post


Link to post
Share on other sites
AwAke

Uhm not sure entirely on what you mean but from what I think you mean is as follows:

#include <Misc.au3>
$dll = DllOpen("user32.dll")

Global $s_Text

While 1
    Sleep ( 250)
    If _IsPressed("41", $dll) Then _keys("a")
If _IsPressed("08", $dll) Then _keys("_BackSpace")
WEnd

Func _keys($read)


    If $read <> "_BackSpace" Then
        Global $s_Text
        $s_Text &= $read
        TrayTip($s_Text, $s_Text, 5)

    Else
        If $read = "_BackSpace" Then

            $s_Text = StringMid(Floor(StringLen($s_text)/2), 1)

        EndIf
    EndIf


EndFunc;==>_keylog

DllClose($dll)

Not sure if that syntax is correct :/ Aint programmed for a while :)

Share this post


Link to post
Share on other sites
autoitxp

lol nope its even worst then before ;d

Share this post


Link to post
Share on other sites
bogQ

but if i wanted to remove char let say i press "A" 4 times again and wanted to remove mid second "A" then how to achive this .

sometnihg simular to this?

edit: remaked with array

Global $output
$removecount = 2
$abcd1 = "IlikeTOlearne"
$abcd = StringSplit($abcd1, "")
$data = StringLen($abcd1)/2
If StringInStr($data,".") Then 
    $data =Floor($data)+1
Else
    $data =Floor($data)
EndIf
For $x = 1 To $abcd[0]
    If $x <> $data+$removecount Then 
        $output = $output&$abcd[$x]
    EndIf
Next
MsgBox(0,$data+$removecount,$output)
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
autoitxp

i think first we need to know backspace position. "$removecount " how to know weather which "A" waz pressed to remove

Share this post


Link to post
Share on other sites
martin

Hi

i wanted to ask how we can make make backspace works properly for example i press "A" 4 times after this

i hit backspace it removes properly from right side (ofcourse coz of StringTrimRight) but if i wanted to remove char let say i press "A" 4 times again and wanted to remove mid second "A" then how to achive this .

#include <Misc.au3>
 $dll = DllOpen("user32.dll")
 
 Global $s_Text
 
 While 1
     Sleep ( 250)
     If _IsPressed("41", $dll) Then _keys("a")
  If _IsPressed("08", $dll) Then _keys("_BackSpace")
 WEnd
 
 Func _keys($read)
 
 
     If $read <> "_BackSpace" Then
         Global $s_Text
         $s_Text &= $read
         TrayTip($s_Text, $s_Text, 5)
 
     Else
         If $read = "_BackSpace" Then
 
             $s_Text = StringTrimRight($s_Text, 1)
 
         EndIf
     EndIf
 
 
 EndFunc;==>_keylog
 
 DllClose($dll)
Is this what you mean?

#include <Misc.au3>
$dll = DllOpen("user32.dll")

Global $s_Text
HotKeySet("A", "Apress")
HotKeySet("a", "Apress")
HotKeySet("{BS}", "BSPress")

While 1
    Sleep(250)

WEnd



Func APress()
    HotKeySet("A")
    HotKeySet("a")
    Send(@HotKeyPressed)
    $s_Text &= "a"
    TrayTip($s_Text, $s_Text, 5)
    HotKeySet("A", "Apress")
    HotKeySet("a", "Apress")
EndFunc  ;==>APress
Func BSPress()
    HotKeySet("{BS}")
    Send(@HotKeyPressed)
    $s_Text = StringTrimRight($s_Text, 1)
    TrayTip($s_Text, $s_Text, 5)
    HotKeySet("{BS}", "BSPress")
EndFunc  ;==>BSPress

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
bogQ

i think first we need to know backspace position. "$removecount " how to know weather which "A" waz pressed to remove

position in what? in tooltip? r y trying to make keyloger? :)

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
autoitxp

lol boq() u think _is pressed to use for keylogger where key press time is 0.10 msec delays not possible lol juggment not true ;d

Edited by autoitxp

Share this post


Link to post
Share on other sites
bogQ

juggment not true ;d

is tracking keyes while input them and with it its detecting position of curent place of tuping cursor so that correct letter can b detected or delited, i called it keyloger becose it looks like its gooing to that direction. Maby it is maby it isnt but it looks like one in my mind.

sry for debate im off from this topic


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
autoitxp

ty . this code works much better

how to save pressed key in 1 line by default _filewritelog repeating same chars n saving in each line how to fix this

#include <Misc.au3>
#include <file.au3>

$dll = DllOpen("user32.dll")

Global $s_Text
HotKeySet("A", "Apress")
HotKeySet("a", "Apress")
HotKeySet("{BS}", "BSPress")

While 1
    Sleep(250)

WEnd



Func APress()
    HotKeySet("A")
    HotKeySet("a")
    Send(@HotKeyPressed)
    $s_Text &= "a"
    _FileWriteLog("my.log" ,   $s_Text )
    HotKeySet("A", "Apress")
    HotKeySet("a", "Apress")
EndFunc ;==>APress
Func BSPress()
    HotKeySet("{BS}")
    Send(@HotKeyPressed)
    $s_Text = StringTrimRight($s_Text, 1)
    _FileWriteLog("my.log" ,   $s_Text )
    HotKeySet("{BS}", "BSPress")
EndFunc ;==>BSPress
Edited by autoitxp

Share this post


Link to post
Share on other sites
Thornhunt

this looks alot like a keylogger


Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.