I'm writing a small script with autohotkey.
I had some trouble of sending text to the application, only way it worked was "send {A}" which is like clicking a keyboard button.
I would like to create a loop around this steps and change Login each time. Standard procedure would be to have a text file a read from it but i don't know how i could do this with my send. Worst case would be to type a function for every login.
So is there a smart way to dynamically change the type on each loop interval? For example in the idea, i don't know how i can build the loop which changes the function each time, so on loop 1 = fn_login , login 2 = fn_login1 ...
Loop
{
FN_OpenApp()
FN_Login()
}
ExitApp
===================================
FN_OpenApp()
{
Click, 100, 100
}
FN_Login()
{
Click, 100, 100
Send {U}
Send {S}
Send {E}
Send {R}
Click, 111, 111
Send {P}
Send {A}
Send {S}
Send {S}
}
;idea__________________________________________
Loop
{
FN_OpenApp()
FN_LoginLoop()
}
ExitApp
FN_OpenApp()
{
Click, 100, 100
}
FN_Login01()
{
Click, 100, 100
Send {U}
Send {S}
Send {E}
Send {R}
Click, 111, 111
Send {P}
Send {A}
Send {S}
Send {S}
}
FN_Login02()
{
Click, 100, 100
Send {U}
Send {S}
Send {E}
Send {R}
Click, 111, 111
Send {P}
Send {A}
Send {S}
Send {S}
}
FN_LoginLoop()
{
login := Object (FN_Login01(), FN_Login02())
for ....
}
Does this help?
; Press F2 to run program
F2:: main()
main()
{
credentials := [["user001","pass001"], ["user002","pass002"]]
for i,cred in credentials
{
user := cred[1]
password := cred[2]
FN_Login( user, password )
}
}
FN_Login( user, password )
{
MsgBox DEBUG: FN_Login(%user%`,%password%)
click 100,100
Send %user%
click 111,111
Send %password%
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.