What I expect this to do/what it does most of the time:
Copy data from chrome from NameX/Y and NumberX/Y coords and paste both of them in the specified sequence. This stores the Name in LeadName, replaces the clipboard with the Number, pastes the Number, restores LeadName to the clipboard, and pastes LeadName.
The problem:
Instead of pasting the value it just copied from NumberX/Y coords sometimes it will paste the LeadName twice in a row.
I've tried
If Clipboard = LeadName
If Clipboard is not digit/integer
etc. to stop it, but the message box and return don't stop the script. It still continues.
Code: Select all
Click %NameX%, %NameY%, 2
sleep 100
Send ^c
Clipboard := StrReplace(Clipboard, "`r`n")
sleep 100
ComObjCreate("SAPI.SpVoice").Speak(Clipboard)
LeadName := Clipboard
Sleep 100
if LeadName is upper
StringLower, LeadName, LeadName, T
sleep 100
Click %NumberX%, %NumberY%, 3
sleep 100
Send ^c
sleep 100
Send ^{tab}
Click %NewTextX%, %NewTextY%
Clipboard := RegExReplace(Clipboard, "^1|[^0-9]", "")
sleep 100
If Clipboard = LeadName
{
MsgBox, ,Autopilot Error, Phone number not in clipboard.
BlockInput MouseMoveOff
return
}
Send ^v
Send {tab}{tab}
Clipboard := LeadName
LeadName =
send Hi%A_Space%
sleep 100
send ^v
sleep 100