Jump to content
Macro Express Forums

Strange Folder List Refresh Problem


Cory
 Share

Recommended Posts

Setup: I have a macro that creates a text file listing all the folders in a specific folder on the file server. It also does some minor massaging and exclusions as it goes so it can be linked to in an Access database. All super simple and not enough to cause a problem. I use it to make sure there is an appropriately named folder for each client.

 

Problem: This has been working great until just a little bit ago and now changes to the folder names, additions and such, are not being realized by ME. For instance if I add a folder and rerun the macro it doesn’t appear in the text file list. I check manually and the folder is there.

 

Other weirdness: I don’t think this is ME’s fault. You see this is an old Windows 2000 server that’s a bit slow and way over tasked. I have noticed that if I have an explorer window open and do a search that same folder won’t appear n the search results. But I can open a new Explorer window next to it and see the folder clearly! Also in the past I’ve had instance where I’ve searched for a file and not been able to find it and later I could find it no problem even though nothing has changed.

 

Question: Has anyone heard of this and if yes how can I get around this problem? Also is there something I can do in ME to get it to see these files? Is it possible that ME has some sort of cache of folder names that needs to be cleared before I rerun? Like I say I don’t think this is a ME problem per se but any advice would be very welcome.

 

One last thing: If any developers read this it might be helpful to get a description of how ME accesses folders and files. What I mean is that obviously opening a folder in Windows Explorer will yield the correct result and the search does not which leads me to beleive that ME is using somethign more like the search mechanism to get directory listings. Could aid in troubleshooting to know where it gets its info from.

Link to comment
Share on other sites

The Repeat with Folder command uses Windows API calls to get the list of folders. Windows maintains a cache containing the list of folders (and files). The Windows APIs return the content of the cache. If Windows hasn't updated the list of folders, then Macro Express will not receive the updated list.

 

From time to time I have seen cases where a folder (or filename) does not exist in Windows Explorer. Because of this I have developed the habit of pressing the F5 key to refresh Explorer.

 

We should also note that folders added when the Repeat with Folder command has already started will likely not be listed by the macro.

 

One possible work-around would be to force Windows to refresh the list of files and folders. This, however, takes time. If we could tell when the cache is not up to date then we could only force the update then. However, there isn't a way to determine this in Macro Express. Nor is there a straight-forward way to force the refresh.

 

You might be able to force a refresh by doing the Repeat with Folder command twice like this:

Repeat with Folder
Repeat End

Repeat with Folder
 // Do your macro stuff here
Repeat End

We are unsure whether this will work. If you try it, please report back with the result.

 

Another possibility would be to use either the Open Folder or Open Folder in Explorer to open an explorer window and then do a Text Type: F5 to do a refresh.

Link to comment
Share on other sites

This tracks with what I was seeing. However I thought my problem was worse than it was and there was another problem of my own making that was leading me to believe that the problem was more persistent than it was. I was trying to refresh as you suggested and thought it wasn't working but I was an idiot. For what I'm doing an F5 will work fine. In fact I can do it manually. But it is odd that Windows would show a folder in one Explorer window and the search in another can't find it! However the server is old and slow and sometimes it gets difficult. With the new server it should go away.

 

Thanks again for the technical description, it’s good to know for the future.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...