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 


Drag n Drop folder and filter out specific file types

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code
View previous topic :: View next topic  
Author Message
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Tue Jun 04, 2002 4:24 pm    Post subject: Drag n Drop folder and filter out specific file types Reply with quote

Hi,

This piece of code was done completly by LiquidCode (Thanks to him by the way). All credits goes to him of course...

Enjoy!




Code:
rem This code lets you Drag and Drop a folder (just one but it
   rem can easily be modified for more than one) and list all
   rem the directories and files within that folder. It also
   rem has a file filter to filter out a specific file (only one
   rem file type can be filtered, but it can be modified for more
   rem than one type)
   title Drag and Drop Folder - by Chris Gingerich
   dialog CREATE,Drag and Drop Folder - by Chris Gingerich,-1,0,349,286,DRAGDROP
   dialog ADD,LIST,LIST1,29,8,330,244
   dialog ADD,TEXT,TEXT1,4,10,108,13,Drag and Drop a folder
   dialog ADD,TEXT,TEXT2,6,160,44,13,File Filter:
   dialog ADD,EDIT,EDIT1,4,208,100,19,*.*
   dialog SHOW

:evloop
   wait event
   goto @event()

:close
   stop

:dragdrop
   list create,1
   list dropfiles,1
   %%dir = @item(1)
   list close,1
   if @dlgtext(edit1)
      %%filter = @dlgtext(edit1)
   else
      %%filter = *.*
   end
   list clear,list1
   gosub Dirs
   gosub Files
   goto evloop

:Dirs
   if %%dir
      list CREATE,1
      list CREATE,2
      list CREATE,3,SORTED
      list FILELIST,1,%%dir*.*,D
      if @greater(@count(1),0)
         %x = 0
         repeat
            list CLEAR,2
            list FILELIST,2,@item(1,%x)\*.*,D
            if @greater(@count(2),0)
               %%x2 = 0
               repeat
                  list ADD,1,@item(2,%%x2)
                  %%x2 = @succ(%%x2)
               until @equal(%%x2,@count(2))
            end
            %x = @succ(%x)
         until @equal(%x,@count(1))
      else
         list ADD,1,%%dir
      end
      list ASSIGN,3,1
      list CLOSE,1
      list CLOSE,2
   end
   exit

:Files
   if @greater(@count(3),0)
      list CREATE,1
      list CREATE,2,SORTED
      %c = @count(3)
      %x = 0
      repeat
         list CLEAR,2
         list FILELIST,2,@item(3,%x)"\"%%filter
         if @greater(@count(2), 0)
            %%x2 = 0
            repeat
               list ADD,1,@item(2,%%x2)
               %%x2 = @succ(%%x2)
            until @equal(%%x2, @count(2))
rem ** Unremark the next 2 lines to have the Dirs listed as well **
rem         else
rem            list ADD,1,@item(3,%x)
rem ***************************************************************
         end
         %x = @succ(%x)
      until @equal(%x,%c)
      list ASSIGN,3,1
      list CLOSE,1
      list CLOSE,2
      list assign,list1,3
   end
   list close,3
   exit
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 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