AutoHotkey Community

It is currently May 26th, 2012, 10:28 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: June 25th, 2008, 5:18 pm 
Offline

Joined: March 19th, 2007, 12:43 am
Posts: 532
It's really laggy and sorts only numbers i guess, i need to tune it up :oops: .
I tested it on this file. Sorted by column 2.
Quote:
Req on File,W.O.No.,Cli,Loc #,Lev,Description
*R*,431368,CWC,80109,3,SALES FLOOR CLEANING
*R*,431563,CWC,80110,3,SALES FLOOR CLEANING
*R*,431394,CWC,80111,3,SALES FLOOR CLEANING
*R*,431632,CWC,80102,A1,LEVEL A1 - WINDOW CLEANING
*R*,432098,CWC,80103,A1,LEVEL A1 - WINDOW CLEANING
*R*,431907,CWC,80104,A1,LEVEL A1 - WINDOW CLEANING
*R*,432024,CWC,80105,A1,LEVEL A1 - WINDOW CLEANING
*R*,431455,CWC,80106,A1,LEVEL A1 - WINDOW CLEANING
*R*,431571,CWC,80107,A1,LEVEL A1 - WINDOW CLEANING
*R*,431397,CWC,80108,A1,LEVEL A1 - WINDOW CLEANING
*R*,431369,CWC,80109,A1,LEVEL A1 - WINDOW CLEANING
*R*,431564,CWC,80110,A1,LEVEL A1 - WINDOW CLEANING
*R*,431395,CWC,80111,A1,LEVEL A1 - WINDOW CLEANING
*R*,431633,CWC,80102,A2,LEVEL A2 - WINDOW CLEANING
*R*,432099,CWC,80103,A2,LEVEL A2 - WINDOW CLEANING
*R*,431908,CWC,80104,A2,LEVEL A2 - WINDOW CLEANING
*R*,432025,CWC,80105,A2,LEVEL A2 - WINDOW CLEANING
*R*,431456,CWC,80106,A2,LEVEL A2 - WINDOW CLEANING
*R*,431572,CWC,80107,A2,LEVEL A2 - WINDOW CLEANING
*R*,431398,CWC,80108,A2,LEVEL A2 - WINDOW CLEANING
*R*,431370,CWC,80109,A2,LEVEL A2 - WINDOW CLEANING
*R*,431565,CWC,80110,A2,LEVEL A2 - WINDOW CLEANING


It needs work


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 25th, 2008, 7:26 pm 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
A comment about the sort... Sorry if there's something I'm not seeing again.

Code:
CSV_sort(column=1, order="asc") {
   global

   if (order = "desc")
      order = R
   
   if (column = 1)
      Sort r_file, N %order%

Unless the user sets order to "desc", isn't the Sort going to receive "N asc" as options? I don't think "asc" is a valid option :x


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2008, 6:51 pm 
Offline

Joined: March 19th, 2007, 12:43 am
Posts: 532
I made some fixes to sort function, it works much better now.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: July 28th, 2008, 8:28 pm 
Offline

Joined: July 20th, 2006, 1:57 am
Posts: 10
Hello all, and especially HugoV

I am interested in using your function but I get an error when I try.
The error is : Error on Line 21. Line Text:" Error: Bad default value.

The code is :
Code:
set_CSV(file, header=0, delimiter=",")


Do any of you know why this is happening? Is there a newer version of this function available somewhere ?

Let me know,

Cheers,

WankerMan :roll: [/img]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 28th, 2008, 10:12 pm 
Offline

Joined: March 19th, 2007, 12:43 am
Posts: 532
If you simply trying to specify a file, here's how it's done:
Code:
set_CSV("example.csv")


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Jumping the gun.
PostPosted: July 31st, 2008, 5:07 pm 
Offline

Joined: July 20th, 2006, 1:57 am
Posts: 10
Thanks HugoV,

I panicked to quickly. All is good. Actually more than good. This function is freakn' sweet. I can't believe how much time it has saved me.

Cheers all,

Curtis :mrgreen:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 4th, 2008, 5:19 pm 
Offline

Joined: March 19th, 2007, 12:43 am
Posts: 532
updated, added XLS_readCell and XLS_writeCell


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 4th, 2008, 7:58 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
ALso I see you "fixed" the finalize_CSV to write in one fileappend instead of
per CSV line That will improve the speed quite a bit...

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 4th, 2008, 8:02 pm 
Offline

Joined: March 19th, 2007, 12:43 am
Posts: 532
Yeah, there are quite a few changes in the code :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 7th, 2008, 6:19 pm 
Offline

Joined: May 22nd, 2008, 12:57 am
Posts: 120
Small point, but wouldn't it make sense to rename all of those functions not beginning as CSV_Something (like finalize_CSV) to begin with CSV (e.g., CSV_Finalize) so that this can be included as a part of a library in \lib ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 7th, 2008, 7:01 pm 
Offline

Joined: March 19th, 2007, 12:43 am
Posts: 532
Yes, it would make more sense i guess. I did it like that to draw attention since those 2 functions are important, but it looks like they create more confusion rather than serve their purpose. I'll change that when i'll come up with a new update.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 7th, 2008, 7:26 pm 
Offline

Joined: May 22nd, 2008, 12:57 am
Posts: 120
You could call it CSV_SET and CSV_FINALIZE to add emphasis (i.e., they're the only functions with all CAPS).

This looks sweet btw.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: CSV_search
PostPosted: September 10th, 2008, 7:55 pm 
Offline

Joined: September 8th, 2008, 8:38 pm
Posts: 33
How about this function to add to it? It returns the location if the RegEx matches, whereas the CSV_Find only returns if the whole cell matches. Please check its validity.

Code:
CSV_search(value, row=0, column=0, offset_x=0, offset_y=0) {
   global

   i = 0
   ;full search
   if (row = 0 && column = 0) {
      loop %r_lastRow% {
         i++
         loop %r_lastCol% {
            if (0 < RegExMatch(__matrix%i%_%A_Index%, value))
               return % i + offset_x . "," . A_Index + offset_y                ;%
         }
      }
   }

   ;search specified row
   if (row != 0 && column = 0) {
      loop %r_lastCol% {
         if  (0 < RegExMatch(__matrix%row%_%A_Index%, value))
            return % A_Index + offset_y                                         ;%
      }
   }

   ;search specified column
   if (row = 0 && column != 0) {
      loop %r_lastRow% {
         if (0 < RegExMatch(__matrix%A_Index%_%column%, value))
            return % A_Index + offset_x                                         ;%
      }
   }
return false
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2008, 5:37 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
In the ask for help there is a question/bug, if I run his example I indeed
get an empty file, it gets better if I add the fullpath to the file and
also "1" in the finalize. I did notice another problem, the _copy file
was missing the last row entirely and also the new value of the
1 1 cell wasn't there.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2008, 5:55 pm 
Offline

Joined: March 21st, 2007, 7:50 pm
Posts: 76
another bug is in CSV_sort

the new file is written without space delimiter


Report this post
Top
 Profile  
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  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Stigg and 7 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