Hey Hoping someone might know why this doesn’t work. For some reason, I can only read the file names in the folder if I hardcode the folder name. If I use the variable it doesn’t work.
[RoutineDef, ListFiles,
[VarSet, folderName, "C:\Program Files\Maxon ZBrush 2022\ZStartup\ZPlugs64\TrigonToolbox\ViewSets\Presets\DataFiles"]
[VarSet, folderName, "ZBRUSH_ZSTARTUP\ZPlugs64\TrigonToolbox\ViewSets\Presets\DataFiles"]
[VarSet,fileIndex,0]
[VarSet,folderIndex,0]
[VarSet,fileCount,[FileExecute,[Var,dllPath],"GetFileNumber",folderName]]
[VarSet,err,[FileExecute,[Var,dllPath],"OpenFolder",folderName]]
[If,err,[Note,"Error opening folder."][Exit]]
//create a memblock to get the file name
[MemCreate,ZFileUtils_list, 256, 0]
[Loop,fileCount,
[VarSet,err,[FileExecute,[Var,dllPath],"GetFile",,,ZFileUtils_list]]
[If,err,[LoopExit]]
[MemReadString, ZFileUtils_list,fileName]
[VarSet,isaFile,0]
[RoutineCall,CheckIsFile,isaFile,fileName]
[If,isaFile,
[VarSet, gFileList(n), fileName]
]
,n]
[MemDelete,ZFileUtils_list]
[VarSet,err,[FileExecute,[Var,dllPath],"CloseFolder",folderName]]
,folderName]
When I run it with just the first VarSet folder the hardcoded one it works. If I just do it with the second one it doesn’t work.
But all the other stuff I script this way is working fine for example
[RoutineCall, WriteTextToFile, [StrMerge, “ZBRUSH_ZSTARTUP\ZPlugs64\TrigonToolbox\ViewSets\Presets\DataFiles”, working, “.txt”]]
Is working fine it’s creating the file where it should be