# Search the Community

Showing results for tags 'csv'.

• ### Search By Tags

Type tags separated by commas.

### Forums

• General
• Announcements and Site News
• AutoIt v3
• AutoIt Help and Support
• AutoIt Technical Discussion
• AutoIt Example Scripts
• Scripting and Development
• Developer General Discussion
• Language Specific Discussion
• 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
• Hardware
• Information gathering
• Internet protocol suite
• Maths
• Media
• PDF
• Security
• Social Media and other Website API
• Windows
• Scripting and Development
• Operating System Deployment
• Windows Client
• Windows Server
• Office

• Forum FAQ
• AutoIt

### Calendars

• Community Calendar

• 0 Replies

• 0 Reviews

• 0 Views

Found 20 results

1. ## Short User-Creation script for Oracle?

Hello Smart People! I have a multi-column .CSV that I would like to draw information from, in order to populate (send) that info to some fields in an Oracle form. This would be for account-creation in Oracle. I have the basic script to navigate (tab) through the fields in the Oracle form, but I am SUPER-new to AutoIT and don’t quite see how to get the script to import and use variables from a .CSV For example: My script just waits for the page to be active, then enters data and tabs between fields like this: ; Wait for the window to be active WinWaitActive("Oracle is Cool - E-Business is the Best") ; User Name Send("jsmith") Send("{TAB}") ; Password Send("Password1") Send("{TAB}") Send("Password1") Send("{TAB}") ; Description Send("John Smith") Send("{TAB}") (etc. etc. etc.…) The winning solution would take one row at a time, feed it into fields on the Oracle form, save, and then start in on the next row It looks like I’d need a combination of “FileReadToArray” ( or“FileReadLine”?) and “StringSplit” to loop through the values and set them to variables, which would then replace my current "hard-coded" values to be typed them into the form? I found the following example in the “Help” snippets for stringsplit()… this seems like it’s in the ballpark but I’m having some trouble wrapping this around what I’ve put together, since each entry in the array would have multiple elements per line instead of just “Day”: Func Example() Local $aDays = StringSplit("Mon,Tues,Wed,Thur,Fri,Sat,Sun", ",") ;Split the string of days using the delimiter "," 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 This post also seems like a similar example, but I don’t need it to be so selective RE: one specific column: https://www.autoitscript.com/forum/topic/166261-how-to-read-csv-specific-row-and-columns Any advice would be appreciated! Thanks for taking a minute to look!
2. ## Script to get input from user ,check in csv file and read corresponding values and pass that value to cmd

Hi all, I have a csv file as below, I wand to find srno from csv and send corresponding ip and pass to commend cmd prompt. Please guide me to create script . srno,name,ip,pass 1,name1,ip1,pass1 2,name2,ip2,pass2
3. ## filewritetoarray csv, but with commas in the location

hi all, reviewing the forum, this thread is applicable: I wanted to know if there is now a better way to do this? In essence, I load a tab delimited txt file into an array (works well). I used tab, as some fields in the original csv contains commas. However, I needed autoit to manipulate this array, and output it as a csv. IF my array contains items with a comma, without double quotes around the field, then how best do I get a csv out of this? My current workaround is to filewritefromarray tab delimited, then open it in excel and save as a csv. I will need to check this to see how the address fields behave that contain a comma. Any thoughts would be appreciated.
4. ## Write inputs values into Colum and Raw in CSV

