mzgjan Posted October 16, 2012 Share Posted October 16, 2012 Hi there, i got a problem with my inputboxes i use koda form designer and its inboxes if i got one for "seconds" and one for "minutes" and i gave them the style "ES_NUMBER" now i want to make this: Global $timer_total = $timer_minutes * 60 + $timer_seconds but the output is 194 when the input of both is 0!? why? heres all of it: expandcollapse popup#include #include #include #include #include #Region ### START Koda GUI section ### Form= $main_window = GUICreate("Easy Shutdowner v0.5", 327, 250, 384, 213) $extras = GUICtrlCreateMenu("&Extras") $shortcuts = GUICtrlCreateMenu("Dekstopverknüpfung erstellen##TAB####TAB##"&@TAB&"", $extras) $cs_shutdown = GUICtrlCreateMenuItem("Herunterfahren##TAB##"&@TAB&"", $shortcuts) $cs_restart = GUICtrlCreateMenuItem("Neustarten##TAB##Shift+X"&@TAB&"", $shortcuts) $cs_hibernate = GUICtrlCreateMenuItem("Ruhezustand##TAB##", $shortcuts) $update = GUICtrlCreateMenuItem("Update##TAB##", $extras) $info = GUICtrlCreateMenuItem("Über EasyShutdowner", $extras) $changelog = GUICtrlCreateMenuItem("View Changelog##TAB##FESTSTELL"&@TAB&"FESTSTELL", $extras) GUISetCursor (3) $shutdown = GUICtrlCreateButton("Herunterfahren", 32, 64, 265, 49) GUICtrlSetCursor (-1, 3) $restart = GUICtrlCreateButton("Neustarten", 32, 120, 129, 41) GUICtrlSetCursor (-1, 3) $hibernate = GUICtrlCreateButton("Ruhezustand", 168, 120, 129, 41) GUICtrlSetCursor (-1, 3) $timer_seconds = GUICtrlCreateInput("0", 280, 184, 33, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetCursor (-1, 3) $timer_minutes = GUICtrlCreateInput("0", 168, 184, 33, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER)) GUICtrlSetCursor (-1, 3) $Logo = GUICtrlCreateLabel("Easy Shutdowner", 0, 8, 321, 49, $SS_CENTER) GUICtrlSetFont(-1, 12, 400, 0, "Kraash") GUICtrlSetColor(-1, 0x008000) GUICtrlSetCursor (-1, 3) $copyright = GUICtrlCreateLabel("written by Jan Schönfließ, 2012", 0, 211, 325, 17, $SS_CENTER) GUICtrlSetTip(-1, "from Germany") GUICtrlSetCursor (-1, 3) $label_aufzeit = GUICtrlCreateLabel("Auf Zeit:", 8, 176, 103, 28) GUICtrlSetFont(-1, 20, 400, 0, "LCD2") GUICtrlSetTip(-1, "Der PC wird in der angegeben Zeit heruntergefahren, neu gestartet oder in den Ruhezustand versetzt") GUICtrlSetCursor (-1, 3) $label_minutes = GUICtrlCreateLabel("Minuten", 120, 184, 50, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetCursor (-1, 3) $label_seconds = GUICtrlCreateLabel("Sekunden", 216, 184, 65, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetCursor (-1, 3) Dim $main_window_AccelTable[1][2] = [["{FESTSTELL}", $changelog]] GUISetAccelerators($main_window_AccelTable) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;--------------------------------------------------------------------GUI------------------------------------------------------------------------------------------------------------------; ; ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------; ;-------------------------------------------------------------------CODE------------------------------------------------------------------------------------------------------------------; Global $firstrun = 0 If Not FileExists(@AppDataDir & "\EasyShutdowner") Then Global $firstrun = 1 DirCreate(@AppDataDir & "\EasyShutdowner") DirCreate(@AppDataDir & "\EasyShutdowner\res") DirCreate(@AppDataDir & "\EasyShutdowner\res\engine") DirCreate(@AppDataDir & "\EasyShutdowner\res\media") InetGet ("https://dl.dropbox.com/u/68889350/EasyShutdowner/Updates/shutdown.bat", @AppDataDir & "\EasyShutdowner\res\engine\shutdown.bat") InetGet ("https://dl.dropbox.com/u/68889350/EasyShutdowner/Updates/hibernate.bat", @AppDataDir & "\EasyShutdowner\res\engine\hibernate.bat") InetGet ("https://dl.dropbox.com/u/68889350/EasyShutdowner/Updates/restart.bat", @AppDataDir & "\EasyShutdowner\res\engine\restart.bat") EndIf While 1 Global $timer_total = $timer_minutes * 60 + $timer_seconds $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE If $firstrun = 1 Then FileMove(@ScriptDir & "\EasyShutdown.exe", @AppDataDir & "\EasyShutdowner") FileCreateShortcut(@AppDataDir & "\EasyShutdowner\EasyShutdown.exe", @DesktopDir & "\EasyShutdown.lnk") Exit Else Exit EndIf Case $shutdown MsgBox("0", "Cool", $timer_total) If $timer_total = 0 Then Run(@AppDataDir & "\EasyShutdowner\res\engine\shutdown.bat") Else ShellExecute("shutdown.exe -f -s -t " & $timer_total) EndIf Case $restart If $timer_total = 0 Then Run(@AppDataDir & "\EasyShutdowner\res\engine\restart.bat") Else ShellExecute("shutdown.exe -f -r -t " & $timer_total) EndIf Case $hibernate If $timer_total = 0 Then Run(@AppDataDir & "\EasyShutdowner\res\engine\hibernate.bat") Else ShellExecute("shutdown.exe -f -h -t " & $timer_total) EndIf Case $update FileDelete(@AppDataDir & "\EasyShutdowner\red\engine\shutdown.bat") FileDelete(@AppDataDir & "\EasyShutdowner\red\engine\hibernate.bat") FileDelete(@AppDataDir & "\EasyShutdowner\red\engine\restart.bat") InetGet ("https://dl.dropbox.com/u/68889350/EasyShutdowner/Updates/shutdown.bat", @AppDataDir & "\EasyShutdowner\res\engine\shutdown.bat") InetGet ("https://dl.dropbox.com/u/68889350/EasyShutdowner/Updates/hibernate.bat", @AppDataDir & "\EasyShutdowner\res\engine\hibernate.bat") InetGet ("https://dl.dropbox.com/u/68889350/EasyShutdowner/Updates/restart.bat", @AppDataDir & "\EasyShutdowner\res\engine\restart.bat") sleep(100) MsgBox(0, "Update erfolgreich", "Sie besitzen nun die aktuellste Version!") Case $changelog ShellExecute("https://dl.dropbox.com/u/68889350/EasyShutdowner/Updates/changelog.htm", 1) Case $info MsgBox(0, "Über E.S.", "EasyShutdowner wurde geschrieben von Jan Schönfließ"&@CRLF&@CRLF&"EasyShutdowner bewirkt ein schnelleres Herunterfahren durch Beenden von nicht"&@CRLF&"notwendigen Prozessen und anschließendem Erzwingen eines Shutdowns."&@CRLF&@CRLF&"EasyShutdowner ist Freeware!"&@CRLF&@CRLF&"Mehr auf: http://tinyurl.com/easyshutdowner") Case $cs_shutdown FileCreateShortcut(@AppDataDir & "\EasyShutdowner\res\engine\shutdown.bat", @DesktopDir & "\Schnell Herunterfahren.lnk") MsgBox(0, "Erfolgreich!", "Auf dem Desktop wurde eine Verknüpfung erstellt!"&@CRLF&"Klicken Sie sie doppelt um den PC mit EasyShutdowner herunterzufahren.") Case $cs_restart FileCreateShortcut(@AppDataDir & "\EasyShutdowner\res\engine\restart.bat", @DesktopDir & "\Schnell Neustarten.lnk") MsgBox(0, "Erfolgreich!", "Auf dem Desktop wurde eine Verknüpfung erstellt!"&@CRLF&"Klicken Sie sie doppelt um den PC mit EasyShutdowner neuzustarten.") Case $cs_hibernate FileCreateShortcut(@AppDataDir & "\EasyShutdowner\res\engine\hibernate.bat", @DesktopDir & "\Ruhezustand.lnk") MsgBox(0, "Erfolgreich!", "Auf dem Desktop wurde eine Verknüpfung erstellt!"&@CRLF&"Klicken Sie sie doppelt um den PC mit EasyShutdowner in den Ruhezustand zu versetzen.") EndSwitch WEnd sorry for my english im from germany Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 16, 2012 Moderators Share Posted October 16, 2012 mzgjan, Welcome to the AutoIt forum. You need to read the content of the inputs - at the moment you are using the ControlID. So this line: Global $timer_total = $timer_minutes * 60 + $timer_seconds should read: Global $timer_total = GUICtrlRead($timer_minutes) * 60 + GUICtrlRead($timer_seconds) All clear? M23 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 Link to comment Share on other sites More sharing options...
water Posted October 16, 2012 Share Posted October 16, 2012 Kein Problem mit Dinem Englisch! You don't process the content of the GUI control but the ControlId. You have to use $iMinutes = GUICtrlRead($timer_minutes)to get the content of the Control. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mzgjan Posted October 17, 2012 Author Share Posted October 17, 2012 Diamonds for you! Works fine! Link to comment Share on other sites More sharing options...
water Posted October 17, 2012 Share Posted October 17, 2012 Glad to be of service My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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