yousefsamy Posted June 25, 2014 Posted June 25, 2014 (edited) here in my code i want it to force restart then i type this : Here is my Full Code expandcollapse popup#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) GUISetBkColor(0x99B4D1) $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") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $start $t = GUICtrlRead($Input1) $c = GUICtrlRead($Combo1) If $c = "Shutdown" Then Sleep( $t * 60000 ) Shutdown(5) ElseIf $c = "Restart" Then Sleep( $t * 60000 ) Shutdown(6) ElseIf $c = "Log off" Then Sleep( $t * 60000 ) Shutdown(4) EndIf EndSwitch WEnd Edited June 25, 2014 by yousefsamy
Moderators JLogan3o13 Posted June 25, 2014 Moderators Posted June 25, 2014 (edited) 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 June 25, 2014 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Developers Jos Posted June 25, 2014 Developers Posted June 25, 2014 So, what isn't working? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
yousefsamy Posted June 25, 2014 Author Posted June 25, 2014 force reboot ==> shutdown(6) no result for this code !! why
Developers Jos Posted June 25, 2014 Developers Posted June 25, 2014 Maybe you need #RequireAdmin at the top of your script for this to work? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Moderators JLogan3o13 Posted June 25, 2014 Moderators Posted June 25, 2014 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. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
yousefsamy Posted June 25, 2014 Author Posted June 25, 2014 really shutdown and log off are working except restart which i dont know why it didnt work with me not with spaces
Moderators JLogan3o13 Posted June 25, 2014 Moderators Posted June 25, 2014 I just explained why it didn't work. What is your question? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
yousefsamy Posted June 25, 2014 Author Posted June 25, 2014 my question is why only code of restart not working ??
Moderators Melba23 Posted June 25, 2014 Moderators Posted June 25, 2014 yousefsamy,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. M23 yousefsamy 1 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: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
yousefsamy Posted June 25, 2014 Author Posted June 25, 2014 oh my god ,,, my eyes are very weak nowadays
Moderators JLogan3o13 Posted June 25, 2014 Moderators Posted June 25, 2014 I thought that is what I said, guess I should have included pictures like Melba "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
yousefsamy Posted June 25, 2014 Author Posted June 25, 2014 JLogan3o13,, you have told me another reason you told me here is the wrong ===> ElseIf $c = "Restart" Then but no it's in another place ,,
somdcomputerguy Posted June 25, 2014 Posted June 25, 2014 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. yousefsamy 1 - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
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