obfuscatedv Posted April 3, 2014 Share Posted April 3, 2014 What I'm trying to do is alert a user pc of an application upgrade. Its just a simple exe that im storing on the users c: drive. The user needs to close excel before it can run. I have tried creating a small gui that allows them to postpone for up to 20 minutes, etc and got down to checking if the process exists, and apparently the function before it doesnt work. So im a bit stuck. expandcollapse popup#RequireAdmin #NoTrayIcon Global $intCount = 0 Global $intCount1 = 0 ; Alert users of upgrade Func _DelayedInstall $intRemain = 3 - $intCount1 $guiMain = GUICreate("Upgrade", 350, 150, -1, -1, -1) GUICtrlCreateLabel("An add-in update is available. Please close Excel and click install when you are ready.", 25, 20, 310, 60) GUICtrlCreateLabel("NOTE: Clicking the 'X' will cause the install to postpone for 20 minutes", 25, 55, 310, 20) $objButtonCont = GUICtrlCreateButton("Install", 82, 90, 70, 20) $objButtonDelay = GUICtrlCreateButton("Postpone", 197, 90, 70, 20) GUICtrlCreateLabel("You may delay this install for 20 minutes, up to " & $intRemain & " more times.", 40, 125, 310, 20) ; If install postponed 3 times, no longer option If $intCount = 3 Then GUICtrlSetState($objButtonDelay, $guiDisable) EndIf GUISetState(@SW_ENABLE) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $objButtonCont ; restart if they hit restart GUISetState(@SW_HIDE) Case $guiEventClose ; proceed with install if they close message box without selecting option GUISetState(@SW_HIDE) $intCount1 += 1 Sleep(600000) _DelayedInstall() Case $objButtonDelay ; they delayed reboot - allows them to save open work in Excel GUISetState(@SW_HIDE) $intCount1 += 1 Sleep(600000) _DelayedInstall() Return EndSwitch WEnd EndFunc ; Check for any open occurrences of excel If ProcessExists("EXCEL.EXE") Then MsgBox("0", "", "You are receiving an add-in update and Excel is open. Please save Excel worksheets and close. If this dialog box is closed before closing Excel, Excel will be closed automatically.") Else EndIf Link to comment Share on other sites More sharing options...
obfuscatedv Posted April 3, 2014 Author Share Posted April 3, 2014 Solved, nevermind. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now