Sign in to follow this  
Followers 0
HockeyFan

Help!

8 posts in this topic

#1 ·  Posted (edited)

HELP! :lmao:

Can someone tell me what I am doing wrong here! I have a script that produces a GUI message before an upgrade is performed that gives the user an option of selecting OK or Exit. When the user selects Exit, a second GUI message pops up asking the user to confirm that they want to exit. I want the second message to go back to the first GUI message screen if "No" is clicked and Exit the script if "Yes" is clicked. So far, nothing happens when you click on any of the GUI controls on the second GUI window. :ph34r:

Here is my code so far...

#include <GuiConstants.au3>
$font = "Arial Bold"
;Main Message Screen Text
$GuiMessage = "" & @CR & "This is an automated software upgrade of your..." & @CR & "" & @CR & "McAfee Virus Scan software." & @CR & "" & @CR & "This process will upgrade your software version to 8.0i." & @CR & "" & @CR & "At this time, please save all your work and close all open applications."& @CR & "" & @CR & "Please note..." & @CR & "" & @CR & "Your computer will be restarted to begin this installation."& @CR & "" & @CR & "If you expereince any problems during this upgrade," & @CR & "please call the Help Desk at extension 3924." & @CR & "" & @CR & 'Click the "OK" button to begin installation or the "Exit" button to quit.'

