UltraFine Posted November 10, 2008 Posted November 10, 2008 i know i can send keys using Send() but i only want it to be sent when user writes like this. Line#1 Line#2 Line#3 and script sends the keys on pressing the first text like. if pressed 'Line#1' than after pressing these keys script will add the second line to it. Line#1 'this is just for test' on entering 'Line#2' to the editor it will be like this. Line#2 'this is the second line' and son on... Line#3 'continue'
rasim Posted November 10, 2008 Posted November 10, 2008 L0veUKIf I is correct has understood:#include <GuiEdit.au3> Run("Notepad") WinWaitActive("[Class:Notepad]") $hWnd = WinGetHandle("[Class:Notepad]") $hEdit = ControlGetHandle("[Class:Notepad]", "", "Edit1") AdlibEnable("_GetText") While 1 Sleep(100) WEnd Func _GetText() Local $iText = _GUICtrlEdit_GetText($hEdit) If StringRegExp($iText, "(?i)Line#1") Then AdlibDisable() $iText = StringRegExpReplace($iText, "(?i)Line#1", "Line#1 this is just for test") _GUICtrlEdit_SetText($hEdit, $iText) ControlSend($hWnd, "", $hEdit, "^{End}") Exit EndIf EndFunc
liteswap Posted November 10, 2008 Posted November 10, 2008 i know i can send keys using Send() but i only want it to be sent when user writes like this.Line#1Line#2Line#3and script sends the keys on pressing the first text like.if pressed 'Line#1' than after pressing these keys script will add the second line to it.Line#1 'this is just for test'on entering 'Line#2' to the editor it will be like this.Line#2 'this is the second line'and son on...Line#3 'continue'Isn't this a simple case of needing a GUI with a few buttons whose actions send the keys? What am I missing? Try checking out the GUI section of the help file.
UltraFine Posted November 10, 2008 Author Posted November 10, 2008 L0veUK If I is correct has understood: #include <GuiEdit.au3> Run("Notepad") WinWaitActive("[Class:Notepad]") $hWnd = WinGetHandle("[Class:Notepad]") $hEdit = ControlGetHandle("[Class:Notepad]", "", "Edit1") AdlibEnable("_GetText") While 1 Sleep(100) WEnd Func _GetText() Local $iText = _GUICtrlEdit_GetText($hEdit) If StringRegExp($iText, "(?i)Line#1") Then AdlibDisable() $iText = StringRegExpReplace($iText, "(?i)Line#1", "Line#1 this is just for test") _GUICtrlEdit_SetText($hEdit, $iText) ControlSend($hWnd, "", $hEdit, "^{End}") Exit EndIf EndFuncvery good job rasim, Thanks dude! but it will only work in Notepad and i want to use this function everywhere.
Bert Posted November 10, 2008 Posted November 10, 2008 If you are talking of using it in anything, then you are talking about a keylogger, and that is a No No No. Don't ask for it, don't hint at it, nothing. The Vollatran project My blog: http://www.vollysinterestingshit.com/
Bert Posted November 10, 2008 Posted November 10, 2008 You care to explain what you have in mind for this "i want to use this function everywhere" thing? The Vollatran project My blog: http://www.vollysinterestingshit.com/
UltraFine Posted November 10, 2008 Author Posted November 10, 2008 (edited) If you are talking of using it in anything, then you are talking about a keylogger, and that is a No No No. Don't ask for it, don't hint at it, nothing.i am talking about sending keys to make my work easy, where did i asked for recording them?You care to explain what you have in mind for this "i want to use this function everywhere" thing?it means whenever i want to write a line i will only write my secret word and the line will be completed automatically. how it sounds like a kelogger? you are a MVP with more than 4,000 posts... Edited November 10, 2008 by L0veUK
JRowe Posted November 10, 2008 Posted November 10, 2008 very good job rasim, Thanks dude!but it will only work in Notepad and i want to use this function everywhere.You need to go through AutoIt 1-2-3 and learn how to use search. What you're trying to do is elementary and covered pretty exhaustively. Learn the language to the point where you can describe what you want to do, and then we can help you a lot more effectively when you encounter something that's difficult. Hotkeys are pretty much a core concept in AutoIt... press a button, make something happen. Instead of typing a magic word, you'd just press shift+F1 and your function will execute, or something like that. To do anything useful with your idea, you need to learn how to implement it. Things like which window is active when you activate the function, and so on. Without knowing the foundation, all the neat ideas you have will never be implemented unless someone else codes it, like rasim. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center]
Bert Posted November 10, 2008 Posted November 10, 2008 i am talking about sending keys to make my work easy, where did i asked for recording them?it means whenever i want to write a line i will only write my secret word and the line will be completed automatically. how it sounds like a kelogger? you are a MVP with more than 4,000 posts...Look, you asked for it to be used everywhere. Which means ANY APPLICATION you type in text. Lets take a look ar your first post:i know i can send keys using Send() but i only want it to be sent when user writes like this.Well, it says "user" which means someone other than you. very good job rasim, Thanks dude!but it will only work in Notepad and i want to use this function everywhere.You imply there you want to use it in ANY application you type.From the looks of it, you are being misleading. Your last thread was locked for you would not give a strait answer, and was misleading. Here, your obviously doing it again. Again, you give me reason to think you are up to something that is not good. Please explain your intention FULLY so that we understand what you have in mind. Being mis-leading is not a good idea here. The Vollatran project My blog: http://www.vollysinterestingshit.com/
rasim Posted November 11, 2008 Posted November 11, 2008 very good job rasim, Thanks dude! but it will only work in Notepad and i want to use this function everywhere.I can only show example. Little modified: #include <GuiEdit.au3> HotKeySet("^q", "_Quit") Run("Notepad") WinWaitActive("[Class:Notepad]") $hWnd = WinGetHandle("[Class:Notepad]") $hEdit = ControlGetHandle("[Class:Notepad]", "", "Edit1") AdlibEnable("_GetText") While 1 Sleep(100) WEnd Func _GetText() Local $iText = _GUICtrlEdit_GetText($hEdit) Local $aString = StringSplit($iText, @CRLF, 1) Local $iLine = 0 If $aString[0] > 0 Then $iLine = $aString[0] - 1 $iLine = _GUICtrlEdit_GetLine($hEdit, $iLine) If (StringRegExp($iLine, "(?i)Line#1\z") = 1) Then _GUICtrlEdit_AppendText($hEdit, " this is just for test") EndFunc Func _Quit() AdlibDisable() Exit EndFunc
UltraFine Posted November 11, 2008 Author Posted November 11, 2008 I can only show example. Little modified: #include <GuiEdit.au3> HotKeySet("^q", "_Quit") Run("Notepad") WinWaitActive("[Class:Notepad]") $hWnd = WinGetHandle("[Class:Notepad]") $hEdit = ControlGetHandle("[Class:Notepad]", "", "Edit1") AdlibEnable("_GetText") While 1 Sleep(100) WEnd Func _GetText() Local $iText = _GUICtrlEdit_GetText($hEdit) Local $aString = StringSplit($iText, @CRLF, 1) Local $iLine = 0 If $aString[0] > 0 Then $iLine = $aString[0] - 1 $iLine = _GUICtrlEdit_GetLine($hEdit, $iLine) If (StringRegExp($iLine, "(?i)Line#1\z") = 1) Then _GUICtrlEdit_AppendText($hEdit, " this is just for test") EndFunc Func _Quit() AdlibDisable() Exit EndFunc Thanks, can you tell me how to use it in SciTE, WordPad, word (Ms Office), etc? it will work only for NotePad...
Bert Posted November 11, 2008 Posted November 11, 2008 (edited) Run("Notepad")WinWaitActive("[Class:Notepad]")$hWnd = WinGetHandle("[Class:Notepad]")$hEdit = ControlGetHandle("[Class:Notepad]", "", "Edit1")Change whats in RED to what you need. You need to be specific on the app. If you want to use any text based editor or anything that uses text, then you will need to make a list for us so we know what to code in. Edited November 11, 2008 by Volly The Vollatran project My blog: http://www.vollysinterestingshit.com/
UltraFine Posted November 11, 2008 Author Posted November 11, 2008 (edited) Run("Notepad") WinWaitActive("[Class:Notepad]") $hWnd = WinGetHandle("[Class:Notepad]") $hEdit = ControlGetHandle("[Class:Notepad]", "", "Edit1") Change whats in RED to what you need. You need to be specific on the app. If you want to use any text based editor or anything that uses text, then you will need to make a list for us so we know what to code in.thanks volly, i need something which can write sentences in some places when i want them. but i can not set Hot keys for this because i will forget about the key combination and there are many sentences. like if in SciTE i want to add a comment than i will simply write ";for and the text will be changed to ";for message box." but i want to use this function not only in SciTE but also in other all types of text editors and places. i hope you can understand and can help in my issue. thanks once again. [edit]also in folder renaming[/edit] Edited November 11, 2008 by L0veUK
Richard Robertson Posted November 11, 2008 Posted November 11, 2008 The only way you can do that is through a keylogger type program. You have to log enough keys to match a phrase, a "HotString" instead of a "HotKey". There is source all over. Have you bothered looking for any of it?
UltraFine Posted November 11, 2008 Author Posted November 11, 2008 The only way you can do that is through a keylogger type program. You have to log enough keys to match a phrase, a "HotString" instead of a "HotKey".There is source all over. Have you bothered looking for any of it?what is HotString? it's not in help file. isearched the forum but nothing exists which can match my question. please explain more i really could not understand it. Thanks.
oMBRa Posted November 11, 2008 Posted November 11, 2008 http://www.autoitscript.com/forum/index.ph...mp;hl=hotstring
Richard Robertson Posted November 11, 2008 Posted November 11, 2008 It's not terribly complicated. But you should be able to do the work from here.
Bert Posted November 11, 2008 Posted November 11, 2008 I think what will help you is this:http://www.pcmag.com/article2/0,4149,427373,00.asp The Vollatran project My blog: http://www.vollysinterestingshit.com/
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