hexagon logo

VBScript Dir command returning incomplete results

Dear experts,

I have a PC-DMIS form with a ComboBox (named fd_ifoname) which I'm trying to populate with results from a Dir() file system call by means of the following super simple VBScript in the window's initialize event:

file = Dir(".\*")
While file <> ""
    fd_ifoname.AddString file
    file = Dir()
Wend​


It's working in principle, but the thing is that the results are incomplete. In particular, I'm trying to read out the contents of a subfolder of PC-DMIS's own routines, but it's only returning two *.MiniRoutines.xml files of the 21 non-hidden files (including *.prg, *.cad, and some more *.MiniRoutines.xml files). I'm having similar issues with almost every folder on our C and D drives (two partitions of the same SSD) with most folders appearing completely empty, but on the other hand, the Dir() function seems to be working just fine when listing files from a network drive. That's all the drives I was able to test with on our cleanroom PC and, in case you're wondering, the SSD is working perfectly fine. Also, I modified the above code to force the loop to go beyond the case of file == "" just to see what might still be coming, but the results stay empty.

Has anyone of you encountered this strange behavior and know a way around it? If not, can you think of another (preferably convenient) way to read out a list of files from within a form?

Thanks everyone!
Parents
  • Thanks for your quick reply, vpt.se!

    I actually tried that at some point but forgot to mention it here. Even putting something as simple as the following into the initialize even handler fails with an unsupported scripting operation error:

    objFS = CreateObject("Scripting.FileSystemObject")
    objFolder = objFS.GetFolder("D:\PC-DMIS Data\Routines\")
    MsgBox objFolder.DateCreated​


    So I figured (maybe incorrectly) that the FileSystemObject is not supported in PC-DMIS. BTW, we're using PC-DMIS 2020 R2 SP1 in case this is relevant.
Reply
  • Thanks for your quick reply, vpt.se!

    I actually tried that at some point but forgot to mention it here. Even putting something as simple as the following into the initialize even handler fails with an unsupported scripting operation error:

    objFS = CreateObject("Scripting.FileSystemObject")
    objFolder = objFS.GetFolder("D:\PC-DMIS Data\Routines\")
    MsgBox objFolder.DateCreated​


    So I figured (maybe incorrectly) that the FileSystemObject is not supported in PC-DMIS. BTW, we're using PC-DMIS 2020 R2 SP1 in case this is relevant.
Children
No Data