| View previous topic :: View next topic |
| Author |
Message |
cLue Guest
|
Posted: Tue Jan 20, 2009 10:01 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
cLue Guest
|
Posted: Tue Jan 20, 2009 11:18 pm Post subject: |
|
|
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] |
|
| Back to top |
|
 |
trueski
Joined: 08 Apr 2008 Posts: 92 Location: Minnesota, USA
|
Posted: Tue Mar 31, 2009 10:31 pm Post subject: |
|
|
| 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- |
|
| Back to top |
|
 |
neXt
Joined: 18 Mar 2007 Posts: 505
|
Posted: Tue Jan 05, 2010 2:49 am Post subject: |
|
|
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 .
Ok, i spent a few hours trying to read my own code 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 . _________________ simplified csv - easy way to handle csv files. |
|
| Back to top |
|
 |
SoLong&Thx4AllTheFish
Joined: 27 May 2007 Posts: 4999
|
|
| Back to top |
|
 |
kdoske
Joined: 17 Dec 2008 Posts: 80
|
|
| Back to top |
|
 |
neodrac23
Joined: 16 Oct 2011 Posts: 21 Location: Charlotte
|
Posted: Sun Oct 16, 2011 1:34 am Post subject: Help for a noob |
|
|
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?
 |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Oct 16, 2011 7:58 am Post subject: Re: Help for a noob |
|
|
| 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/topic70421.html&highlight=excel+com
So, try again  |
|
| Back to top |
|
 |
|