OSDN Git Service

20021009版ソース
[seraphyscrtools/SeraphyScriptTools.git] / TestScript / tree1.vbs
1 '---------------------------------------------------
2\83c\83\8a\81[\83r\83\85\81[\82Ì\8dì\90¬\97á
3 '---------------------------------------------------
4 option explicit
5
6\83N\83\89\83X\82ð\90\90¬\82·\82é
7 dim obj,fso
8 set fso = CreateObject("Scripting.FileSystemObject")
9 set obj = new mainframe
10
11 '----------------------------------------------------
12\83\81\83C\83\93\83t\83\8c\81[\83\80\82Ì\90\90¬\82Æ\83C\83x\83\93\83g\82ð\82¤\82¯\82é\83N\83\89\83X\82Ì\92è\8b`
13 class mainframe
14         public instance
15         public tree
16         public sub class_initialize
17                 set instance = createobject("seraphyscripttools.instance")
18                 with instance.mainframe
19                         .classobject = me
20                         with .form
21                                 set tree = .TreeView(5,5)
22                         end with
23                         .defaultaction = false
24                         .open "\83c\83\8a\81[\83r\83\85\81[\82Ì\83e\83X\83g"
25                         .SetMenu "/\83R\83}\83\93\83h(&C),\83t\83H\83\8b\83_\82ð\8ew\92è\82·\82é(&S)@OnStart:\8fI\97¹(&X)@OnExit"
26                         .domodal
27                 end with
28         end sub
29
30         public sub OnSize
31                 dim w,h
32                 with instance.mainframe
33                         w = .clientWidth
34                         h = .clientHeight
35                 end with
36                 tree.SetPlacement 0,0,w,h
37         end sub
38
39         public sub OnExit
40                 instance.mainframe.quit = true
41         end sub
42
43         public sub OnStart
44                 dim dirname,item,folder
45                 dirname = instance.dialog.browseforfolder
46                 if(len(dirname) > 0) then
47                         item = null
48                         set folder = fso.GetFolder(dirname)
49                         EnumFolder folder,item
50                 end if
51         end sub
52
53         private sub EnumFolder(folder,item)
54                 dim dirname,subfolder,childitem
55                 dirname = folder.name
56                 set childitem = tree.CreateChild ( dirname,item )
57                 childitem.object.Value("path") = folder.path
58                 for each subfolder in folder.subfolders
59                         EnumFolder subfolder,childitem
60                 next
61         end sub
62 end class