SatelliteKiD Posted February 15, 2013 Share Posted February 15, 2013 hi, i just want to make a script that can type letter "A" on two notepad.. alt tab to each other and press "A" non-stop... can someone help me? just a newbie and want to learn... HotKeySet("{End}", "stop") HotKeySet("{Home}", "Start") Func Start() If WinActive("Notepad1") = 0 then Do WinActivate("Notepad1") Until WinActive("Notepad1") EndIf If WinActive("Notepad2") = 0 then Do WinActivate("Notepad2") Until WinActive("Notepad2") EndIf Send('A') Send('A') Send('A') Send('A') Send('A') WEnd EndFunc func stop() Exit EndFunc Link to comment Share on other sites More sharing options...
SatelliteKiD Posted February 15, 2013 Author Share Posted February 15, 2013 (edited) thanks anyway.. i got it.. but the problem is the hotkey is not functioning.. when i press end/home, nothing happens. HotKeySet("{End}", "stop") HotKeySet("{Home}", "Start") Local $a = 0 Do $a += 1 WinActivate("notepad1 - Notepad") Send('a') Sleep(100) Send('a') Sleep(100) WinActivate("Notepad2 - Notepad") Send('a') Sleep(100) Send('a') Sleep(100) Until $a = 99999 Edited February 15, 2013 by SatelliteKiD Link to comment Share on other sites More sharing options...
Malkey Posted February 15, 2013 Share Posted February 15, 2013 thanks anyway.. i got it.. but the problem is the hotkey is not functioning.. when i press end/home, nothing happens. HotKeySet("{End}", "stop") HotKeySet("{Home}", "Start") Local $a = 0 Do $a += 1 WinActivate("notepad1 - Notepad") Send('a') Sleep(100) Send('a') Sleep(100) WinActivate("Notepad2 - Notepad") Send('a') Sleep(100) Send('a') Sleep(100) Until $a = 99999 For the hotkeys to work you need the functions, "stop()" and "Start()", which associated with the "{End}" and "{Home}" hotkeys. expandcollapse popupHotKeySet("{End}", "_Stop") HotKeySet("{Home}", "_Start") Global $PID1 = Run("notepad.exe") WinActivate("Untitled - Notepad", "") WinWaitActive("Untitled - Notepad", "") WinSetTitle("Untitled - Notepad", "", "notepad1 - Notepad") Global $PID2 = Run("notepad.exe") WinActivate("Untitled - Notepad", "") WinWaitActive("Untitled - Notepad", "") WinSetTitle("Untitled - Notepad", "", "notepad2 - Notepad") While 1 Sleep(20) WEnd Func _Start() Local $a = 0 Do $a += 1 WinActivate("notepad1 - Notepad") WinWaitActive("notepad1 - Notepad") Send('a') Send('a') WinActivate("notepad2 - Notepad") WinWaitActive("notepad2 - Notepad") ControlSend("notepad2 - Notepad", "", "Edit1", "aa") Sleep(20) Until $a = 99999 EndFunc ;==>_Start Func _Stop() If $PID1 Then ProcessClose($PID1) If $PID2 Then ProcessClose($PID2) Exit EndFunc ;==>_Stop Link to comment Share on other sites More sharing options...
PhoenixXL Posted February 15, 2013 Share Posted February 15, 2013 (edited) If its just Notepad, ControlSend|ControlSetText is much more preferable,Check it in the help fileRegards Edited February 15, 2013 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
SatelliteKiD Posted February 15, 2013 Author Share Posted February 15, 2013 thanks for the response ^^. 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