Dear all, Can someone show me how to en hance the below function to write in CSV into column and rows the input values ? I am getting this result: I would like the result to be as this From A1:C1 is for headers From A2:C2 is for input Data Global Const $GUI_EVENT_CLOSE = -3$sDataFilePath = @ScriptDir & "\Records.csv" #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Demo1: New Record", 580, 115)$Input1 = GUICtrlCreateInput("", 10, 30, 270, 21) $Input2 = GUICtrlCreateInput("", 300, 30, 270, 21)$Input3 = GUICtrlCreateInput("", 10, 80, 270, 21) $Label1 = GUICtrlCreateLabel("Name:", 10, 10, 35, 17)$Label2 = GUICtrlCreateLabel("ID:", 300, 10, 18, 17) $Label3 = GUICtrlCreateLabel("Phone No:", 10, 60, 55, 17)$Button1 = GUICtrlCreateButton("Save to CSV", 450, 70, 120, 30) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch$nMsg Case $GUI_EVENT_CLOSE Exit Case$Button1 _ExportData() MsgBox(64, @ScriptName, "Record Saved.") EndSwitch WEnd Func _ExportData() If Not FileExists($sDataFilePath) Then FileWriteLine($sDataFilePath, "Name;ID;Phone No.;") EndIf For $i =$Input1 To $Input3 FileWrite($sDataFilePath, GUICtrlRead($i) & ";") Next FileWriteLine($sDataFilePath, "") EndFunc ;==>_ExportData May be Excel UDF has be to be added but I can manage that my self Thank you in advance

6. ## Convert PDF to CSV, and working with it

Good morning guys I'd like to know if there is a way to convert a PDF in CSV or, eventually, in TXT, in order to read from it, like a database... I have a PDF and I think ( I dind't search a lot on the forum ) with AutoIt, but I'd like work with Excel styles... Does anyone know a good program which convert PDF to CSV? PS: the PDF file is 5 MB, and it contains 439 pages... Thanks everyone for the help
7. ## Reading CSV with mixed delimiters?

I have a csv file with delimiters "," and @CRLF After trying several different examples (simple ones!) I still haven't resolved an answer #include <Array.au3> #include <File.au3> ;#include "ArrayMultiColSort.au3" Global $BatchDir = "C:\ncat\" FileChangeDir($BatchDir) $sFile = "mod1.csv" ; Read file into a 2D array Global$aArray _FileReadToArray($sFile,$aArray, $FRTA_NOCOUNT, ",") ; And here it is _ArrayDisplay($aArray, "Original", Default, 8) Firstly it throws a MsgBox error "No array variable passed to function" _ArrayDisplay(), so no displayed data Second and probably more important how do I get _FileReadToArray() to split the imported array[][] into rows and columns? I tried "," & @CRLF without success.

19. ## Regexp question

Pleas help me , I am converting HTML to csv using the command stringreg exp. In the example belot, the field Help is not detected. How to change my regexp ? #include <Array.au3> $sString = "<td NOWRAP>cel1</td><td NOWRAP>cel2</td><td NOWRAP>cel3</td><td>Help</td><td NOWRAP>cel4</td>"$aReturn = StringRegExp($sString, '(?s)(?i)<td NOWRAP>(.*?)</td>', 3) _ArrayDisplay($aReturn) thnx.
20. ## Help optimizing CSV conversion

