MirTexFR Posted September 17, 2015 Posted September 17, 2015 Hi ! I'm new with the Autoit software ! I want to create a number limite for many test or other but i don't know why it's not work !..The script :expandcollapse popup#AutoIt3Wrapper_UseX64=n #include <FontConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <GUIConstants.au3> Global $Init_Dir = "C:\" #pragma compile(FileDescription, Number testing MirTex) #pragma compile(ProductName, MilliTikS) #pragma compile(ProductVersion, 1.0) #pragma compile(FileVersion, 1.0) #pragma compile(LegalCopyright, © MilliTikS Project) $GUI = GUICreate("Interface", 500, 650, -1, -1) GUICtrlCreateTab(10, 110, 480, 400) GUISetFont(9, 300) $menu1 = GUICtrlCreateMenu ("Option", -1, -1) $menu2 = GUICtrlCreateMenu ("License", -1, -1) $Bouton1 = GUICtrlCreateButton("Yes", 35, 599, 100, 25) $Bouton2 = GUICtrlCreateButton("Exit", 375, 599, 100, 25) GUICtrlCreatePic (@ScriptDir & "\Icons\banner.jpg", 0, 0, 500, 100) If Not FileExists(@ScriptDir & "\License.txt") Then $license = InetGet("http://www.gnu.org/licenses/gpl-3.0.txt", @ScriptDir & "\License.txt") InetClose($license) EndIf GUISetState(@SW_SHOW) Menu() Func Menu() Local $idInfoItem = GUICtrlCreateMenuItem("Info", $menu1) EndFunc Tab() Func Tab() GUICtrlCreateTabItem(" Log ") GUICtrlCreateTabItem(" Start Counter ") GUICtrlCreateLabel("Number :", 20, 153, 100, 20) $number = GUICtrlCreateInput("Max 1 000 000", 85, 150, 150, 20) $Bouton3 = GUICtrlCreateButton("Save", 240, 147, 50) $nMsg = GUIGetMsg() Switch $nMsg Case $Bouton3 if $number > 1000000 then MsgBox(64, 'Error', 'The number cannot be high 1 000 000') endif EndSwitch EndFunc While 3 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Bouton2 Exit Case $Bouton1 MsgBox(64 + 8192, 'Message', 'Vous avez cliqué sur le bouton OK') EndSwitch WEnd
Moderators Melba23 Posted September 17, 2015 Moderators Posted September 17, 2015 MirtexFR,Welcome to the AutoIt forums.I have amended the script a little to make it rather more structured:expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Global $cNumber, $cBouton3, $idInfoItem ; needed as you create them inside functions If Not FileExists(@ScriptDir & "\License.txt") Then $hLicence = InetGet("http://www.gnu.org/licenses/gpl-3.0.txt", @ScriptDir & "\License.txt") InetClose($hLicence) EndIf $hGUI = GUICreate("Interface", 500, 650, -1, -1) Menu() GUICtrlCreateTab(10, 110, 480, 400) GUISetFont(9, 300) Tab() $cBouton1 = GUICtrlCreateButton("Yes", 35, 599, 100, 25) $cBouton2 = GUICtrlCreateButton("Exit", 375, 599, 100, 25) GUISetState(@SW_SHOW) While 1 ; Just use the one loop to look for events Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $cBouton2 Exit Case $cBouton1 MsgBox(64 + 8192, 'Message', 'Vous avez cliqué sur le bouton OK') Case $cBouton3 ; Read the value $iNumber = Number(GUICtrlRead($cNumber)) ; Check it If $iNumber > 1000000 Then MsgBox(64, 'Error', 'The number cannot be high 1 000 000') ; Focus the input for easy editing GUICtrlSetState($cNumber, $GUI_FOCUS) EndIf EndSwitch WEnd Func Menu() $menu1 = GUICtrlCreateMenu("Option", -1, -1) $menu2 = GUICtrlCreateMenu("License", -1, -1) $idInfoItem = GUICtrlCreateMenuItem("Info", $menu1) EndFunc ;==>Menu Func Tab() GUICtrlCreateTabItem(" Log ") GUICtrlCreateTabItem(" Start Counter ") GUICtrlCreateLabel("Number :", 20, 153, 100, 20) $cNumber = GUICtrlCreateInput("Max 1 000 000", 85, 150, 150, 20) $cBouton3 = GUICtrlCreateButton("Save", 240, 147, 50) GUICtrlCreateTabItem("") ; You MUST close the tab creation sequence EndFunc ;==>TabPlease ask if you do not understand what I have done or why I have done it.M23 MirTexFR 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
MirTexFR Posted September 17, 2015 Author Posted September 17, 2015 Oh thanks you so much Melba ! now i can see what is the problem ! Thanks you !
Moderators Melba23 Posted September 17, 2015 Moderators Posted September 17, 2015 MirTexFR,Glad I could help.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
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