AutoHotkey Community

It is currently May 26th, 2012, 2:25 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject:
PostPosted: January 20th, 2009, 11:01 pm 
First of all I have to thank you for the great work - very helpful!

But I tested the script and identified several errors:

1) CSV_writeCell and XLS_writeCell do not change the var. __line%row%
- Statement should be : __line%row% := regExReplace(__line%row%, __matrix%row%_%column%, Format4CSV(value))

2) To have all changes reflected in the .csv using finalize_CSV the r_updated value should be set to false using r_updated = false (not := false)
or the if statement within the finalize_CSV should be changed to: if(r_updated = false) (not: r_update = "false")

Regards


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 21st, 2009, 12:18 am 
I built functions for adding or removing rows (quick and dirty as I'm in a hurry):

Code:
CSV_addrow(value) { ;"b1,b2,b3"
   global

   loop parse, value, %r2_delimiter%
      __matrix%r_row%_%A_Index% := regExReplace(A_LoopField, "\R?$") ;%
    
   __line%r_row% := value
      
   r_row := r_row + 1
   CSV_totalRows()
   
   r_updated := false
}

CSV_deleterow(row) {
   global
      
   if (r_header)
      row ++
   
   Loop % r_lastRow - row ;%
   {
      t_row := row + A_Index - 1
      n_row := t_row + 1
      
      __line%t_row% := __line%n_row%
      
      loop r_col
         __matrix%t_row%_%A_Index% := __matrix%n_row%_%A_Index%
   }
      
   r_row := r_row - 1
   CSV_totalRows()
   
   r_updated := false
}


Maybe somebody will clean it up a bit ;)
cLue
[/b]


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2009, 11:31 pm 
Offline

Joined: April 8th, 2008, 1:08 am
Posts: 100
Location: Minnesota, USA
Quote:
I built functions for adding or removing rows (quick and dirty as I'm in a hurry):


Remove function works fine once, but when attempting to delete multiple rows the entire array will be erased or rows become duplictated, or nothing happens at all

_________________
-trueski-


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 5th, 2010, 3:49 am 
Offline

Joined: March 19th, 2007, 12:43 am
Posts: 532
I haven't done any debugging with writing values since i don't ever need to use them, makes me sad how broken these functions are :oops: .

Ok, i spent a few hours trying to read my own code :lol: and made some fixes with writing and finalizing functions. The only problem is it's not writing the very last line in csv file.
I'll try to fix that and implement suggested changes and functions in the original code/post in a short period of time.

P.S. Original post updated. I ran a few quick test and it seems to be writing values and saving copies just fine now.
P.P.S. There is one more bug that i have no idea how to fix as of now. If Any row contains duplicate data in separate columns and you attempt to overwrite only the later value, both will be overwritten. For instance if your row contains "1,2,3,1,4" and you need to overwrite only the fourth column, not the first one, function will replace both :oops: .


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 5th, 2010, 8:39 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
@neXt you did see trueskis' version here http://www.autohotkey.com/forum/topic42843.html :?:

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 21st, 2010, 4:00 am 
Offline

Joined: December 17th, 2008, 5:36 am
Posts: 80
I actually updated trueskis libary even more by adding more features and making it more reliable. It can be seen here:

Updated CSV Library - http://www.autohotkey.com/forum/viewtopic.php?p=341189#341189


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Help for a noob
PostPosted: October 16th, 2011, 2:34 am 
Offline

Joined: October 16th, 2011, 2:10 am
Posts: 21
Location: Charlotte
I just want to search a xls file, search by variable and return row to separate variable.
this is simple in perl, grep... but it's killing me in ahk, HELP Please?
:oops:


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Help for a noob
PostPosted: October 16th, 2011, 8:58 am 
neodrac23 wrote:
I just want to search a xls file, search by variable and return row to separate variable.

a) you are using the wrong library (if you work with CSV the kdoske one above is better OR use the table data library by VxE)
b) if you work with actual XLS files none of the CSV/TABLE libraries are of use as they don't work with binary files, you need COM like http://www.autohotkey.com/forum/topic70 ... =excel+com
So, try again :wink:


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group