GordonFreeman Posted March 28, 2014 Share Posted March 28, 2014 (edited) have any way to match this in one line, without loops. I need match: If 16-32-48-64-80-96 Then msgbox(0,"","Matched") Endif but i need put the 16 in a var to change how i want Thanks for support! Edited March 28, 2014 by GordonFreeman Frabjous Installation Link to comment Share on other sites More sharing options...
BrewManNH Posted March 28, 2014 Share Posted March 28, 2014 I'm not sure if you realize that what you're asking is impossible to answer as you didn't even begin to explain what it is you need to do. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
GordonFreeman Posted March 28, 2014 Author Share Posted March 28, 2014 (edited) I'm not sure if you realize that what you're asking is impossible to answer as you didn't even begin to explain what it is you need to do. Haha, sorry. $var = 16 If $i = ($var * "All possibilities") Then ;CODE EndIf ;It will run code if $i = 16 or 32 or 48 or 64 or ..... Edited March 28, 2014 by GordonFreeman Frabjous Installation Link to comment Share on other sites More sharing options...
BrewManNH Posted March 28, 2014 Share Posted March 28, 2014 Not one line, but it can easily done this way. For $I = 16 to 96 If Mod($i, 16) Then ConsoleWrite("$i (" & $i & ") is NOT a multiple of 16" & @CRLF) Else ConsoleWrite("$i (" & $i & ") is a multiple of 16" & @CRLF) EndIf Next If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
iamtheky Posted March 28, 2014 Share Posted March 28, 2014 $test = "32" If $test = "16" or $test = "32" or $test = "48" or $test = "64" or $test = "80" or $test = "96" Then msgbox(0, '' , "Match") ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
jdelaney Posted March 28, 2014 Share Posted March 28, 2014 (edited) StringInStr...or better explain, please $iMatch = "16-32-48-64-80-96" $iVar = 16 If StringInStr($iMatch,$iVar) Then ConsoleWrite($iVar & " found in " & $iMatch & @CRLF) EndIf $iVar = 15 If Not StringInStr($iMatch,$iVar) Then ConsoleWrite($iVar & " not found in " & $iMatch & @CRLF) EndIf Edited March 28, 2014 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
GordonFreeman Posted March 28, 2014 Author Share Posted March 28, 2014 (edited) Thanks for all. Im trying create a "sustentable" function to create many aligned buttons. Local $sMultiple = "" For $i = 1 to $iAmount $sMultiple &= ($iMaxByLine * $i) & "-" Next Thanks @jdelaney, solution is nice but i think cause problems in match why 32 will match before 320 Or 328. Thanks @boththose, i also thinked in it but is not a flexibily solution Thanks @BrewManNH, i trying solve this <snip> math and implement your solution Edited March 28, 2014 by Melba23 Profane language removed Frabjous Installation Link to comment Share on other sites More sharing options...
iamtheky Posted March 28, 2014 Share Posted March 28, 2014 (edited) what needs to be 'flexibily' about it? Are there more rules besides I need match: If 16-32-48-64-80-96 Then msgbox(0,"","Matched") Endif Edited March 28, 2014 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Gianni Posted March 28, 2014 Share Posted March 28, 2014 another: #include <array.au3> $iMatch = "16-32-48-64-80-96" $iVar = 16 $Values = StringSplit($iMatch, "-", 2) If - 1 <> _ArraySearch($Values, $iVar) Then MsgBox(0, "", "Matched") Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 28, 2014 Moderators Share Posted March 28, 2014 GordonFreeman,I have edited your post above - there is absolutely no valid reason for using such language on a public forum. Please do not use such terms again. 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...
GordonFreeman Posted March 28, 2014 Author Share Posted March 28, 2014 (edited) Thanks for all who help me. when i finish the func i will be putting here GordonFreeman, I have edited your post above - there is absolutely no valid reason for using such language on a public forum. Please do not use such terms again. M23 Sorry by the language, escaped without i realize Fixed! Done! Solved! Thanks to all by atention and support! Func _GuiCtrlCreateButtons($iAmount,$iMaxByLine,$iLeft,$iTop,$iWidht,$iHeight) Local $aButtons[$iAmount] $iStartLeft = $iLeft $iStartTop = $iLeft For $i = 1 to $iAmount If $i <> 1 Then $iLeft += $iWidht If Mod($i-1,$iMaxByLine) Then Else $iLeft = $iStartLeft $iTop += $iHeight EndIf EndIf $aButtons[$i-1] = GUICtrlCreateButton($i,$iLeft,$iTop,$iWidht,$iHeight) Next Return $aButtons EndFunc;==>_GuiCtrlCreateButtons Edited March 28, 2014 by GordonFreeman Frabjous Installation Link to comment Share on other sites More sharing options...
TechCoder Posted March 29, 2014 Share Posted March 29, 2014 nice little function - I'm adding it to my 'snipit' file - could come in handy...... Link to comment Share on other sites More sharing options...
GordonFreeman Posted March 29, 2014 Author Share Posted March 29, 2014 (edited) nice little function - I'm adding it to my 'snipit' file - could come in handy...... Thanks @TechCoder, i added to example forum with the possibility to add horizontal and vertical distances between buttons and fixed some things '?do=embed' frameborder='0' data-embedContent>> Edited March 29, 2014 by GordonFreeman Frabjous Installation Link to comment Share on other sites More sharing options...
Rogue5099 Posted March 29, 2014 Share Posted March 29, 2014 I just create my aligned buttons through For loop. I added variables to be able to change space and amount of buttons. Below is just an example for vertical but could easily be changed to horizonal #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 200, 200) Global $Button[1], $spacer = 16, $buttons = 10 For $i = 0 to $buttons $Button[$i] = GUICtrlCreateButton("Button " & $i, 10, $i*$spacer, -1, 15) ReDim $Button[UBound($Button)+1] Next Global Const $ctrl_offset = $Button[1] - $Button[0] GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Switch $msg Case $Button[0] To $Button[$buttons] $x = Abs(($msg - $Button[0]) / $ctrl_offset) MsgBox(0, "Test", "Button " & $x & " was clicked") EndSwitch Until $msg = $GUI_EVENT_CLOSE GUIDelete($hGUI) Exit My projects: Inventory / Mp3 Inventory, Computer Stats 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