Write special folders in a data list

Find inspirations how to access the ZEN application model
Post Reply
user-4
Posts: 402
Joined: Thu Jan 01, 1970 1:00 am

Write special folders in a data list

Post by user-4 »

Code: Select all

#######################################################
## Z E N  (blue)  A P P L I C A T I O N 
##
## Macro name: Write special folders in a data list  
## Required files: none
##
## GET ALL THE SPECIAL FOLDER NAMES
## SAVE FOLDER NAMES IN A DATA LIST
## 
#######################################################
##
##
## Remove all open documents
Zen.Application.Documents.RemoveAll()
##
## Create new table with 2 col with Folder and Name
table = ZenTable("MyTable")
table.Columns.Add('Folder',str)
table.Columns.Add('Name',str)
Zen.Application.Documents.Add(table)
##
## Get all folder data, write folder data in data list
r = 0
for i in range(0,14):
    table.Rows.Add()
    if i == 0: 
        Images = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.Images)
        table.SetValue(r,0,'Images')
        table.SetValue(r,1,Images)
    if i == 1: 
        Program = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.Program)
        table.SetValue(r,0,'Program')
        table.SetValue(r,1,Program)
    if i == 2: 
        ProgramDocuments = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.ProgramDocuments)
        table.SetValue(r,0,'ProgramDocuments')
        table.SetValue(r,1,ProgramDocuments)
    if i == 3: 
        ProgramTemplates = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.ProgramTemplates)
        table.SetValue(r,0,'ProgramTemplates')
        table.SetValue(r,1,ProgramTemplates)
    if i == 4: 
        ProgramResources = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.ProgramResources)
        table.SetValue(r,0,'ProgramResources')
        table.SetValue(r,1,ProgramResources)
    if i == 5: 
        Documents = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.Documents)
        table.SetValue(r,0,'Documents')
        table.SetValue(r,1,Documents)
    if i == 6: 
        UserData = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.UserData)
        table.SetValue(r,0,'UserData')
        table.SetValue(r,1,UserData)
    if i == 7: 
        UserDocuments = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.UserDocuments)
        table.SetValue(r,0,'UserDocuments')
        table.SetValue(r,1,UserDocuments)
    if i == 8: 
        UserTemplates = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.UserTemplates)
        table.SetValue(r,0,'UserTemplates')
        table.SetValue(r,1,UserTemplates)
    if i == 9: 
        WorkgroupData = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.WorkgroupData)
        table.SetValue(r,0,'WorkgroupData')
        table.SetValue(r,1,WorkgroupData)
    if i == 10: 
        WorkgroupDocuments = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.WorkgroupDocuments)
        table.SetValue(r,0,'WorkgroupDocuments')
        table.SetValue(r,1,WorkgroupDocuments)
    if i == 11: 
        WorkgroupTemplates = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.WorkgroupTemplates)
        table.SetValue(r,0,'WorkgroupTemplates')
        table.SetValue(r,1,WorkgroupTemplates)
    if i == 12: 
        ImageAutoSave = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.ImageAutoSave)
        table.SetValue(r,0,'ImageAutoSave')
        table.SetValue(r,1,ImageAutoSave)
    if i == 13: 
        CameraStreaming = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.CameraStreaming)
        table.SetValue(r,0,'CameraStreaming')
        table.SetValue(r,1,CameraStreaming)
    r = r + 1
##
## Save data table
table.Save('C:\\OAD\\Output\\CSV Tables\\FolderData.csv')
##
#######################################################
Post Reply