Jump to content
Sign in to follow this  


Recommended Posts


Ok, I've search the forum but the ones I've found doesn't really answer my question so here goes.

I'm trying to create a File/Folder Search alternative. Normally in WinXP, you simply right click on the folder then click Search... and a window will open where you can search for a file name. For some reason, due to security setup at work, this doesn't work 100% at a time. I've already create a simply file executor, but that requires that you know the whole name and extension.

But what I'm trying to do is create a search box that will search for the first 3 number and return everything, from folder to files, with that starting 3 number into an array.

Here's what I have but it doesn't work;

Dim $sFileArray[1]
            $sPrefix = StringLeft(GUICtrlRead($sInput), 3)
            $sHandle = FileFindFirstFile("N:\Solidworks\MASTER\" & $sPrefix)
                $sFound = FileFindNextFile($sHandle)
                _ArrayAdd($sFileArray, $sFound)
            Until @error

Any suggestions?

Edited by aslani

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

Share this post

Link to post
Share on other sites

I got 2 questions:

1) does it have to be beta autoit? I tried pointing it to my autoit and it works (dont think mine is beta...)

2) how does @ComSpec work? help file says

value of %comspec%, the SPECified secondary COMmand interpreter;
primarily for command line uses, e.g.  Run(@ComSpec & " /k help | more")

but how do I find out what is %comspec% on my computer?


Share this post

Link to post
Share on other sites

Here is a program that might help ( code is there too )

Posted Image



Thanks, it's a great script but it can't find the file/folder I specified...even giving the whole filename. I don't know why because I can only understand half of what's going on on that script. Although I like the fact that it looks into subfolder even only giving the main folder, so that's a good start for me.

But the script runs too slow because it's searching into every folder. What I want to do is create a smart search using the prefix of the filename because that's how they are sorted in the Main folder.

Main Folder


-- 100

--- 1001001.extasm

--- 1001002.extasm

-- 200

--- 2009001.extasm

--- 2009002.extasm



-- 100

--- 1001001.extprt

--- 1001002.extprt

-- 200

--- 2009001.extprt

--- 2009002.extprt


So basically I want the script to jump into the Main folder, strip the search keyword of the first 3 number, then add that 3 numbers to the file path (i.e. MainFolder\Parts\200\) then it will search in Assemblies folder, Parts folder, etc. until it find the keyword and everything that has those keyword (i.e. keyword=2009*, it will return everything that start with 2009 which mean both 2009001.extasm and 2009001.extprt).

[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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.