Jump to content
Sign in to follow this  
aslani

Search Tool

Recommended Posts

aslani

Hi,

I have a bunch of Excel files with financial information and saved as the date of that financial activity.

Example:

20080501.xls

20080502.xls

etc.

Now I know this would have been better in a database and I'm currently working on that which eventually, everything will be in one Access Database.

Ok back to my problem.

I've been enjoying the usefulness of ExcelCOM_UDF and I want to thank its author for compiling all these UDF. Thank you.

Currently, I'm using _ExcelOpen and _ExcelReadCell inside a the function _TrackKeyWord(). I got that one to work well, but the problem I have is, I can't make my script to change folders.

Example: After it finished searching the January08 folder, I want it to move on to February08 folder, then March08, etc.

Currently I can only make it search on one folder at a time because I have to specify the folder name every single run.

So I would need help on creating a loop.

Basically, this is what I want it to do in the end.

Search: Fast Food

Fast Food found in the following:

20080501.xls - Fast Food $12.35 9:30AM

20080501.xls - Fast Food $10.25 1:30PM

20080502.xls - Fast Food $8.75 9:30AM

20080502.xls - Fast Food $6.45 1:30AM

etc.

Any ideas?


[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Share this post


Link to post
Share on other sites
enaiman

There are several ways to do this:

- ini file

Create an ini file and put every folder name in. Make your script read the folder names and make it search every folder for files.

the ini file might look like:

[Folders]
folder nbr = 3
folder1 = January08
folder2 = February08
folder3 = March08

then use a For-Next statement like :

For $i=1 To IniRead("your ini file", "Folders", "folder nbr", "") 
    If FileExists("path_to_folder\"&IniRead("your ini file", "Folders", "folder"&$i, "")) Then
        ;do your stuff here
        ;get the files from that folder
        ;search for string
        ;after last file has been processed it will end the loop
    EndIf
    ;it will go to next folder
Next

- search

Get the folder list (use FileFindFirstFile and FileFindNextFile) and put the names in an array, make your script search every folder.

Good luck


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
aslani

Thanks, that will work for now.

I'm looking for codes that will detect all folders and generate the list accordingly, automatically.

But I'll work with this for now and if anyone got some idea on how I ca do this please share :)

Thank you.


[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×