Can anyone tell me why the below code sometimes returns the wrong %FinalPrem%, but mostly it works?
The setup of the script is to:
1: take a value from a system
2: put the value into excel
3: copy the calculated excel value
4: plaste the calculated value from above into the place where i took the value in step 1.
For some reason the value in step 4 is sometimes the same value as step 1! But only like one out of 20 or 30.
Do i need more delays in my code to make it more reliable?
Code:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#3:: ;Brug ved 3 deductables
loop
{
loop 3
{
Send ^c
sleep 100
IfEqual, Clipboard, %FinalPrem%
{
Msgbox, Cover finished
return
}
Winactivate, Microsoft Excel - Indeksliste.xlsx
sleep 100
Send ^v
sleep 125
Send {right}
sleep 125
Send ^c
sleep 325
FinalPrem := clipboard
sleep 225
Send {left}
sleep 125
Winactivate, ProductBuilder
sleep 100
Send, {F2}
sleep 125
Send, +{home}
sleep 200
Send, %FinalPrem%
sleep 125
Send, {enter}
sleep 125
send, {right}
sleep 125
}
send {tab}
send {tab}
send {tab}
}
return
Edit: Added SendMode Input to the post that i forgot to copy from my code