I'll start with why I need to do this. We use Creo with PDM (in addition to SWX). When you open a file in Creo that contains references, it will basically only look in that same directory for the references. It can look in other locations if you have search paths defined in a text file. We do have a search path file, but only 4 directories listed. This forces users to only store Creo files in these 4 directories and some of them have way too many files (60k+).
So I'd like a way to do this... (for these file types - .asm, .drw, .prt, .frm, .sym)
- Check the state of the text file and change the state to Work In Process if it's currently Released.
- Check out the file.
- For each directory in existing text file, search that directory for file types. If those file types are not found, then remove that line entry from the text file.
- For each directory in the vault (except those already in the text file), search directory for file types. If one of those file types is found add a line entry to the text file (and stop searching that directory).
- If the file was not changed, then undo check out; otherwise check the file in with an automatic comment.
- Change the state of the file to Released with an automatic comment.
- And if possible, force clients to get latest version of text file.
an example of each line entry in the text file
search_path 'C:\My Vault\My Directory 1'
search_path 'C:\My Vault\My Directory 2'
I'm sure I could do Step 3 and 4 this with batch script; however that would require that every file be in the cache. And considering I can't take care of the other steps with batch, I'd like to explore doing this with PDM somehow. If this could run daily or twice a day that would probably suffice.
Alternatively if it could run when moving these file types or adding new files of these types to the vault, that would probably be better.
I've done some vba coding in excel before, batch, bash, and other very minor stuff. Could anyone show me some examples of how I might accomplish some of this?