
barryb
Active Members-
Posts
21 -
Joined
-
Last visited
barryb's Achievements

Seeker (1/7)
0
Reputation
-
Hi ShornW, Turns out I was a complete nooblet and was over thinking this! I looked at what someone else had done for a similar issue and it was a lot easier than I thought I just needed to use array to string However this may or may not work for me so I will look at the code you created as well, as you can tell my test code is cut from the help lol Func Example() Local $msg, $sDriveList Local $var = DriveGetDrive("REMOVABLE") $sDriveList = _ArrayToString($var, "|", 1) ; drives string GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered GUICtrlCreateCombo("Select Drive", 10, 10) ; create first item GUICtrlSetData(-1, $sDriveList, "") ; add other item snd set a new default GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example
-
barryb reacted to a post in a topic: Populate Combo box from array
-
Thanks Shornw I will give that a try when I get a chance! Cheers, Barry
-
Hi All, been away from AutoIt for a while and I'm stuck trying to populate my dropdown combo box with data gathered in to an Array The code below parses all my removable media, but I need to be able to use this to populate my combo box but couldn't find any examples in the help, I'm sure this is something really simple. but I can't get my head around how to do this, I'm sure it will be some type of For loop to add in each found drive in to the combo Box but I can't figure it out. A friendly push in the right direction would be great. Thanks, Barry Local $var = DriveGetDrive("REMOVABLE") For $usb = 1 to $var[0] MsgBox (0,"Drive", $var[$usb]) next
-
Hi Guys, thanks for your input and help, after some hiccups I got it working and now have it out for testing Cheers, Barry
-
Thanks guys! I'm in and out of Autoit so am just a dabbler What I will do is take your excelent example and advice then see if I can then fit it in to my script, if I'm not back in a week send out the search party Cheers, Barry
-
Hi All, I have a simple script that reads in a text file then searches for 3 strings and replaces them if found. All works OK but I have found out another tool that is being used is inserting a space in the strings I'm searching for I was just going to duplicate what I already have and add the space string but wondered if there was a more eloquent and easily implemented method someone could suggest? $sWinXP = "<OS VALUE=""WinXP""/>" <--- proper string $sWinXPb = "<OS VALUE=""WinXP"" />" <---- string now with added PITA space <snip> _FileReadToArray($sOSDpath, $aArray) _FileWriteLog($file, $sOSDpath & ' Preparing to migrate ') $iIndex = _ArraySearch($aArray, $sWinXP, 0, 0, 0, 1) If @error Then _FileWriteLog($file, $sWinXP & ' was not found in the array, skipping to next OSD file') Else _FileWriteLog($file, $sWinXP & ' was found in the array at position '& $iIndex & '.') $i7Index = _ArraySearch($aArray, $sWin7s, 0, 0, 0, 1) If @error Then _FileWriteLog($file, $sWin7s & ' was not found in the array, lets add it') ; Insert the string with our new value below the searched for string $iNew7 = $iIndex+1 EndIf
-
Splitting first name surname with spaces [SOLVED]
barryb replied to barryb's topic in AutoIt General Help and Support
Arrrrghh why didn't I think about regular expression!!! This has been bugging me since Friday lol. Thanks Smoke_N virtual pint heading your way -
Hi Guys, I am looking at splitting first name / surname so I can do AD lookups, now problem is the input file is not csv but a flat firstname 'space' surname, again not much of a problem BUT some users have double barrel surnames e.g. lin san san. Is there anyway for autoit to split on first space so I only have a 2 element array? Or do I split on the space then count the number of elements in the array to determine if i have a double barrel scenario? Any pointers would be appreciated. Thanks, Barry
-
Searching array for multiple strings[solved]
barryb replied to barryb's topic in AutoIt General Help and Support
Hi, Think I solved my issue, turned array back into a string "," delimited then split back into an array again $aArray = _StringBetween($sText, $start, $end) $sArray = _ArrayToString($aArray, ",") $aArrayFound = StringSplit ($sArray,",") -
Searching array for multiple strings[solved]
barryb replied to barryb's topic in AutoIt General Help and Support
Hi, with Rudis help my search works almost perfectly except when the code finds only one instance of the item being searched for. The array created (in the code below) by $aArray = _StringBetween($sText, $start, $end) has string in element [0] e.g. [0] [DEF]. Apart from that it lists all the strings found between the the $start and $end variables. E.g. the text file can have 1 or more lines with ABCDEFGHI in it along with other text. If the text file has only one instance I receive an error as the code provided by Rudi assumes element [0] will contain a count value, which it doesn't in this case, as it has the string found! Here is my attempt at inserting an element [0] but it only works when there is more than one of the strings in the document and even then it is missing a found string. Any ideas? #include <array.au3> #include <String.au3> Dim $start, $end, $aArray, $iStart $start = 'ABC'; where to start search from $end = 'GHI'; where to end the search at $sTextpath = "path to text filee.txt" $sText = FileRead($sTextpath,FileGetSize($sTextpath)) Local $aArray[5] = [0] Local $i $aArray = _StringBetween($sText, $start, $end) $count = UBound($aArray) For $i = 1 To $count ; Check that the array is big enough If UBound($aArray) = $i Then ; Resize the array ReDim $aArray[$aArray[0] + 5] EndIf ;Update Array $aArray[0] = $i Next ;Adjust the array size. This time it is probably downward to the size of ;$aArray[0] + 1 (remember the first item is $aArray[0] ReDim $aArray[$aArray[0]+1] ;Now dump the result _ArrayDisplay($aArray, 'Returned results') -
Searching array for multiple strings[solved]
barryb replied to barryb's topic in AutoIt General Help and Support
Hi Rudi, Thanks for replying, that looks ideal, I will give this a try when I get a spare moment! Regards, Barry -
Hi, Is it possible to use _ArraySearch or some other feature to search for multiple keywords in my arrays? Or do I need to perform say a loop with _ArraySearch for each variable I'm searching for? e.g. the array has 10 entries with different words but I only want say word 2, 5 and 9. This is just an example and they array key and words may change, the words I'm searching for however are constant. Any pointers would be appreciated to get me going in the right direction Thanks, Barry
-
String replace question [SOLVED]
barryb replied to barryb's topic in AutoIt General Help and Support
Hi, Think I worked it out myself, I created another search array to find and replace against the tail end of .com/ and / and that appears to have worked $bArray = _StringBetween($sText, $start2, $end2) will need to do far more testing though!! Cheers, Barry -
Hi, This is probably going to be easy to answer, but I can't figure it out. My script quite happily uses _StringBetween to do a search and replace, $aArray = _StringBetween($sText, $start, $end) but I have an issue where I need to extend what is being replaced in the search and replace. My current search and replace parameters happily identifies and replaces the different www.example.com entries with $end = "/" but I need to expand it to also replace text to the second "/" such as URL /TextToReplace/ but the TextToReplace can be different e.g. www.example.com/TextoToReplace/DontReplace www.example.com/ABC/DontReplace www.example2.com/DEF/DontReplace www.example3.com/GHI/DontReplace I tried wildcard but that didn't work as it is taken as a literal character. Any help appreciated Thanks, Barry
-
Open files that are returned in rray
barryb replied to barryb's topic in AutoIt General Help and Support
Thanks for the help guys