Hi all, I need to convert a .csv file that after conversion will fill an array for futher usage. function used/not used: stringsplit(), stringregexp(),stringinstr(), stringreplace() I know the best way is to use stringsplit given a delimiter (,). But this is not possible here since: Here is some lines fo the .csv Game Title,Quantity,For Sale,Platform,Rating,Number,New After Life,5,2,PC,PG1,23332,Yes Max Payne,4,0,Wii,PG3,109,No Fifa 2009,11,2,DS,PG2,976,Yes "Hellgate, London",3,2,PC,PG2,112,No Logitech Mouse,12,4,mouse, ,No Pinball 2010,1,1,PS3,PG1,065,No As you can see: "Hellgate, London",3,2,PC,PG2,112,No will not work with stringsplit() since the "," it's inside the name of the object Logitech Mouse,12,4,mouse, ,No Here I have blank spaces between "," and the field "Rating" is missing. This is due to the .csv format. When Platform <> PC,Wii,DS,PS1,PS2,PS3,XB,X3 then I need to set Platform = Hardware and Rating = the value found in place of platform (in this case Platform = N, Rating = Hardware) Once this is finished and I have my array built, I need to add 2 more columns to it. I get the columns _arraysearch()ing between the just created array and another file (.xlm). If i found the item I need I add the prices, if not, skip. So now I use this code (working): $exportfile = @ScriptDir & "\filelist.csv" Dim$mydb Global $file2ftp = @TempDir & "\temp2db.txt" Dim$csv_list[1][7] Global $rows Func _exp2db_x() Local$iCounter = 0, $array2db[10000] Local$user2db Local $k = 0 Dim$csv_array _FileReadToArray($exportfile,$csv_array) _FileReadToArray($price_file,$mydb) _ArraySort($mydb)$begin = TimerInit() For $i = 1 To UBound($csv_array) - 1 If StringInStr($csv_array[$i], ", ,") Then ; i'm looking for a ", ," in lines $string = StringReplace($csv_array[$i], ", ,", ",@,", 1) ; if found I change it Else$string = $csv_array[$i] EndIf If StringInStr($string, ", ") Then$string = StringReplace($string, ", ", "^", 1); If I find "," inside the name I need to change it$name_s = _StringBetween($string, "", ",")$name = _cleanfordb($name_s[0]) ; Need to reconvert name with "," and remove " if present$string = StringReplace($string, ",", "*", 1) ; since I can't use stringsplit() i need different separators$string = StringReplace($string, ",", "#", 1) ; since I can't use stringsplit() i need different separators$forsale = StringRegExp($string, "#(.*?),", 1) ; for sale If$forsale[0] > 0 Then $k +=1$string = StringReplace($string, ",", "_", 1) ; since I can't use stringsplit() i need different separators$platform = StringRegExp($string, "_(.*?),", 1) ;platform$rating = StringRegExp($string, ",(.*?),", 1) ;rating If$platform[0] <> "PC" And $platform[0] <> "DS" And$platform[0] <> "Wii" And $platform[0] <> "XB" And$platform[0] <> "X3" And $platform[0] <> "Junk" Then$rating[0] = "Hardware" ; fixed value $platform[0] = "N" ; fixed value EndIf If$platform[0] = "Junk" Then $rating[0] =$platform[0] $platform[0] = "None" EndIf$new = StringRight($string, 2) ; just lasr 2 chars for last item in row If$new = "es" Then $new = "Yes" ReDim$csv_list[$k + 1][7]$csv_list[$k][0] =$name $csv_list[$k][1] = $platform[0] If$rating[0] <> "@" Then $csv_list[$k][2] = $rating[0]$csv_list[$k][3] =$new $csv_list[$k][4] = $forsale[0] ; now I build the string to check vs the main db (I need a partial search)$string = "<z:row c0='" & _normalize_db($csv_list[$k][0]) & "' Rating='" & $csv_list[$k][2] & "' New='" & $csv_list[$k][3] & "' Platform='" & $csv_list[$k][1] ; _normalize_db just change exotic chars into xml_readable sequence $check_string = _ArraySearch($mydb, $string, 39, UBound($mydb), 0, 1) ; first 38 lines is the xml header so I can skip If $check_string <> -1 Then$csv_list[$k][5] = _sellp($check_string) ; I can have 2 possible prices in main DB, best price and street price. If bestprice = 0 I'll use StreetPrice EndIf Next ConsoleWrite("Time to complete: " & TimerDiff($begin) & @CRLF) EndFunc ;==>_exp2db_x Func _cleanfordb($k) If StringInStr($k, "^") Then$k = StringReplace($k, "^", ", ") ; ^ If StringInStr($k, '"') Then $k = StringMid($k, 2, StringLen($k) - 2) Return$k EndFunc ;==>_cleanfordb Func _sellp($cc)$p = StringRegExp($mydb[$cc], "c6='(.*?)' c7",1) If $p[0] = 0 Then$p = StringRegExp($mydb[$cc], "c7='(.*?)'/>",1) Return \$p[0] EndFunc ;==>_sellp Time to complete is 137,000ms, 2'17'', for 1,243 lines of csv (and 30,000 lines of main DB) I need to work, during normal phases, with 10,000 to 30,000 lines so time to complete will be really too high. I ask you, great programmers, if there is a way to optimize this routine (i'm not able to modify the csv since I get it this way from the Store Application Thanks! M.
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...