Sign in to follow this  
Followers 0
fraudh8er

Script not Terminating, just Pausing

4 posts in this topic

This code that I have will not terminate, it will just pause. I am not sure why. I need help.

;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win9x/NT/XP
; Author:         Vincent West
; Date:           2 July 2004 
; FileName:  Xaco.exe 
;
; ==================  Changes since last save
;  1. deleted that annoying file that kept showing up on the desktop when I installed NIBRS
;  2. make the yes, no , cancel with via case select statement in all functions
;  3. added the GUI, is not fully funcional yet

; =================== To do on this program
;  1.  Make the popup func better, show status, which being currently installed
;  2.  Ask for the State and install approproate NIBRS stuff accordingly
;  4. Progress bar for entire program, status showing what program it is currently installing.
;  5. Make the NIBRS installers work with all states
;  6. add a cancel button to the main screen, get rid of X
;  7. Make the dll for NIBRS instal also
;  8. Check what the deal with the regdll installer is (
;  9. Make is so it doesn't compress the NewSmartUpdate, and just run it off the CD

; ============================================================
; ============= Start of Main Program ========================
; ============================================================

;SmartUpdate();1
Global $smart = "SMART Software"
Global $timeout = 5;what the delay time will be on all of the popup windows except for the below one

Gui()

;Popup()
       
Done()
Exit

; ===========================================
; ============= End of Main Program =========
; ===========================================


; ================ Start of GUI Function ================================

Func Gui()

  Global $GUI_CHECKED   = 1
  Global $GUI_INDETERMINATE = 2
  Global $GUI_UNCHECKED  = 4

 ;Script generated by AutoBuilder 0.4
 ;Fileinstall (that icon file)

  Opt("GUICoordMode", 1)
  Opt("GUINotifyMode", 1)
  
 ;creates the GUI window with name and given dimensions
  GuiCreate("SMART Installer", 319,380,(@DesktopWidth)/4, (@DesktopHeight-353)/2)
  AutoItSetOption ( "Colormode", 0)

  GUICreateEx ("","0xECE9D8","smart.ico")
  WinSetOnTop("SMART Installer","",1)   ;makes the GUI window always on top

  Dim $top = GUISetControl("label", "SMART SOFTWARE INSTALLER", 29, 20, 260, 20)
    GUISetControlFont(-1, 13, 500)
    
  Dim $SmartUpdate = GUISetControl("checkbox", "Smart Update", 30, 60, 100, 30)
  Dim $DBPix = GUISetControl("checkbox", "DBPix", 30, 100, 60, 20)
  Dim $MSDEServer = GUISetControl("checkbox", "MSDE Server", 30, 135, 90, 20)
  Dim $TightVNC = GUISetControl("checkbox", "TightVNC", 160, 64, 65, 20)
  Dim $DbaMgr = GUISetControl("checkbox", "DBaMgr", 160, 100, 60, 20)
  Dim $Nibrs = GUISetControl("checkbox", "Install NIBRS", 160, 129, 90, 30)
  Dim $WinZip81 = GUISetControl("checkbox", "Install WinZip81", 30, 161, 100, 30)
  
 ;labels and inputs boxes for the three prompts
  GUISetControl("label", "Agency's Full Name", 100, 190, 125, 20)
  Dim $AgencyNm = GUISetControl("input", "Enter Agency's Name", 40, 215, 225, 20)
 ;Global $agency1 = GuiRead($AgencyNm)
 
  Dim $AgencySTLb = GUISetControl("label", "Enter Agency's State", 40, 252, 170, 30)
  
  Dim $AgencyST
  Dim $NibrsST = GUISetControl("combo", "my combo", 155, 252, 80, 100)
    GUISetControlData($AgencyST,"IA|MN|WI|MO|TX|MN")
    
 
 ;GUISetControl("label", "START INSTALLATION", 100, 290, 150, 20)
  $PressHere = GUISetControl("button", "START", 10, 310, 150, 30)
  $Cancel = GUISetControl("button", "CANCEL", 167, 310, 150, 30)


  GuiShow()
 ;GuiWaitClose()
  
  While 1
    ;sleep(100)
     $msg = GuiMsg(0)
     
     Select
     Case $msg = -3
        Cancel()
     Case $msg = $PressHere
       Global $agency1 = GuiRead($AgencyNm) 
       If GuiRead($SmartUpdate) = $GUI_CHECKED Then SmartUpdate()
      ;If GuiRead($DBPix) = $GUI_CHECKED Then DBPix()
      ;If GuiRead($MSDEServer) = $GUI_CHECKED Then MSDE()
      ;If GuiRead($TightVNC) = $GUI_CHECKED Then TightVnc()
      ;If GuiRead($WinZip81) = $GUI_CHECKED Then WinZip81()
      ;If GuiRead($DbaMgr) = $GUI_CHECKED Then DbaMgr()
     Case $msg = $Cancel
        Cancel()
     EndSelect
  WEnd
 ;Done()
 ;GUIHide()
  GUIDelete()

EndFunc
; ================ End of GUI Function ==================================


; ======= Start SmartUpdate Func ====================
; ========= works great 25 june 04 ==============
Func SmartUpdate()

  DirCreate("C:\Program Files\SmarTemp")
 ;DirCreate("C:\Program Files\SMARTPSS\Smart_Update")
  GUIHide()
 ;decompresses the puts the new smartupdate345 file on the C drive
  
  FileInstall("C:\Installation CD\SmartUpdate\setup.exe", "C:\Program Files\SmarTemp\setup.exe", 1)
  FileInstall("C:\Installation CD\SmartUpdate\Setup.lst", "C:\Program Files\SmarTemp\Setup.lst", 1)
  FileInstall("C:\Installation CD\SmartUpdate\Smart_Update.CAB", "C:\Program Files\SmarTemp\Smart_Update.CAB", 1)
  FileInstall("C:\Installation CD\SmartUpdate\Smart_Update.exe", "C:\Program Files\SmarTemp\Smart_Update.exe")
  
 ;Check to see if Smart Update is already installed on the Computer
  If FileExists("C:\Program Files\SmartPSS\Smart_Update\st6unst.log") Then
  ;Runs program that will uninstall the current verion of Smart Update that is installed
     MsgBox(4096, "Smart Installer" , "Smart Update Present, I will Uninstall, Then Install Most Recent Version", 2)
     $var1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ST6UNST #1","UninstallString")
     
  ;Dim $var2 = "C:\Program Files\SmartPSS\Smart_Update\ST6UNST.LOG"
     Run($var1) 
     WinWait("Application Removal")
     Send("!y")
     Send("{ENTER 2}")
  Else
     MsgBox(4096, "Smart Installer" , "Smart Update Not Present, I will Install", 2)
  EndIf
  
  RunWait("C:\Program Files\SmarTemp\setup.exe /silent")
    
  FileMove("C:\Installation CD\Smart_Update.exe", "C:\Program Files\SMARTPSS\SMART_Update\Smart_Update.exe", 1)
;deletes some file that keeps on ending up on the desktop;)
  FileDelete( @DesktopDir & "\ilent")   
  
  DirRemove("C:\Program Files\SmarTemp" ,1)