;Main GUI Message Screen Creation
$GuiWindow = GUICreate("Attention!", 650, 400, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel($GuiMessage, 0, 0, 650, 330, $SS_CENTER)
GUICtrlSetFont (-1, 12, 400, 0, $font)
$Okbutton = GUICtrlCreateButton("OK", 235, 350, 80)
$CloseButton = GUICtrlCreateButton("Exit", 335, 350, 80)

GUISetState()

while 1
    $msg = GUIGetMsg(1)
    Switch $msg[0]
        Case $CloseButton     
            GUIDelete(CLOSEClicked())           
        Case $Okbutton
            Run("C:\Software\McafeeVSv80iUpgrade\TrackingData.exe", "C:\Software\McafeeVSv80iUpgrade", @SW_MAXIMIZE)
            GUIDelete()
            Exit
        EndSwitch
WEnd

Func CLOSEClicked()
  ;GUISetState(@SW_HIDE, $GuiWindow)
;GuiCreate("Exit?", 393, 183, -1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    $GuiExit = GuiCreate("Exit?", 420, 180, -1, -1)
    $ExitText = "Are you sure you want to cancel this installation?" & @CR & "" & @CR & "It's very important that you install this upgrade" & @CR & "to keep your computer safe from virus activity!"
    $ExitMessage = GuiCtrlCreateLabel($ExitText, 20, 20, 390, 100)
    GUICtrlSetFont (-1, 12, 400, 0, $font)
    $ExitYes = GuiCtrlCreateButton("Yes", 100, 130, 100, 30)
    $ExitNo = GuiCtrlCreateButton("No", 220, 130, 100, 30)
    
    GuiSetState()
    
    While 1
        $msg = GUIGetMsg(1)
        Switch $msg[0]
            Case $GUI_EVENT_CLOSE
                GUISwitch($GuiWindow)
                Return($GuiWindow) 
            Case $ExitYes
                Exit
            Case $ExitNo
                GUISwitch($GuiWindow)
                Return($GuiWindow)
        EndSwitch     
    WEnd
EndFunc

I used most of the from an example, but I am unable to get my version to function properly. PLEASE HELP! :geek:

Thanks in advance.

Edited by HockeyFan

Share this post


Link to post
Share on other sites



#include <GuiConstants.au3>
$font = "Arial Bold"
;Main Message Screen Text
$GuiMessage = "" & @CR & "This is an automated software upgrade of your..." & @CR & "" & @CR & "McAfee Virus Scan software." & @CR & "" & @CR & "This process will upgrade your software version to 8.0i." & @CR & "" & @CR & "At this time, please save all your work and close all open applications." & @CR & "" & @CR & "Please note..." & @CR & "" & @CR & "Your computer will be restarted to begin this installation." & @CR & "" & @CR & "If you expereince any problems during this upgrade," & @CR & "please call the Help Desk at extension 3924." & @CR & "" & @CR & 'Click the "OK" button to begin installation or the "Exit" button to quit.'

;Main GUI Message Screen Creation
$GuiWindow = GUICreate("Attention!", 650, 400, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel($GuiMessage, 0, 0, 650, 330, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, $font)
$Okbutton = GUICtrlCreateButton("OK", 235, 350, 80)
$CloseButton = GUICtrlCreateButton("Exit", 335, 350, 80)

GUISetState()

While 1
    $msg = GUIGetMsg(1)
    Switch $msg[0]
        Case $CloseButton
            GUIDelete(CLOSEClicked())
        Case $Okbutton
            Run("C:\Software\McafeeVSv80iUpgrade\TrackingData.exe", "C:\Software\McafeeVSv80iUpgrade", @SW_MAXIMIZE)
            GUIDelete()
            Exit
    EndSwitch
WEnd

Func CLOSEClicked()
    ;GUISetState(@SW_HIDE, $GuiWindow)
    ;GuiCreate("Exit?", 393, 183, -1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    $GuiExit = GUICreate("Exit?", 420, 180, -1, -1)
    $ExitText = "Are you sure you want to cancel this installation?" & @CR & "" & @CR & "It's very important that you install this upgrade" & @CR & "to keep your computer safe from virus activity!"
    $ExitMessage = GUICtrlCreateLabel($ExitText, 20, 20, 390, 100)
    GUICtrlSetFont(-1, 12, 400, 0, $font)
    $ExitYes = GUICtrlCreateButton("Yes", 100, 130, 100, 30)
    $ExitNo = GUICtrlCreateButton("No", 220, 130, 100, 30)

    GUISetState()

    While 1
        $msg2 = GUIGetMsg(1)
        Switch $msg2[0]
            Case $GUI_EVENT_CLOSE
                GUISwitch($GuiWindow)
                Return ($GuiWindow)
            Case $ExitYes
                Exit
            Case $ExitNo
                GUISwitch($GuiWindow)
                Return ($GuiWindow)
        EndSwitch
    WEnd
EndFunc   ;==>CLOSEClicked


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Were any changes made to my code?

Share this post


Link to post
Share on other sites

Did you bother to read the response? He may have just corrected it by using autoit tags instead of code.

Share this post


Link to post
Share on other sites

$msg2 = GUIGetMsg(1)
        Switch $msg2[0]
Thanks for your input...sorry I missed your changes, :"> It was friday and I was ready for the weedend. Anyway, your changes did not correct the problem. The second GUI message still does nothing when you click the "No" button. Well, actually, the first GUI message is closed when you click the "No" button. I wanted the second GUI button to close and reactivate the first GUI message instead. Any ideas? :whistle:

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>
$font = "Arial Bold"
;Main Message Screen Text
$GuiMessage = "" & @CR & "This is an automated software upgrade of your..." & @CR & "" & @CR & "McAfee Virus Scan software." & @CR & "" & @CR & "This process will upgrade your software version to 8.0i." & @CR & "" & @CR & "At this time, please save all your work and close all open applications." & @CR & "" & @CR & "Please note..." & @CR & "" & @CR & "Your computer will be restarted to begin this installation." & @CR & "" & @CR & "If you expereince any problems during this upgrade," & @CR & "please call the Help Desk at extension 3924." & @CR & "" & @CR & 'Click the "OK" button to begin installation or the "Exit" button to quit.'

;Main GUI Message Screen Creation
$GuiWindow = GUICreate("Attention!", 650, 400, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel($GuiMessage, 0, 0, 650, 330, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, $font)
$Okbutton = GUICtrlCreateButton("OK", 235, 350, 80)
$CloseButton = GUICtrlCreateButton("Exit", 335, 350, 80)

GUISetState()

While 1
    $msg = GUIGetMsg(1)
    Switch $msg[0]
        Case $CloseButton
            CLOSEClicked()
        Case $Okbutton
            Run("C:\Software\McafeeVSv80iUpgrade\TrackingData.exe", "C:\Software\McafeeVSv80iUpgrade", @SW_MAXIMIZE)
            GUIDelete()
            Exit
    EndSwitch
WEnd

Func CLOSEClicked()
    ;GUISetState(@SW_HIDE, $GuiWindow)
    ;GuiCreate("Exit?", 393, 183, -1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    $GuiExit = GUICreate("Exit?", 420, 180, -1, -1)
    $ExitText = "Are you sure you want to cancel this installation?" & @CR & "" & @CR & "It's very important that you install this upgrade" & @CR & "to keep your computer safe from virus activity!"
    $ExitMessage = GUICtrlCreateLabel($ExitText, 20, 20, 390, 100)
    GUICtrlSetFont(-1, 12, 400, 0, $font)
    $ExitYes = GUICtrlCreateButton("Yes", 100, 130, 100, 30)
    $ExitNo = GUICtrlCreateButton("No", 220, 130, 100, 30)

    GUISetState()

    While 1
        $msg2 = GUIGetMsg(1)
        Switch $msg2[0]
            Case $GUI_EVENT_CLOSE, $ExitNo
                ExitLoop
            Case $ExitYes
                Exit
        EndSwitch
    WEnd
    GUISwitch($GuiWindow)
    GUIDelete($GuiExit)
EndFunc   ;==>CLOSEClicked


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>
$font = "Arial Bold"
;Main Message Screen Text
$GuiMessage = "" & @CR & "This is an automated software upgrade of your..." & @CR & "" & @CR & "McAfee Virus Scan software." & @CR & "" & @CR & "This process will upgrade your software version to 8.0i." & @CR & "" & @CR & "At this time, please save all your work and close all open applications." & @CR & "" & @CR & "Please note..." & @CR & "" & @CR & "Your computer will be restarted to begin this installation." & @CR & "" & @CR & "If you expereince any problems during this upgrade," & @CR & "please call the Help Desk at extension 3924." & @CR & "" & @CR & 'Click the "OK" button to begin installation or the "Exit" button to quit.'

;Main GUI Message Screen Creation
$GuiWindow = GUICreate("Attention!", 650, 400, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel($GuiMessage, 0, 0, 650, 330, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, $font)
$Okbutton = GUICtrlCreateButton("OK", 235, 350, 80)
$CloseButton = GUICtrlCreateButton("Exit", 335, 350, 80)

GUISetState()

While 1
    $msg = GUIGetMsg(1)
    Switch $msg[0]
        Case $CloseButton
            CLOSEClicked()
        Case $Okbutton
            Run("C:\Software\McafeeVSv80iUpgrade\TrackingData.exe", "C:\Software\McafeeVSv80iUpgrade", @SW_MAXIMIZE)
            GUIDelete()
            Exit
    EndSwitch
WEnd

Func CLOSEClicked()
    ;GUISetState(@SW_HIDE, $GuiWindow)
    ;GuiCreate("Exit?", 393, 183, -1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    $GuiExit = GUICreate("Exit?", 420, 180, -1, -1)
    $ExitText = "Are you sure you want to cancel this installation?" & @CR & "" & @CR & "It's very important that you install this upgrade" & @CR & "to keep your computer safe from virus activity!"
    $ExitMessage = GUICtrlCreateLabel($ExitText, 20, 20, 390, 100)
    GUICtrlSetFont(-1, 12, 400, 0, $font)
    $ExitYes = GUICtrlCreateButton("Yes", 100, 130, 100, 30)
    $ExitNo = GUICtrlCreateButton("No", 220, 130, 100, 30)

    GUISetState()

    While 1
        $msg2 = GUIGetMsg(1)
        Switch $msg2[0]
            Case $GUI_EVENT_CLOSE, $ExitNo
                ExitLoop
            Case $ExitYes
                Exit
        EndSwitch
    WEnd
    GUISwitch($GuiWindow)
    GUIDelete($GuiExit)
EndFunc   ;==>CLOSEClicked
THANK YOU SO MUCH :whistle: That works!!! :P

Thanks again for your help!! ;)

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