Jump to content

Search the Community

Showing results for tags 'stringsplit'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 13 results

  1. Hello, Does somebody knows a quick way to split eash word to an array in a text? I've a text and want to have each word in that text in an array. I tried to get in some way multiple seperators inside stringsplit but couldn't get it to work. I hope to get an array like : $aArray[0] = "PARIJS" $aArray[1] = "AFN" $aArray[2] = "Air" .... sample text: PARIJS (AFN) - Air France-KLM heeft de financieel directeur van het Franse nuts- en vervoersbedrijf Veolia, Philipe Capron, in het vizier om de nieuwe topman van de luchtvaartcombinatie te worden. Volgens de krant La Tribune wordt Capron als favoriet beschouwd om de topfunctie te gaan vervullen. AdChoices Advertentie Volgens bronnen tegen La Tribune is de keuze voor Capron zelfs al gemaakt door Air France-KLM en zal zijn voordracht volgende week worden voorgelegd aan de raad van toezicht bij het bedrijf. Capron zou dan de opvolger worden van de opgestapte topman Jean-Marc Janaillac. In mei trad Janaillac af nadat het hem niet was gelukt buiten de bonden om zaken te doen met het eigen personeel. Sindsdien heeft een interim-bestuur de dagelijkse leiding. De zestigjarige Capron is sinds 2014 financieel directeur bij Veolia. Daarvoor werkte hij onder meer bij mediaconcern Vivendi. Minder macht Overigens zijn er ook geruchten dat de nieuwe topman van Air France-KLM direct een zetel zou krijgen in de raad van commissarissen van KLM. Binnen de Nederlandse divisie, die juist alles op alles zet om minder macht naar Parijs te laten vloeien, is men volgens ingewijden verbolgen over die gang van zaken. ,,Stank voor dank", zo klinkt het in de wandelgangen. Eerder zou Janaillac ook al hebben geprobeerd om een dikkere vinger in de pap te krijgen bij KLM, dat door de bank genomen beter presteert dan haar Franse zustermaatschappij. Dit lukte eerder niet, onder meer door inmenging van het Nederlandse kabinet. AdChoices Advertentie Geruchten Een woordvoerder van Air France-KLM wilde niet reageren op de geruchtenstroom. Het concern gaat er vanuit dat binnen afzienbare tijd een nieuwe bestuursvoorzitter benoemd zal worden. Minister Cora van Nieuwenhuizen (Infrastructuur) wilde evenmin ingaan op geruchten. ,,Ik heb hierover nog geen contact gehad met KLM, dus dat wil ik eerst even afwachten'', zei ze. Tweede Kamerleden spraken deze week tijdens een debat nog maar eens hun zorg uit over de ontwikkelingen bij Air France-KLM. Zij drongen aan op herbevestiging van oude afspraken over de relatief zelfstandige positie van KLM binnen de groep.>Exit code: 0 Time: 28.52
  2. Hi, i receive a strange result from splitting strings elements contained in an array .(In attachment the resulting array) My Array contains strings like: INFO [26.01.2018 13:53:44] [XYZ] [XYZ, XYZ] Delta pack 5.2.25_17.01.2018 server version: 5.2.25_22.01.2018 not available. My code is: For $a=0 to UBound($Array_info_4) -1 $Array_info_4[$a]=StringSplit($Array_info_4[$a],",",$STR_NOCOUNT) Next I tried also using a second Array to store the result, but the result was the same, like in the attachment. Where is my mistake? :-)
  3. Hi i try to read Wlan Profiles from local Computer. First Step Command Prompt: netsh wlan show profiles >> C:\temp\test\wlan.txt. Second Step (here's a sample script to find a solution for my problem. Script read each line of wlan.txt and Display Name of Wireless Connection which i have set up in the past. If i edit wlan.txt to wlan - sample.txt script works. wlan.txt containsline without : so i get error message. How can i read only lines beginning with All User Profile so i can use original file wlan.txt which i crate in the command prompt with: netsh wlan show profiles >> C:\temp\test\wlan.txt ? Thanks for any suggestions. Kneze $Form1 = GUICreate("Form1", 374, 268, 892, 512) $Button1 = GUICtrlCreateButton("button", 145, 35, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $file = "C:\temp\test\wlan.txt" FileOpen($file, 0) For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) $after = StringSplit($line, ":")[2] MsgBox(262144, "Result", $after, 0) Next FileClose($file) EndSwitch WEnd wlan - sample.txt wlan.txt
  4. The McAfee return for AV defs per "C:\Progra~1\Common~1\McAfee\SystemCore\csscan.exe -Versions" is ... CommonShell Command Line Scanner Lite (VSCORE.15.5.0.3960) Engine version: 5800.7501 DAT version: 8450.0 Time required: 15 milliseconds I want to isolate the actual DAT version as "8450.0". There may be an easier way to get the DAT Version via other McAfee or registry methods but essentially I just want to know how to parse a string at a character or @CRLF into two separate strings for further parsing. Example: $string = "Name=Microsoft Windows 10 Professional |C:\windows|\Device\Harddisk0\Partition2" Parse into $var1 = "Name" & $var2 = "Microsoft Windows 10 Professional |C:\windows|\Device\Harddisk0\Partition2" From there I'd like to parse $var2 at "|" into $var3 = "Microsoft Windows 10 Professional" and $var4 "C:\windows|\Device\Harddisk0\Partition2"
  5. Hello everyone! I've encountered a strange problem while adding files (or rather file names) to a ListView. Mechanics are simple: 1. Select files to add (FileOpenDialog + Multiselect) 2. Split selected string (filepath) into array (StringSplit) 3. File names appear on ListView (GUICtrlCreateListViewItem) Writing starts from second array (since 0 is array size, and 1 is filepath). Problem occurs when I try to add one file. Then, no filenames are added. As far as I know, selecting one file generates only 2 strings (0 and 1) to split, therefore no string is written into ListView. Is there any way / workaround to make this thing work properly? Some code here: While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idAddTest $sMessage = "Select test cases to load:" $sFileOpenDialog = FileOpenDialog($sMessage, @WorkingDir & "\data\tests\", "All (*.*)", $FD_FILEMUSTEXIST & $FD_MULTISELECT) If @error Then MsgBox($MB_SYSTEMMODAL, "", "No test(s) were selected.") FileChangeDir(@ScriptDir) Else FileChangeDir(@ScriptDir) $aFileList = StringSplit($sFileOpenDialog, "|", @CRLF) For $i = 2 to $aFileList[0] MsgBox( 0, "test", $aFileList[$i]) ;just for testing purposes GUICtrlCreateListViewItem($aFileList[$i], $idTestCaseList) Next EndIf EndSwitch WEnd And nothing more spectacular from ListView side: Global $idTestCaseList = GUICtrlCreateListView("List of Tests ", 24, 24, 225, 502, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) GUICtrlSetTip(-1, "List of test cases."& @CRLF &"Hold CTRL to select multiple lines.") Any help appreciated!
  6. How to use regular expressions in StringSplit and StringInStr
  7. Dim $oneDarray $oneDarray=StringSplit($Rawfile, @CRLF, 1) $columnsCounter = stringsplit($oneDarray[2],",") GUICtrlSetData ( $Output,"*Group columns Detected from csv:"& $columnsCounter[0] &@CRLF, @CR) ConsoleWrite("*Group columns Detected from csv:"& $columnsCounter[0] &@CRLF) Dim $twoDarray[$oneDarray[0] + 1][$columnsCounter[0] + 1] For $x = 1 to ($oneDarray[0]) $oneRow = stringsplit($oneDarray[$x],",") For $y = 1 to ($oneRow[0]) $twoDarray[$x][$y] = $oneRow[$y] Next Next Log Output Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $twoDarray[$x][$y] = $oneRow[$y] ^ ERROR So I have a csv file that I'm breaking up to do string parsing for information from and I've run into a problem I'm not sure how to solve. In the code shown above I am creating the master 2d array that holds all the values from the csv. The problem the code runs into starts on this line: $oneRow = stringsplit($oneDarray[$x],",") It worked great until I ran into a csv file that had commas in a txt field that were not related to the csv format.. example: "this is some text, and some more text", filedir, ipaddress, hostname,mmmbeer as CSV format this is 5 fields, however the stringsplit counts the comma in the text and identifies this as 6 fields. Any ideas how I can somehow not include the comma in quotes in stringsplit? Thanks, Bob
  8. 12 where is a simple StringSplit at delimeter example please? Copy to clipboard #include <MsgBoxConstants.au3> Example() Func Example() Local $aDays = StringSplit("Mon,Tues,Wed,Thur,Fri,Sat,Sun", ",") ; Split the string of days using the delimeter "," and the default flag value. #cs The array returned will contain the following values: $aDays[1] = "Mon" $aDays[2] = "Tues" $aDays[3] = "Wed" ... $aDays[7] = "Sun" #ce For $i = 1 To $aDays[0] ; Loop through the array returned by StringSplit to display the individual values. MsgBox($MB_SYSTEMMODAL, "", "$aDays[" & $i & "] - " & $aDays[$i]) Next EndFunc ;==>Example I went through Datatypes Operators Conditional Obj Statements I had high hopes for Obj statements but it was a waste so I went to Google, Yahoo, Yandex, Sohu, and Baidu. All I learned is that Baidu has more mobile customers than the US has people! I need to separate this string at each to enter into a database BabyMAKERrootCIMV2:Win32_Service.Name="Apache2.4"BabyMAKERrootCIMV2:Win32_Service.Name="Apache2.4"BabyMAKERrootCIMV2:Win32_Service.Name="AppIDSvc"BabyMAKERrootCIMV2:Win32_Service.Name="AppIDSvc"BabyMAKERrootCIMV2:Win32_Service.Name="AppIDSvc"BabyMAKERrootCIMV2:Win32_Service.Name="Appinfo"BabyMAKERrootCIMV2:Win32_Service.Name="Appinfo"BabyMAKERrootCIMV2:Win32_Service.Name="asComSvc" ALL three examples are ARRAYS.... If I wanted a tree I go to the beach and catch a fish and plant it deep with lots of tree food. Then water it daily waiting for the day the fish turns into a tree. Is it a joke? I did a search array in the help(Help control 6.1) file for array and got NO RESULTS. I tried the trim examples and they worked great but I have no way of knowing how long each string will be at the delimeter so where is a simple StringSplit at delimeter example please? I know I had to miss it.
  9. i have a script that extract the second caracter from specific phrase $aUser = StringSplit($sText, " ") $status = $aUser[2] but sometime there are no $aUser[2] and thats get an error $status = $aUser[2] $status = ^ ERROR and i have to restart script manual each time It is possible to pass this kind of error? I need the script to run NON STOP without interrupting it on error
  10. So, Im trying to let my software create a label for each user found Current Code: $defaultfriendsize = "67" For $i = 1 To $onlinevriendraw[0] ;MsgBox($MB_SYSTEMMODAL, "test", "online: " & $onlinevriendraw[$i]) MsgBox(64, "test2", $onlinevriendraw[$i]) $usernumber = +1 GUICtrlCreateLabel($onlinevriendraw[$i], 5, $usernumber*$defaultfriendsize, 195, 35) Next EndIf The software pulls the Username and Userid in a string (Username,1 - OtherUsername,2) The msgbox puts out the retreived data fine, However when I want to create a label for each it creates them all on the same spot... (with the code above I hoped it would calculate a different position for each [$i] found) Other than that, I wanted to split the Username from the ID by using stringsplit For $i = 1 To $onlinevriendraw[0] $onlinevriend = $onlinevriendraw[$i] For $i = 1 To $onlinevriend[0] $onlineuser = StringSplit($onlinevriend[$i], ",") MsgBox(64, "SplStr Test", $onlineuser[$i]) Next It only returns the first one, as in $onlinevriendraw[1] How can I achive to create a unique label position for each user found, and also split their data by using "," to split? Thank you very much in Advance!
  11. Hello, I'm lost again....(as always ) I tried different approaches, _StringBetween, StringRegExp, StringInStr.... but in the end non of my approaches worked fine. Every time I ended up like this: As I don't want to confuse you with my now messed up code snippets, I will explain what I got and what I need (sorry for that, but I don't want someone to fix my wrong approach if there is a already working solution (btw. of course I read the forum for some hints, and there are a lot of them but non of the described hints worked for me in the end. Maybe I'm not smart enough these days to understand.....(please don't say yes here))) So here we go: My Input string is: $sString='{"a1-a1":{"d1":"v1","d2":"v2"},"b1-b1":{"d3":"v3","d4":"v4"},"c1-c1":{"d5":"v5","d6":"v6"}}'this means I got three "fields" with the pattern: "<prefix always 2char-2char with quotes>":{<value1 with data1 in quotes>,<value1 with data1 in quotes>} separated by a " , ", surrounded by a "{}" pair. I want to retrieve an array like this: $arrTemp[1]="a1-a1":{"d1":"v1","d2":"v2"} $arrTemp[2]="b1-b1":{"d3":"v3","d4":"v4"} $arrTemp[3]="c1-c1":{"d5":"v5","d6":"v6"} optional also with the start and end position of that string based on the original string in the same array. eg: $arrTemp[1][0]="a1-a1":{"d1":"v1","d2":"v2"} $arrTemp[1][1]=3 $arrTemp[1][2]=31 I "guess" this could be achieved by a StringRegExp formatted command. I wanted to define a pattern that split up the string into fields. Could some one help me out?
  12. Hello there, I am a few days now trying to understand this commands. I am reading the help files and examples but still nothing... I got this command in my code which search in a file for lines Local $aLines = StringRegExp($sLines, "(?:([^v]+)(?:v+|$))", 3) ; Lines to a zero-based array (blank lines not included).and then i got a loop to find these lines. My lines are like this [22:53:48] "Leandros" Leaving [22:53:50] "Leandros" Leaving [22:53:53] "Shertaz" ? [22:54:01] "Mirtid" any tips my friend? The first two lines are basicly the same but the only thing changing is the time [22:53:48] "Leandros" Leaving [22:53:50] "Leandros" Leaving there are 2 second difference in these lines and thats why my script wont find them. But they are still the same. Is it able to make it find these same lines even if they have difference in the time? Edit: Is it also able to make it avoid some lines starting like this? [Open Server] .........
  13. hi ppl! i'm here again >.<" i'm getting problem with my stringsplit() function look the example code: GUICreate("Gui Test", 300, 300, -1, -1) Local $listview = GUICtrlCreateListView("Teste", 0, 0, 300, 300) Local $string = "string1|string2|string3|string4" & @CRLF & _ "string5|string6|string7|string8" Local $splited = StringSplit($string, @CRLF, 1) For $i = 1 To $splited[0] GUICtrlCreateListViewItem($splited[$i], $listview) Next GUISetState() Sleep(5000) Exit in the listview only enters a "String1" and "String 5" not a "string1|string2|string3|string4" and "string5|string6|string7|string8" what would be correct! anyone can look this for me? thanks a lot!
×
×
  • Create New...