EndFunc
; ======= End SmartUpdate Func =======

; ========== Start of Done Func =================
Func Done()
 ;DllReg()
  GuiHide()
  MsgBox(64, "SMART Software Installer", " Installation of Selected Items Completed! ")
  Exit
EndFunc

; ============= Start of Cancel Install Func ===========
Func Cancel()
 ;DllReg()
  GuiHide()
  MsgBox(0, "SMART Software Installer", "Installation has been Cancelled",$timeout)
  Exit
EndFunc

Share this post


Link to post
Share on other sites



I don't know if it is the problem, but you have a button named cancel and a function named cancel. Could this be confusing autoit?


Who else would I be?

Share this post


Link to post
Share on other sites

Should the very last line of SmartUpdate say Exit or Done() ?

OR should line# 108 inside of the Select Case block say ExitLoop?

Currently, the only way I can see your program terminating is if the user clicks the 'X' or Cancel button....


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

I put the EndLOop before the WEnd on line 109, but then the program just ends and doesnt even show the GUI at all. I also tried putting the ExitLoop at Line 110, then I get an error saying the ExitLoop is not within a loop. Is there something I am missing, or maybe I am not fully understanding your explaination.

Also I cant put a Done() or Exit at teh end of Smartupdate, because I want to run more Functions before I actually end the program, I just fulled out these couple functions for testing purposes.

Should the very last line of  SmartUpdate say Exit or Done() ?

OR should line# 108 inside of the Select Case block say ExitLoop?

Currently, the only way I can see your program terminating is if the user clicks the 'X' or Cancel button....

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0