Guys, I am back. I try this solution separately and it works. But when I try to incorporate into my script, it doesn't work anymore. I am thinking it could be due to global variable but I am not very good at it. Can you please enlighten me?
Code: Select all
;Main Name
^2::
NamePermutation()
Return
;Alternate Name
^3::
AltNamePermutation()
Return
;Name permutation
NamePermutation()
{
;Switch to chrome
WinWait, Release 6.5.1 ,
IfWinNotActive, Release 6.5.1 , ,
WinActivate, Release 6.5.1 ,
WinWaitActive, Release 6.5.1 ,
;Copy name
Send, {Home}
sleep, 50
Click, 204, 321, 3
Sleep, 10
Send, ^c
Sleep, 10
WinWait, Untitled - Notepad,
IfWinNotActive, Untitled - Notepad, ,
WinActivate, Untitled - Notepad,
WinWaitActive, Untitled - Notepad,
Sleep, 10
Send, {CTRLDOWN}a{CTRLUP}
Sleep, 10
Send, {CTRLDOWN}v{CTRLUP}
Sleep, 10
Send, {Backspace}{Home}^+{Right 10}
Sleep, 10
send, ^c
sleep, 10
WinWait, Untitled - Notepad,
IfWinNotActive, Untitled - Notepad, ,
WinActivate, Untitled - Notepad,
WinWaitActive, Untitled - Notepad,
FullName := clipboard
StringSplit, Names, FullName, %A_Space%, . ; omit periods
Loop, % Names0
{
clipboard := % RoundRobin(A_Index)
sleep, 10
Send, ^v{Enter}
}
Return
}
;-------------------------------------------------------------------------------
RoundRobin(Start) { ; custom permutation
;-------------------------------------------------------------------------------
Zero := 0, Result := ""
Loop, % Count := Names%Zero% {
n := (Start-1) + (A_Index-1)
m := Mod(n, Count) + 1
Result .= Names%m% . A_Space
}
return Result
}
;Alternate Name permutation
AltNamePermutation()
{
Send, ^c
Sleep, 10
WinWait, Untitled - Notepad,
IfWinNotActive, Untitled - Notepad, ,
WinActivate, Untitled - Notepad,
WinWaitActive, Untitled - Notepad,
Sleep, 10
Send, {CTRLDOWN}v{CTRLUP}
Sleep, 10
Send, {Backspace}{Home}^+{Right 10}
Sleep, 10
send, ^c
sleep, 10
WinWait, Untitled - Notepad,
IfWinNotActive, Untitled - Notepad, ,
WinActivate, Untitled - Notepad,
WinWaitActive, Untitled - Notepad,
FullName := clipboard
StringSplit, Names, FullName, %A_Space%, . ; omit periods
Loop, % Names0
{
clipboard := % RoundRobin(A_Index)
sleep, 10
Send, ^v{Enter}
}
Return
}