I am working in a External HDD manufacturing company. I have requirement to upgrade the FW for thousands of HDDs. I have to upload two files in sequence to get the upload completed. To do manual processing takes time as well as allows chance of Human error. So I decided to automate the key strokes and mouse clicks using Auto Hot Key. I have also compiled the script. However the script is unstable. Sometimes it works fine. Some times the control click don't work. Sometimes the key input won't be typed full. But the script is OK based on my knowledge. If there is any mistake please correct me. Also I want to safe remove the drive so if there is any coding for it please add it up as well
My process is explanation is as below.
- Connect the HDD to PC and Wait PC to Detect HDD
- Open the FW upload tool
- Click RESCAN and wait for HDD to show up in the tool
- Click browse for first FW file.
- Then select the check box near HDD shown in the tool.
- Click DOWNLOAD and press enter at next warning message.
- Wait for Download to finish and press OK after success message shown.
- Repeat step 3 to 7 for second FW file.
- Click exit and Safe remove the HDD.
Below is my script.
Run, open "Application Location"
Winwait, Warning
if ErrorLevel
{
MsgBox, Window timed out.
return
}
else
{
ControlClick, OK, Warning
Winwait, Application Window name
if ErrorLevel
{
MsgBox, WinWait timed out.
return
}
else
{
; Upload first FW File
ControlClick, Rescan, Application Window name
ControlClick, Browse, Application Window name
Winwait, Open
if ErrorLevel
{
MsgBox, WinWait timed out.
return
}
else
{
SendInput, {Raw}Location of First File
Send, {Enter}
}
sleep, 1500
WinActivate, Application Window name
CoordMode, Mouse, Relative
Click 43, 126
ControlClick, Download, Application Window name
Winwait, Warning
if ErrorLevel
{
MsgBox, WinWait timed out.
return
}
else
{
Send, {Enter}
}
Winwait, Download Successful
if ErrorLevel
{
MsgBox, WinWait timed out.
return
}
else
{
ControlClick, OK, Download Successful
}
}
; Upload Second FW File
WinActivate, Application Window name
ControlClick, Rescan, Application Window name
ControlClick, Browse, Application Window name
Winwait, Open
if ErrorLevel
{
MsgBox, WinWait timed out.
return
}
else
{
SendInput, {Raw}Second FW File location
Send, {Enter}
}
sleep, 1500
WinActivate, Application Window name
CoordMode, Mouse, Relative
Click 43, 126
sleep, 2000
ControlClick, Download, Application Window name
Winwait, Warning
if ErrorLevel
{
MsgBox, WinWait timed out.
return
}
else
{
Send, {Enter}
}
Winwait, Download Successful
if ErrorLevel
{
MsgBox, WinWait timed out.
return
}
else
{
ControlClick, OK, Download Successful
sleep, 1500
ControlClick, Exit, Application Window name
}
}