Sign in to follow this  
Followers 0
SatelliteKiD

neeed help.. auto tab

5 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by SatelliteKiD

Share this post


Link to post
Share on other sites

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.

HotKeySet("{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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

If its just Notepad, ControlSend|ControlSetText is much more preferable,

Check it in the help file

Regards :)

Edited 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.

Share this post


Link to post
Share on other sites

thanks for the response ^^.

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  
Followers 0