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
  • One more question to which I can't seem to find an answer despite an extensive search: Is there a method to add entries to a combobox in a way that also includes the index number and not just the string? I believe I would need that to preselect a certain entry and, in addition to that, it would make communicating with PC-DMIS so much easier.
Reply
  • One more question to which I can't seem to find an answer despite an extensive search: Is there a method to add entries to a combobox in a way that also includes the index number and not just the string? I believe I would need that to preselect a certain entry and, in addition to that, it would make communicating with PC-DMIS so much easier.
Children