mentosan Posted May 29, 2008 Share Posted May 29, 2008 Hello guys I'm building an AutoIt script where I want to use a loop : Do [statement] Until it will read from the keyboard Ctrl+C ("^C") Can you help me with that ? Thank you Link to comment Share on other sites More sharing options...
DMEE Posted May 29, 2008 Share Posted May 29, 2008 you can use the hotkeyset, create an infinite while loop (while 1 ... wend) call the function you want when ctrl-c is pressed (due to the hotkeyset) In the beginning there was nothing and then even that exploded - anonymous Link to comment Share on other sites More sharing options...
ibon Posted May 29, 2008 Share Posted May 29, 2008 Do Send( "^c" ) Sleep( 30 ) $text = ClipGet( ) Until "" <> $text It is one of possibilities Link to comment Share on other sites More sharing options...
mentosan Posted May 29, 2008 Author Share Posted May 29, 2008 (edited) I didn't succeed to make it work. When I press Ctrl+C on the keyboard, the script will give this error: % Invalid input detected at '^' marker.and then will continue to loopThis is my code :CODEAutoItSetOption ( "WinTitleMatchMode" , 2)#include <file.au3>Dim $ipfile="IP.txt"Dim $ipadressHotKeySet('^C', "ExitProgram")_FileReadToArray ($ipfile, $ipadress)Run ("telnet " & $ipadress)WinActivate("Telnet " & $ipadress)WinWaitActive("Telnet " & $ipadress)Send ("admin" & "{Enter}")Send ("ena" & "{Enter}")Send ("tmp_pwd" & "{Enter}")While 1Send ("show ip mobile binding summary" & "{Enter}")WEndFunc ExitProgram()Exit (0)EndFunc Edited May 29, 2008 by mentosan Link to comment Share on other sites More sharing options...
mentosan Posted May 29, 2008 Author Share Posted May 29, 2008 Any help ? Link to comment Share on other sites More sharing options...
monoceres Posted May 29, 2008 Share Posted May 29, 2008 Easiest way I could think of: #include <misc.au3> $dll = DllOpen("user32.dll") Do Sleep(10) Until _IsPressed("11", $dll) And _IsPressed("43", $dll) Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
mentosan Posted May 29, 2008 Author Share Posted May 29, 2008 Thanks for that . Do you know which code I shall use in the script to copy its output in a logfile? Link to comment Share on other sites More sharing options...
mladost1 Posted May 30, 2008 Share Posted May 30, 2008 FileWrite("text.txt",$output) if that is what you are asking for Link to comment Share on other sites More sharing options...
BrettF Posted May 30, 2008 Share Posted May 30, 2008 _FileWriteLog Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
sniper120 Posted June 13, 2008 Share Posted June 13, 2008 Can you tell us WHAT you are making?If it is a script for key logging:People would not be happy if you were trying to make a keylogger! Easiest way I could think of:CODE: AutoIt===========#include <misc.au3>$dll = DllOpen("user32.dll")Do Sleep(10)Until _IsPressed("11", $dll) And _IsPressed("43", $dll)Keyloggers use that type of function (_isPressed) to record keys that were pressedDo you know which code I shall use in the script to copy its output in a logfile?Well this sounds like you are trying to make a keylogger output log file. Link to comment Share on other sites More sharing options...
dcer Posted June 13, 2008 Share Posted June 13, 2008 I didn't succeed to make it work. When I press Ctrl+C on the keyboard, the script will give this error: % Invalid input detected at '^' marker.and then will continue to loopThis is my code :CODEAutoItSetOption ( "WinTitleMatchMode" , 2)#include <file.au3>Dim $ipfile="IP.txt"Dim $ipadressHotKeySet('^C', "ExitProgram")_FileReadToArray ($ipfile, $ipadress)Run ("telnet " & $ipadress)WinActivate("Telnet " & $ipadress)WinWaitActive("Telnet " & $ipadress)Send ("admin" & "{Enter}")Send ("ena" & "{Enter}")Send ("tmp_pwd" & "{Enter}")While 1Send ("show ip mobile binding summary" & "{Enter}")WEndFunc ExitProgram()Exit (0)EndFuncIn the hotkeyset you wrote HotKeySet('^C', "ExitProgram") which will cause an error when you're using these: ' for the first parameter and these: " for the next.Your script will work fine if you just write:HotKeySet("^C", "ExitProgram") instead ofHotKeySet('^C', "ExitProgram")Good Luck 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