Chobyhy Posted March 11, 2007 Share Posted March 11, 2007 I'm trying to make a function so that if you type /exit in a game while the program is running, it would exit the script. Is there anyway that I can make this to work? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 11, 2007 Moderators Share Posted March 11, 2007 I'm trying to make a function so that if you type /exit in a game while the program is running, it would exit the script. Is there anyway that I can make this to work?Yes... You'll want to look at HotKeySet() and or _IsPressed()... the rest is logical manipulation. 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 More sharing options...
Chobyhy Posted March 11, 2007 Author Share Posted March 11, 2007 I thought HotKeySet is when they press a single button. _IsPressed() is when they press a single key. I'm trying to make it so that if they type /exit and enter it into chat, it will exit the script. I still have no idea on what to do. Can you help me out with the logical manipulation. I'm not asking you to write the script for me, I'm just asking how I'm going to make it work Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 11, 2007 Moderators Share Posted March 11, 2007 I thought HotKeySet is when they press a single button._IsPressed() is when they press a single key.I'm trying to make it so that if they type /exit and enter it into chat, it will exit the script. I still have no idea on what to do. Can you help me out with the logical manipulation. I'm not asking you to write the script for me, I'm just asking how I'm going to make it workToo close to a key logger for me to help... one of the forum morons will though... just be patient. 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 More sharing options...
Chobyhy Posted March 11, 2007 Author Share Posted March 11, 2007 ... Is there anyways i can prove its not a key logger? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 11, 2007 Moderators Share Posted March 11, 2007 ... Is there anyways i can prove its not a key logger?Well the short of it Chobyhy, is it is a keylogger. You want to capture when someone types the keys /exit, which can only be done by logging what they end user is typing... So regardless of how noble your intentions are, a spade by any other name is still a spade. 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 More sharing options...
improbability_paradox Posted March 11, 2007 Share Posted March 11, 2007 This is an example of what you COULD try. This script cannot (as far as I can see) be used as a keylogger, unless you are using a very loose definition of that word. It will react when a sequence of keys is pressed in the right order within a specific time frame, although it would also have the same reaction even if rogue keys are pressed. for example, exiteexixtefpxihtwould all work if typed fast enough, simply because it picks out the letters in bold.Adaptations of this script can lead you to something that will work as desired.#include "misc.au3" ;This is not a keylogger! ;This does not "log" what keys are pressed in any way ;Except that it will recognize and/or log when a specific sequence of keys are pressed Local $Word="exit" if $CmdLine[0] Then $Word=$CmdLine[1] Local $KeySequence=StringSplit($Word,"") Local $SeqPlace=1, $SeqTimer While 1 if _IsPressed(Hex(Asc(StringUpper($KeySequence[$SeqPlace])),2)) Then ConsoleWrite($KeySequence[$SeqPlace]) $SeqPlace+=1 if $SeqPlace>$KeySequence[0] Then Exit $SeqTimer=TimerInit() ElseIf $SeqPlace>1 Then if TimerDiff($SeqTimer)>750 Then $SeqPlace=1 EndIf Sleep(50) WEndNOTE: This does not discriminate between lower/upper case letters. Also, certain keys probably cannot be discerned this way (Hex(Asc(StringUpper()))). The "/" is an example, as I do not believe that its ascii value is the same as the value accepted for it by _IsPressed. If you want to discern characters like these, you will need to work around this. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now