forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Search Tree for File

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code
View previous topic :: View next topic  
Author Message
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1054
Location: India

PostPosted: Sat Sep 06, 2003 2:31 pm    Post subject: Search Tree for File Reply with quote

Search (directory)Tree for File
====================
You can find a file in a given directory in VDS
but it is difficult to search a tree for a file.
This code does that.
This API is real blazing fast. Enjoy !
If you want to find more than one file of same
name then you need a different API with elaborate
procedure inluding callbacks.

Disclaimer
==========
Script Uses API
Use is entirely a your own Risk.
If anyone wants a zIp file:
http://codescript.vdsworld.com/VDS5src/searchtreeforFile.zip
Regards

Code:
  #DEFINE FUNCTION,FINDFIRSTFILE
  TITLE Single File Search - CodeScript
  DIALOG CREATE,Single File Search - CodeScript,-1,0,405,196
  DIALOG ADD,BUTTON,Search,141,139,109,37,Search,,DEFAULT
  DIALOG ADD,EDIT,EDIT1,34,22,331,19,Readme.txt
  DIALOG ADD,TEXT,TEXT1,16,23,,,File Name to Search
  DIALOG ADD,EDIT,EDIT2,77,25,330,19
  DIALOG ADD,TEXT,TEXT2,60,25,95,13,Root Directory
  DIALOG ADD,BUTTON,BROWSE,78,361,21,19,..
  DIALOG ADD,EDIT,EDIT3,111,24,321,19
  DIALOG ADD,BUTTON,SHOW,111,347,56,19,Show !
  DIALOG SHOW

:EVLOOP
WAIT EVENT
GOTO @EVENT()

:BROWSEBUTTON
%A = @dirdlg(Select a Root Directory,,) 
if @not(@null(%A))
    DIALOG SET,EDIT2,%A
    END
GOTO EVLOOP

:SearchBUTTON
%A = @FINDFIRSTFILE(@DLGTEXT(EDIT2),@DLGTEXT(EDIT1))
REM SYNTAX %A = @FINDFIRSTFILE(<Root Path>,<File Name>)
DIALOG SET,EDIT3,%A
GOTO EVLOOP

:SHOWBUTTON
IF @EQUAL(@SUBSTR(@DLGTEXT(EDIT3),2,2),Smile
SHELL open,Explorer,/n","/select","@DLGTEXT(EDIT3)"
END
GOTO EVLOOP

:CLOSE
EXIT

REM You can include the code below in a
REM Include file or DSU.
REM You can find a file ina given directory in VDS
REM but it is difficult to search a tree for a file
REM This API is real blazing fast. Enjoy !
REM If you want to find more than one file of same
REM name then you need a different API with elaborate
REM procedure inluding callbacks.
:FINDFIRSTFILE
IF @NULL(%1)
%O = No Root path was specified
EXIT %O
END
IF @NULL(%2)
%O = No File name was pecified
EXIT %O
END
LOADLIB imagehlp
%O = @FILL(260)
%A = @LIB(imagehlp,SearchTreeForFile,INT:,STR:%1,STR:%2,@ADDR("%O"))
FREELIB imagehlp
%O = @ADJUST(%O)
IF @ZERO(%A)
 %O = File Not Found
END
EXIT %O

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension


Last edited by CodeScript on Sat Sep 06, 2003 2:43 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1054
Location: India

PostPosted: Sat Sep 06, 2003 2:38 pm    Post subject: Reply with quote

Looks great with vdstag but it has some errors:
EDIT1 -1 is given pink color.
if @equal(@substr(@dlgtext(EDIT3),2,2),:) - : takes red color?
open,Explorer,/n","/select","@dlgtext(EDIT3)" - color of quotes, comma, EDIT, explorer all are not as intended.
No Root path was specified - all are in red ?

Just a few sugesstions if it can be further improved.

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Thu Jan 15, 2004 12:33 pm    Post subject: Reply with quote

Looks as usual at this computer Confused (sorry for my late reply Confused)

Regards,
Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1054
Location: India

PostPosted: Thu Jan 15, 2004 1:46 pm    Post subject: Reply with quote

Hi Vic I think that got corrected sometime back. Now it's OK Smile
_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group