Hi All,
This script is included in my AIP as an attached action. <InsertProgrammers> returns 0 if everything works out; 1 if it doesn't.
The install does not fail (as expected) when <InsertProgrammers> returns 1; what could be the trouble?
TIA,
Carl
//////////////// SCRIPT FOLLOWS ////////////////
' A linefeed/carriage-return combo.
CRLF = (Chr(13) & Chr(10))
Function InsertProgrammers
Dim Retval, PICKit2Done, RLinkDone, USBICPDone
PICKit2Done = False : RLinkDone = False : USBICPDone = False
Do While (True)
Retval = 1
If (AttachProgrammer(PICKit2Done, "PICKit2")) Then
If (AttachProgrammer(RLinkDone, "RLink")) Then
If (AttachProgrammer(USBICPDone, "USB-ICP")) Then
Retval = 0 : Exit Do
End If
End If
End If
If (Retval = 1) Then
If (ConfirmCancel() = 6) Then
Exit Do
End If
End If
Loop
InsertProgrammers = Retval
End Function
Function ConfirmCancel()
Dim sMsg
sMsg = ("Cancelling now will cancel the installation:" & CRLF & _
"Do you want to cancel the installation?")
ConfirmCancel = MsgBox(sMsg, 4+64, "Cancel Insert Programmers")
End Function
Function AttachProgrammer(ByRef bDoneAlready, sProgName)
Dim sMsg
If (Not bDoneAlready) Then
sMsg = ("1) Insert the " & sProgName & " Programmer into a USB connector." & CRLF & _
"2) Allow Window's to update the device's USB driver(s)." & CRLF & _
"3) Once Window's has updated the USB driver(s), remove" & CRLF & _
" the programmer from the USB connector and select the <OK> button.")
bDoneAlready = (MsgBox(sMsg, 1+32, "Insert " & sProgName & " Programmer") = 1)
End If
AttachProgrammer = bDoneAlready
End Function
FOLLOW US
Get the latest news in Application Packaging