The way I have been handeling this is to check if an update is available then setting a registry key.
When Autocad has closed I can then update the changes. This runs in the background on startup.
You could also just check if autocad is running then run the code.
{code}
Module MyCode
Public _AcadProcessList() As String
Public Sub setAcadEvent()
Dim ProcessList As System.Diagnostics.Process()
Dim Proc As System.Diagnostics.Process
ProcessList = System.Diagnostics.Process.GetProcesses()
Try
For Each Proc In ProcessList
If UCase(CStr(Proc.ProcessName)) = UCase("acad") Then
If Not hasValue(_AcadProcessList, CStr(Proc.Id)) Then
inc(_AcadProcessList)
_AcadProcessList(UBound(_AcadProcessList)) = (CStr(Proc.Id))
Proc.EnableRaisingEvents = True
AddHandler Proc.Exited, AddressOf MyCode.ProcessExited
End If
End If
Next
Catch ex As Exception
End Try
End Sub
Friend Sub ProcessExited(ByVal sender As Object, ByVal e As System.EventArgs)
' Autocad has closed run update code
End Sub
Public Function hasValue(ByVal myArray, ByVal value) As Boolean
Dim item As Object
Dim rtnCheck As Boolean = False
If isValid(myArray) Then
For Each item In myArray
If item = value Then
rtnCheck = True
Exit For
End If
Next
Else
End If
Return rtnCheck
End Function
Sub inc(ByRef aryValue() As String)
' Check if aryay has a substring then add one
If isValid(aryValue) Then
' Don't erase any old information
ReDim Preserve aryValue(aryValue.Length)
Else
ReDim aryValue(0)
End If
End Sub
End Module
{code}
---------------------------
(defun botsbuildbots() (botsbuildbots))