tomashen Posted December 4, 2011 Share Posted December 4, 2011 $search = 0 $search_complete = StringLen($update_command) Do $space_found = StringMid($update_command, $search, 1) If $space_found = "^" Then $found_middle = $space_found EndIf $search = $search +1 Until $search = $search_complete ;~ $trim_update = StringTrimRight($update_command, $until_space) GUICtrlSetData($update_command, StringMid(GUICtrlRead($COMMAND_INSERT), $found_middle, $search_complete)) im tring to get the split where... the sign is "^" so likei if i have TEXT^NEWTEXT the 'TEXT' will be replace to the new word after '^' sign which in this case is "NEWTEXT" if the sign '^' not found in the whole string... then show error im tring but i fail and fail... Proud of AutoIt Proud of MySelf :) Link to comment Share on other sites More sharing options...
BrewManNH Posted December 4, 2011 Share Posted December 4, 2011 (edited) _StringInStr perhaps, or perhaps _StringSplit? Edited December 4, 2011 by BrewManNH 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...
Moderators Melba23 Posted December 4, 2011 Moderators Share Posted December 4, 2011 tomashen,Look at StringSplit in the Help file. 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...
tomashen Posted December 4, 2011 Author Share Posted December 4, 2011 lol i didnt understand it before.. never worked for me before.. i noticed now that u need to put $array[x] haha thnx melba Proud of AutoIt Proud of MySelf :) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 4, 2011 Moderators Share Posted December 4, 2011 tomashen, You really do need to search and read the Help file now and again rather than immediately posting here. 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...
tomashen Posted December 4, 2011 Author Share Posted December 4, 2011 hehe ye sometimes im rly tired... after my hard gym workouts.. lot of weights u know how it goes Proud of AutoIt Proud of MySelf :) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 4, 2011 Moderators Share Posted December 4, 2011 tomashen,And while I am in the picky mood - please start writing correctly as I am getting very tired of all the "txt spk" you use. The Shift button is available on all modern keyboards - as are all the other characters you need to write normally. It is a joke - but a little bit serious too. 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...
Grapero Posted December 4, 2011 Share Posted December 4, 2011 do you know abot else ? Link to comment Share on other sites More sharing options...
tomashen Posted December 4, 2011 Author Share Posted December 4, 2011 ok melba but um im getting this error Array variable has incorrect number of subscripts or subscript dimension range exceeded.: GUICtrlSetData($Command_Called[1], $Command_Called[2]) GUICtrlSetData($Command_Called[1], ^ ERROR all i got is this $COMMAND_INSERT = GUICtrlCreateInput("Insert command...", 0, 280, 500, 20) $Command_Called = StringSplit(GUICtrlRead($COMMAND_INSERT), "=", 1) GUICtrlSetData($Command_Called[1], $Command_Called[2]) Proud of AutoIt Proud of MySelf :) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 4, 2011 Moderators Share Posted December 4, 2011 tomashen, And what does the Help file tell you will happen if the delimiter is not found? 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...
tomashen Posted December 4, 2011 Author Share Posted December 4, 2011 umm it says it sets error.. but i used the example tho o.O but anyway um i fixed it lol i put global $Command_Called[2] but now another problem trying to solve it while no answer but the problem is that $Command_Called = StringSplit(GUICtrlRead($COMMAND_INSERT), ',', 1) $left_cut = StringMid(guictrlread($COMMAND_INSERT), 2, $Command_Called[1] -1) GUICtrlSetData($Command_Called[1], $Command_Called[2]) $UPDATED = _GUICtrlEdit_InsertText($COMMAND_BOX, @crlf & "Command : " & $Command_Called[1] & " - Set to : " & $Command_Called[2]) GuiCtrlSetData() wont work in this case. It wouldnt set the data to the control that i type in.like as for example i type in $Label,testing and it should set the label text to "testing" but it doesnt Proud of AutoIt Proud of MySelf :) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 4, 2011 Moderators Share Posted December 4, 2011 tomashen,That is not the way to fix it. If there is no delimiter then you will have @error set and only have 2 elements in your array - that is why $Command_Called[2] (the third element) gives an error. You need to check the StringSplit return like this:$COMMAND_INSERT = GUICtrlCreateInput("Insert command...", 0, 280, 500, 20) $Command_Called = StringSplit(GUICtrlRead($COMMAND_INSERT), "=", 1) If @error ; What you do if there is no delimiter Else ; You know you have both elements so you can use them GUICtrlSetData($Command_Called[1], $Command_Called[2]) EndIfAs to the second problem, what on earth do you think $Command_Called[1] -1 gives you? StringSplit returns an array containing the split strings from the input. So why are you trying to use this string for a parameterin StringMid as if it was a numerical position in the string? That is what you get as a return from StringInStr. I am going to say this one more time - READ the Help file. If you continue to ask questions which a cursory glance at the Help file will solve, you will begin to find that very few of the experienced members here will even bother to read your posts let alone answer them. Am I making myself perfectly 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...
tomashen Posted December 4, 2011 Author Share Posted December 4, 2011 [i]$Command_Called[1] -1 i just put wrong figure there ^^ yes very clear but erm it wont set the new text for the label still.. :// sry if i rly annoy u Proud of AutoIt Proud of MySelf :) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 4, 2011 Moderators Share Posted December 4, 2011 tomashen,One last effort! $Command_Called[1] contains a string - as it is an element on the array returned by StringSplit which holds the parts of the string you pass to it.In this snippet:$left_cut = StringMid(guictrlread($COMMAND_INSERT), 2, $Command_Called[1] -1)StringMid is expecting a number - which you would get as a return from StringInStr. If you use a string you will not get a return from StringMid and so have nothing to enter as data when you try to use GUICtrlSetData. Got it? 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...
tomashen Posted December 4, 2011 Author Share Posted December 4, 2011 (edited) ok got it but then what if i use it like this $COMMAND_SELECT = GUICtrlCreateCombo("", 0, 280, 100, 20, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "$TEST") $Command_Called = StringSplit(GUICtrlRead($COMMAND_INSERT), "/", 1) If @error Then ; What you do if there is no delimiter _GUICtrlEdit_InsertText($COMMAND_BOX, @crlf & "error!") Else ; You know you have both elements so you can use them GUICtrlSetData(GUICtrlRead($COMMAND_SELECT), $Command_Called[2]) EndIf and i test this but still dont work...so how can i get to read the array and then do the thing in this ... damn its hard with this... almost all day sitting on this point finaly i got an idea like this and it works If GUICtrlRead($COMMAND_SELECT) = "$_NormalLogs" Then GUICtrlSetData($_NormalLogs, _NowTime() & $Command_Called[2]) now Edited December 4, 2011 by tomashen Proud of AutoIt Proud of MySelf :) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 4, 2011 Moderators Share Posted December 4, 2011 tomashen, ok got itGood! But what is $TEST in your script? I see it used as data within your combo, but is it a control in your GUI? If so then you need to write the code like this: expandcollapse popup#include <guiconstantsex.au3> #include <comboconstants.au3> #include <guiedit.au3> $hGUI = GUICreate("Test", 500, 500) $COMMAND_SELECT = GUICtrlCreateCombo("", 10, 10, 100, 20, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, "TEST") ; Note we have to leave off the leading $ $COMMAND_INSERT = GUICtrlCreateInput("Insert command...", 10, 200, 400, 20) $hButton = GUICtrlCreateButton("Go", 10, 300, 80, 30) ; Create a control to match the name in the combo $TEST = GUICtrlCreateLabel("", 200, 300, 150, 20) GUICtrlSetBkColor(-1, 0xFFCCCC) $COMMAND_BOX = GUICtrlCreateEdit("", 10, 400, 400, 90) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton $Command_Called = StringSplit(GUICtrlRead($COMMAND_INSERT), "/", 1) ; Check we got a suitable return from StringSplit AND that there is a selection in the combo If @error Or GUICtrlRead($COMMAND_SELECT) = "" Then ; What you do if there is no delimiter or the combo is empty _GUICtrlEdit_InsertText($COMMAND_BOX, @crlf & "error!") Else ; You know you have both elements so you can use them - but you have to convert the text in the combo to the ControlID using Eval GUICtrlSetData(Eval(GUICtrlRead($COMMAND_SELECT)), $Command_Called[2]) EndIf EndSwitch WEnd Is that what you are trying to do? M23 P.S. I really am beginning to hate this forum editor with a passion - it is a real crock of . Please can we go back to the old one - at least it did not add random text to the post when you edit! 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...
tomashen Posted December 4, 2011 Author Share Posted December 4, 2011 heh yeah that is very same thingi wanted to do well i will keep your example for later if i get any problems with the one i just got working and thnx for all the help ! btw is it posible for me to add u in msn or yahoo or skype ? those are faster than forums and u know it Proud of AutoIt Proud of MySelf :) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 4, 2011 Moderators Share Posted December 4, 2011 tomashen,is it posible for me to add u in msn or yahoo or skypeSo I become your personal code slave? Not a chance! This forum exists so that everyone can read and learn - that is why PMs asking for help are against the Forum Rules. You post your questions here and I will help if I can. Besides, a slightly slower data input rate will probably help my responses sink into your exercise over-heated brain more easily! M23P.S. Thanks for the effort to use more proper English words in the last few posts - I appreciate it! 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...
tomashen Posted December 4, 2011 Author Share Posted December 4, 2011 haha D: slave lol no but ye i understand why and no problem for the english im lithuanian tho... so dont expect every word to be perfect! Proud of AutoIt Proud of MySelf :) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 4, 2011 Moderators Share Posted December 4, 2011 tomashen,im lithuanian tho... so dont expect every word to be perfect!No problem! I used to visit your country quite often - mainly Kaunas and Siauliai. Good food and nice beer as I remember. 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...
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