evaluser Posted May 12, 2009 Posted May 12, 2009 Hi, Could u plz let me know a sample snippet for importing a csv file in the autoit script editor & its fields from the csv file ? Thanks.
Moderators SmOke_N Posted May 12, 2009 Moderators Posted May 12, 2009 Hi,Could u plz let me know a sample snippet for importing a csv file in the autoit script editor & its fields from the csv file ?Thanks.You need to be much more specific in your needs, what you've attempted, and where you're failing at. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
rudi Posted May 12, 2009 Posted May 12, 2009 Hi.Could u plz let me know a sample snippet for importing a csv file in the autoit script editor & its fields from the csv file ?Please read the sample snippets in the help file:CSV files are organized in lines. --> filereadline()In each line the fields are separated by a certain CHAR. --> stringsplit()Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE!
evaluser Posted May 12, 2009 Author Posted May 12, 2009 The sample scenario is - Open csv file - Access username & password field values (file attached in txt format) - Pass the field values(username & password) to the respective GUI components(text boxes) in the application using the Send function Sample script created below $file=FileOpen("C:\inputdata.csv",0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; How can i access the field values & pass it in send() function FileClose($file)inputdata.txt
Moderators SmOke_N Posted May 12, 2009 Moderators Posted May 12, 2009 The sample scenario is - Open csv file - Access username & password field values (file attached in txt format) - Pass the field values(username & password) to the respective GUI components(text boxes) in the application using the Send function Sample script created below $file=FileOpen("C:\inputdata.csv",0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; How can i access the field values & pass it in send() function FileClose($file)_FileReadToArray() will return an array of file lines StringSplit() can split that value to give you the rest. However, if your csv file is that simple... #include <array.au3>; So you can see output Global $s_file = @HomeDrive & "\inputdata.csv" Global $s_read = FileRead($s_file) Global $a_user_pass = StringRegExp($s_read, "(?i)username,passwd.*?\v+(.+?),(.+?)(?:\v|\z)", 3) _ArrayDisplay($a_user_pass) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
evaluser Posted May 12, 2009 Author Posted May 12, 2009 Thanks for the reply .. Could you also comment on this post - http://www.autoitscript.com/forum/index.php?showtopic=94865
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