Jump to content
Sign in to follow this  

what's the problem with this code shutdown !!

Recommended Posts

here in my code i want it to force restart then i type this :

Here is my Full Code

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1_1 = GUICreate("Timer V1.1", 285, 149, 192, 124)
$Combo1 = GUICtrlCreateCombo("ShutDown", 16, 8, 241, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE))
GUICtrlSetFont(-1, 10, 400, 0, "Impact")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x6D6D6D)
$start = GUICtrlCreateButton("Start", 152, 48, 129, 97)
$Label1 = GUICtrlCreateLabel("Mins", 24, 64, 51, 31)
GUICtrlSetFont(-1, 16, 400, 0, "Neo Tech Alt Medium")
$Input1 = GUICtrlCreateInput("", 24, 96, 105, 32, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetData( $Combo1 , "Restart |Log off")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $start
            $t = GUICtrlRead($Input1)
            $c = GUICtrlRead($Combo1)
            If $c = "Shutdown" Then
                Sleep( $t * 60000 )

            ElseIf $c = "Restart" Then
                Sleep( $t * 60000 )

            ElseIf $c = "Log off" Then
                Sleep( $t * 60000 )


Edited by yousefsamy

Share this post

Link to post
Share on other sites

How about showing all of your GUI creation? Without seeing all of your code, or at least a decent reproducer, you're asking us to first guess at what you're trying to do and then troubleshoot it for you. Help us help you.


Edit: And while this is the most important thing in the world to you, adding more exclamation points to your titles doesn't get it noticed any faster.

Edited by JLogan3o13

Share this post

Link to post
Share on other sites

In your GUICtrlSetData you have a space after Restart. In your If statement you do not. So this:

ElseIf $c = "Restart" Then

will never resolve. You need to delete the space in your GUICtrlSetData line.

Share this post

Link to post
Share on other sites


You have already been told. Your present code:

GUICtrlSetData( $Combo1 , "Restart |Log off")
You have an extra space after "Restart so the comparison ElseIf $c = "Restart" Then will never be true.

Change the line to read:

GUICtrlSetData( $Combo1 , "Restart|Log off")
and it will work. ;)


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites

Look, I realize that English is not your native tongue, as I stated in my reply to your uncalled for but tolerated since you weren't asking me for help PM, and as stated in at least one other post here, but you are going to have to think out your words more carefully in the posts you make here. The code fixing answers that JLogan3o13 and Melba23 made in this thread are pretty much exactly the same. The only difference is JLogan3o13 saying what needs to be done, and Melba23 showing you the unworking code and the working code.

Now don't take this as me flaming you, I'm not trying, or doing, that. I realize that the world is a big place, and English is not everybody's first language. However, this forum's primary, and only, language is English. :)

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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  

  • Create New...