Jump to content
  1. Draygoes

    Draygoes

  2. czardas

    czardas

  3. Zedna

    Zedna

  4. mesale0077

    mesale0077

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By argumentum
      #AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include "GuiChildTabUDF.au3" Global $__iFlashWindowEx = 0 ; ..see _WM_SETCURSOR() tabGUI_OPTs("RandomColor", 1) ; ..to add coloring to the GUIs, for debug. ( Default is 0 ) tabGUI_OPTs("SetCtrlDbgCreateWidth", 1) ; tells the UDF to leave some space for the debug buttons ( see tabGUI_CtrlDbgCreate() ). ( Default is 0 ) tabGUI_Example() Func tabGUI_Example() ; tabGUI_Create() has the same parameters as GUICreate() ; ..just skip the styles, as those are handled by the function. tabGUI_Create("Parent/Children Example") ; the first GUI will have to be the parent tabGUI_CtrlDbgCreate("Show GUI array") ; All these are tabGUI_CtrlDbgCreate("Show OPT array") ; for debug and tabGUI_CtrlDbgCreate("Swap GUIs/LABELs") ; are not needed tabGUI_CtrlDbgCreate("Can Drag child") ; to use the UDF tabGUI_CtrlDbgCreate("Self CPU usage") ; These are called after a GUI is present. ; search for "SetResizing:" to understand the TITLE modification ( used for tabGUI_DockStr2Int() ) tabGUI_Create("SetResizing:LBWH;1", 400, 400, 20, 20) ; all other GUI will be child addSomeControls() tabGUI_Create("2", 400, 400, 60, 60) addSomeControls() ; multiple child in child example ; ..skip the width and heigth, to have the function calculate the values. tabGUI_Create("3", Default, Default, 200, 230) tabGUI_Create("4", Default, Default, 20, 20, Default, Default, $__a_tabGUI[@extended][$eGui_HWindowSelf]) tabGUI_Create("5", Default, Default, 20, 20, Default, Default, $__a_tabGUI[@extended][$eGui_HWindowSelf]) Local $hGUI = tabGUI_Create("6", Default, Default, 20, 20, Default, Default, $__a_tabGUI[@extended][$eGui_HWindowSelf]) ; ..the function returns the windows handle, just like GUICreate() would. ConsoleWrite('$hGUI = ' & $hGUI & ' - @extended: ' & @extended & ' ( @extended returns the GUI index in the array )' & @CRLF) addSomeControls() GUISetState(@SW_SHOW, $__a_tabGUI[1][$eGui_HWindowSelf]) ; Time to show the parent GUI GUISwitch($__a_tabGUI[1][$eGui_HWindowSelf]) ; and get focus. GUIRegisterMsg($WM_SETCURSOR, "_WM_SETCURSOR") ; for _WinAPI_FlashWindowEx() While 1 Sleep(1000000) ; ..no need to sleep() a minimum in this loop, as is just there to not close the script in this example. WEnd EndFunc ;==>tabGUI_Example Func addSomeControls() ; ..some controls to add to the example GUICtrlCreateButton("bttn 1", 10, 10, 55, 25) GUICtrlSetOnEvent(-1, "addSomeEvents") GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateButton("bttn 2", 10, 35, 55, 25) GUICtrlSetOnEvent(-1, "addSomeEvents") GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateTab(10, 70, 380, 320) GUICtrlSetOnEvent(-1, "addSomeEvents") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKBOTTOM) GUICtrlCreateTabItem("TabSheet1") GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("") EndFunc ;==>addSomeControls Func addSomeEvents() ;~ $__iFlashWindowEx = TimerInit() MsgBox(0, "your ""OnEvent""", "@GUI_CtrlId = " & @GUI_CtrlId, 1, $__a_tabGUI[1][$eGui_HWindowSelf]) ;~ $__iFlashWindowEx = 0 EndFunc ;==>addSomeEvents Func _WM_SETCURSOR($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; FYI: this is meant to flash the Parent GUI of a MsgBox(), ; so the MsgBox() needs a Parent GUI declaration. ; If the 0xFFFE guess don't work, or just wanna save CPU cycles, then you'll need a trigger. ; Maybe something like this below. ;~ If $__iFlashWindowEx = 0 Then Return $GUI_RUNDEFMSG ;~ If TimerDiff($__iFlashWindowEx) < 100 Then Return $GUI_RUNDEFMSG Local Static $hTimerTooSoon = TimerInit(), $hTimerWaitAMoment = TimerInit() If _WinAPI_LoWord($lParam) <> 0xFFFE Then $hTimerWaitAMoment = TimerInit() Return $GUI_RUNDEFMSG EndIf If TimerDiff($hTimerWaitAMoment) < 200 Then Return $GUI_RUNDEFMSG If TimerDiff($hTimerTooSoon) < 500 Then Return $GUI_RUNDEFMSG Local $mouse = _WinAPI_HiWord($lParam) ; https://docs.microsoft.com/en-us/windows/win32/menurc/wm-setcursor ; https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-mousemove Local Const $MK_LBUTTON = 0x0001 Local Const $MK_RBUTTON = 0x0002 Local Const $MK_MBUTTON = 0x0010 Local Const $MK_XBUTTON1 = 0x0020 Local Const $MK_XBUTTON2 = 0x0040 ;~ If BitAND($mouse, $MK_LBUTTON) Then ConsoleWrite('- clicked MK_LBUTTON' & @CRLF) ;~ If BitAND($mouse, $MK_RBUTTON) Then ConsoleWrite('- clicked MK_RBUTTON' & @CRLF) ;~ If BitAND($mouse, $MK_MBUTTON) Then ConsoleWrite('- clicked MK_MBUTTON' & @CRLF) ;~ If BitAND($mouse, $MK_XBUTTON1) Then ConsoleWrite('- clicked MK_XBUTTON1' & @CRLF) ;~ If BitAND($mouse, $MK_XBUTTON2) Then ConsoleWrite('- clicked MK_XBUTTON2' & @CRLF) If BitAND($mouse, $MK_LBUTTON) Or BitAND($mouse, $MK_RBUTTON) Or _ BitAND($mouse, $MK_MBUTTON) Or BitAND($mouse, $MK_XBUTTON1) Or _ BitAND($mouse, $MK_XBUTTON2) Then $hTimerTooSoon = TimerInit() _WinAPI_MessageBeep(4) ; mimic what windows does by default when _WinAPI_FlashWindowEx($hWnd, 3, 6, 50) ; clicking the title. _WinAPI_FlashWindowEx(WinGetHandle("[CLASS:#32770;]"), 3, 6, 50) ; ..this works on the MsgBox() because is the "on top" in the Z order ; as the code just created it ( and it *is* on top ). EndIf Return $GUI_RUNDEFMSG EndFunc ;==>_WM_SETCURSOR This is a post of example(s).
      The code started due to the observation that controls don't look the same when in a tab control.
      Digging thru the forum I found chunks of code so I smash them together to solve my issues.
      The "UDF" is more of an useful include than an UDF, but it shows how to use Child GUIs instead of a TAB control.
      In each child GUI you can have a GUICtrlCreateTab(). ( something that I did not realize until I browse the Wiki )
      Working on the code I found myself having to GUIRegisterMsg(). Then why not register more and do more.
      Took me about a month to discover how to put it together. Then I'm like "this would make a good example".
      So try it out, use what you need ( or as is ). Hopefully it'll save you the learning curve. The code is in the downloads section.
      ( I'm a copy and paste kind of coder, so racking my brain is not my forte. But at times, is what it takes to get working code )
      PS: if you find a better way to do something or a gross misinterpretation in the code, do share. ( so I can copy and paste )
    • By Colduction
      Hello AutoIt Programmers, i was working on my project and i reffered to @KBLayout, @MUILang & @OSLang then i saw that code example of this macro is not too complete, i decided to share my customized _GetLanguage() for you:
      #include <MsgBoxConstants.au3> MsgBox($MB_SYSTEMMODAL, "", "The language of the OS is: " & _GetLanguage() & " (" & LCIDToLocaleName("0x" & @OSLang) & ")") ; Retrieve the language of the operating system. Func _GetLanguage() Switch @OSLang Case "0004" Return "Chinese - Simplified" Case "0401" Return "Arabic - Saudi Arabia" Case "0402" Return "Bulgarian - Bulgaria" Case "0403" Return "Catalan - Spain" Case "0404" Return "Chinese (Traditional) - Taiwan" Case "0405" Return "Czech - Czech Republic" Case "0406" Return "Danish - Denmark" Case "0407" Return "German - Germany" Case "0408" Return "Greek - Greece" Case "0409" Return "English - United States" Case "040A" Return "Spanish - Spain" Case "040B" Return "Finnish - Finland" Case "040C" Return "French - France" Case "040D" Return "Hebrew - Israel" Case "040E" Return "Hungarian - Hungary" Case "040F" Return "Icelandic - Iceland" Case "0410" Return "Italian - Italy" Case "0411" Return "Japanese - Japan" Case "0412" Return "Korean - Korea" Case "0413" Return "Dutch - Netherlands" Case "0414" Return "Norwegian (Bokmål) - Norway" Case "0415" Return "Polish - Poland" Case "0416" Return "Portuguese - Brazil" Case "0417" Return "Romansh - Switzerland" Case "0418" Return "Romanian - Romania" Case "0419" Return "Russian - Russia" Case "041A" Return "Croatian - Croatia" Case "041B" Return "Slovak - Slovakia" Case "041C" Return "Albanian - Albania" Case "041D" Return "Swedish - Sweden" Case "041E" Return "Thai - Thailand" Case "041F" Return "Turkish - Turkey" Case "0420" Return "Urdu - Pakistan" Case "0421" Return "Indonesian - Indonesia" Case "0422" Return "Ukrainian - Ukraine" Case "0423" Return "Belarusian - Belarus" Case "0424" Return "Slovenian - Slovenia" Case "0425" Return "Estonian - Estonia" Case "0426" Return "Latvian - Latvia" Case "0427" Return "Lithuanian - Lithuanian" Case "0428" Return "Tajik (Cyrillic) - Tajikistan" Case "0429" Return "Persian - Iran" Case "042A" Return "Vietnamese - Vietnam" Case "042B" Return "Armenian - Armenia" Case "042C" Return "Azeri (Latin) - Azerbaijan" Case "042D" Return "Basque - Basque" Case "042E" Return "Upper Sorbian - Germany" Case "042F" Return "Macedonian - Macedonia" Case "0432" Return "Setswana / Tswana - South Africa" Case "0434" Return "isiXhosa - South Africa" Case "0435" Return "isiZulu - South Africa" Case "0436" Return "Afrikaans - South Africa" Case "0437" Return "Georgian - Georgia" Case "0438" Return "Faroese - Faroe Islands" Case "0439" Return "Hindi - India" Case "043A" Return "Maltese - Malta" Case "043B" Return "Sami (Northern) - Norway" Case "043e" Return "Malay - Malaysia" Case "043F" Return "Kazakh - Kazakhstan" Case "0440" Return "Kyrgyz - Kyrgyzstan" Case "0441" Return "Swahili - Kenya" Case "0442" Return "Turkmen - Turkmenistan" Case "0443" Return "Uzbek (Latin) - Uzbekistan" Case "0444" Return "Tatar - Russia" Case "0445" Return "Bangla - Bangladesh" Case "0446" Return "Punjabi - India" Case "0447" Return "Gujarati - India" Case "0448" Return "Oriya - India" Case "0449" Return "Tamil - India" Case "044A" Return "Telugu - India" Case "044B" Return "Kannada - India" Case "044C" Return "Malayalam - India" Case "044D" Return "Assamese - India" Case "044E" Return "Marathi - India" Case "044F" Return "Sanskrit - India" Case "0450" Return "Mongolian (Cyrillic) - Mongolia" Case "0451" Return "Tibetan - China" Case "0452" Return "Welsh - United Kingdom" Case "0453" Return "Khmer - Cambodia" Case "0454" Return "Lao - Lao PDR" Case "0456" Return "Galician - Spain" Case "0457" Return "Konkani - India" Case "0459" Return "(reserved) - (reserved)" Case "045A" Return "Syriac - Syria" Case "045B" Return "Sinhala - Sri Lanka" Case "045C" Return "Cherokee - Cherokee" Case "045D" Return "Inuktitut (Canadian_Syllabics) - Canada" Case "045E" Return "Amharic - Ethiopia" Case "0461" Return "Nepali - Nepal" Case "0462" Return "Frisian - Netherlands" Case "0463" Return "Pashto - Afghanistan" Case "0464" Return "Filipino - Philippines" Case "0465" Return "Divehi - Maldives" Case "0468" Return "Hausa - Nigeria" Case "046A" Return "Yoruba - Nigeria" Case "046B" Return "Quechua - Bolivia" Case "046C" Return "Sesotho sa Leboa - South Africa" Case "046D" Return "Bashkir - Russia" Case "046E" Return "Luxembourgish - Luxembourg" Case "046F" Return "Greenlandic - Greenland" Case "0470" Return "Igbo - Nigeria" Case "0473" Return "Tigrinya - Ethiopia" Case "0475" Return "Hawiian - United States" Case "0478" Return "Yi - China" Case "047A" Return "Mapudungun - Chile" Case "047C" Return "Mohawk - Canada" Case "047E" Return "Breton - France" Case "0480" Return "Uyghur - China" Case "0481" Return "Maori - New Zealand" Case "0482" Return "Occitan - France" Case "0483" Return "Corsican - France" Case "0484" Return "Alsatian - France" Case "0485" Return "Sakha - Russia" Case "0486" Return "K'iche - Guatemala" Case "0487" Return "Kinyarwanda - Rwanda" Case "0488" Return "Wolof - Senegal" Case "048C" Return "Dari - Afghanistan" Case "0491" Return "Scottish Gaelic - United Kingdom" Case "0492" Return "Central Kurdish - Iraq" Case "0801" Return "Arabic - Iraq" Case "0803" Return "Valencian - Valencia" Case "0804" Return "Chinese (Simplified) - China" Case "0807" Return "German - Switzerland" Case "0809" Return "English - United Kingdom" Case "080A" Return "Spanish - Mexico" Case "080C" Return "French - Belgium" Case "0810" Return "Italian - Switzerland" Case "0813" Return "Dutch - Belgium" Case "0814" Return "Norwegian (Nynorsk) - Norway" Case "0816" Return "Portuguese - Portugal" Case "081A" Return "Serbian (Latin) - Serbia and Montenegro" Case "081D" Return "Swedish - Finland" Case "0820" Return "Urdu - (reserved)" Case "082C" Return "Azeri (Cyrillic) - Azerbaijan" Case "082E" Return "Lower Sorbian - Germany" Case "0832" Return "Setswana / Tswana - Botswana" Case "083B" Return "Sami (Northern) - Sweden" Case "083C" Return "Irish - Ireland" Case "083E" Return "Malay - Brunei Darassalam" Case "0843" Return "Uzbek (Cyrillic) - Uzbekistan" Case "0845" Return "Bangla - Bangladesh" Case "0846" Return "Punjabi - Pakistan" Case "0849" Return "Tamil - Sri Lanka" Case "0850" Return "Mongolian (Mong) - Mongolia" Case "0859" Return "Sindhi - Pakistan" Case "085D" Return "Inuktitut (Latin) - Canada" Case "085F" Return "Tamazight (Latin) - Algeria" Case "0867" Return "Pular - Senegal" Case "086B" Return "Quechua - Ecuador" Case "0873" Return "(reserved) - (reserved)" Case "0873" Return "Tigrinya - Eritrea" Case "0C01" Return "Arabic - Egypt" Case "0C04" Return "Chinese - Hong Kong SAR" Case "0C07" Return "German - Austria" Case "0C09" Return "English - Australia" Case "0C0A" Return "Spanish - Spain" Case "0C0C" Return "French - Canada" Case "0C1A" Return "Serbian (Cyrillic) - Serbia and Montenegro" Case "0C3B" Return "Sami (Northern) - Finland" Case "0C6B" Return "Quechua - Peru" Case "1001" Return "Arabic - Libya" Case "1004" Return "Chinese - Singapore" Case "1007" Return "German - Luxembourg" Case "1009" Return "English - Canada" Case "100A" Return "Spanish - Guatemala" Case "100C" Return "French - Switzerland" Case "101A" Return "Croatian (Latin) - Bosnia and Herzegovina" Case "103B" Return "Sami (Lule) - Norway" Case "105F" Return "Central Atlas Tamazight (Tifinagh) - Morocco" Case "1401" Return "Arabic - Algeria" Case "1404" Return "Chinese - Macao SAR" Case "1407" Return "German - Liechtenstein" Case "1409" Return "English - New Zealand" Case "140A" Return "Spanish - Costa Rica" Case "140C" Return "French - Luxembourg" Case "141A" Return "Bosnian (Latin) - Bosnia and Herzegovina" Case "143B" Return "Sami (Lule) - Sweden" Case "1801" Return "Arabic - Morocco" Case "1809" Return "English - Ireland" Case "180A" Return "Spanish - Panama" Case "180C" Return "French - Monaco" Case "181A" Return "Serbian (Latin) - Bosnia and Herzegovina" Case "183B" Return "Sami (Southern) - Norway" Case "1C01" Return "Arabic - Tunisia" Case "1c09" Return "English - South Africa" Case "1C0A" Return "Spanish - Dominican Republic" Case "1C1A" Return "Serbian (Cyrillic) - Bosnia and Herzegovina" Case "1C3B" Return "Sami (Southern) - Sweden" Case "2001" Return "Arabic - Oman" Case "2009" Return "English - Jamaica" Case "200A" Return "Spanish - Venezuela" Case "201A" Return "Bosnian (Cyrillic) - Bosnia and Herzegovina" Case "203B" Return "Sami (Skolt) - Finland" Case "2401" Return "Arabic - Yemen" Case "2409" Return "English - Caribbean" Case "240A" Return "Spanish - Colombia" Case "241A" Return "Serbian (Latin) - Serbia" Case "243B" Return "Sami (Inari) - Finland" Case "2801" Return "Arabic - Syria" Case "2809" Return "English - Belize" Case "280A" Return "Spanish - Peru" Case "281A" Return "Serbian (Cyrillic) - Serbia" Case "2C01" Return "Arabic - Jordan" Case "2C09" Return "English - Trinidad and Tobago" Case "2C0A" Return "Spanish - Argentina" Case "2C1A" Return "Serbian (Latin) - Montenegro" Case "3001" Return "Arabic - Lebanon" Case "3009" Return "English - Zimbabwe" Case "300A" Return "Spanish - Ecuador" Case "301A" Return "Serbian (Cyrillic) - Montenegro" Case "3401" Return "Arabic - Kuwait" Case "3409" Return "English - Philippines" Case "340A" Return "Spanish - Chile" Case "3801" Return "Arabic - U.A.E." Case "380A" Return "Spanish - Uruguay" Case "3C01" Return "Arabic - Bahrain" Case "3C0A" Return "Spanish - Paraguay" Case "4001" Return "Arabic - Qatar" Case "4009" Return "English - India" Case "400A" Return "Spanish - Bolivia" Case "4409" Return "English - Malaysia" Case "440A" Return "Spanish - El Salvador" Case "4809" Return "English - Singapore" Case "480A" Return "Spanish - Honduras" Case "4C0A" Return "Spanish - Nicaragua" Case "500A" Return "Spanish - Puerto Rico" Case "540A" Return "Spanish - United States" Case "7C04" Return "Chinese - Traditional" Case Else Return "Other (can't determine with @OSLang directly)" EndSwitch EndFunc ;==>_GetLanguage Func LCIDToLocaleName($iLCID) Local $aRet = DllCall("kernel32.dll", "int", "LCIDToLocaleName", "int", $iLCID, "wstr", "", "int", 85, "dword", 0) Return $aRet[2] EndFunc ;==>LCIDToLocaleName _GetLanguage.au3
      Source: AutoIt Help File (ScITE Editor (F1))

      I hope you enjoy this tiny code.
    • By matwachich
      DEPRECATED: see this new UDF
       
    • By v0id
      I am starting out using AutoIt. Here is a simple form with username and password. I want to check if information entered is valid once user clicks a button.
      My problem now is that it only validates once. E.g.: if I type 5 character username, it will complain it is not 7 character (good). But once I correct that mistake and press the button again it will still say the same thing.
      Do I need to have a loop?
       
      #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> Opt("GUIOnEventMode", 1) $main = GUICreate("Test Tool", 600, 600) $hyourlabel = GUICtrlCreateLabel("YOUR CREDENTIALS", 30, 10, 256) GUICtrlSetFont($hyourlabel, Default, 600) Local $adminfrejalabel = GUICtrlCreateLabel("Username:", 8, 38, 64, 17) Global $adminfrejaid = GUICtrlCreateInput("", 80, 38, 110, 17) Local $adminpasswordlabel = GUICtrlCreateLabel("Password:", 8, 62, 64, 17) Global $adminpassword = GUICtrlCreateInput("", 80, 62, 110, 17, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL)) $userButton_Check = GUICtrlCreateButton("VALIDATE", 32, 480, 85, 25) GUICtrlSetOnEvent($userButton_Check, "startvalidation") GUISetOnEvent($GUI_EVENT_CLOSE, "ExitGUI") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func startvalidation() ;CHECK VALIDATIONS $adminfrejaid = GUICtrlRead($adminfrejaid) $adminpassword = GUICtrlRead($adminpassword) If StringLen($adminfrejaid) <> '7' Then MsgBox($MB_SYSTEMMODAL, "User ID", "Please enter exactly 7 characters.") ;Exit EndIf If StringLen($adminpassword) < '5' Then MsgBox($MB_SYSTEMMODAL, "Your Password", "Please enter a valid password.") ;Exit EndIf EndFunc Func ExitGui () Exit ; Exit the program EndFunc  
    • By Blueman
      Hey Guys,
      Maybe you can help me with something small.
      It is not terrible but it slows down my script and after a while even crash the script.

      First i explain what i have;
      I have a GUI with a lot of GUICtrlCreateInput controls, lets say 600 pieces.
      All the controls are hidden when the GUI is displayed, i have 3 buttons attached to 200 pieces each.
      When i press button-1 the first 200 controls are showed,
      When i press button-2 the first 200 controls are hidden and the next 200 controls are showed,
      etc, etc.
      This is working perfectly but after a while the GUI is getting slower and slower.
      After a while the controls aren't responding anymore and the script crashes.
      When i compile the script to 64-Bits version the speed is a lot better but you can still see the script slowing down each time i use the buttons.
      I think there has to be a buffer somewhere that is filling each time i show and hide the controls, but how can i clear that buffer without restarting the script?
      Deleting and re-creating the controls didn't help, deleting the entire gui (and controls) and re-creating it didn't help also.
      The only thing that is working is restarting the script.

      Thanks guys!

      PS: If you need a working example i can add it to this topic, just let me know. It is not rocket science, i just create the controls and show/hide them with a while loop and 3 buttons.
       
×
×
  • Create New...