map_X_to_Y.btm: error btm1023: Exception Caught: Object reference not set to an instance of an object.
What I had done was copied a map from one project to another. I had either not copied the schema, or I had copied the map to a different folder where it couldn’t find one of the referenced schemas. So either I moved the map or added the missing schema, and all was well.
At first I was focusing on Functoids and possible logic errors, but then I expanded the schema(s) on the left, and noticed the following:
You can see in the picture above that InputMessagePart_0 was missing the schema.
I recently showed a VBScript to Archive/Move xml files to a subfolder. This is often needed when you have been archive or storing 1000s of XML files, and the the directory/folder is very slow to open due to the large number of files. Now, we will do it in Powershell.
Create the subfolders ahead of time. With some minor improvements we could do that in the code, but I was in a hurry today when I needed this…
This does the following:
1) Select all files starting with “201604” (in my case, the files began with yyyymmdd.
2) pipe that into a ForEach loop
3) Run the “Move” commandlet
4) the filename in the loop is the $_ symbol
5) Then you build the destination directory $_ again is the iterator of the loop, i.e. the FileName object, so we can get it’s directory and “Name”. There, we insert the 2016_xx for the month.
So yes, you can make this a lot fancier, but it’s a start…
I had a .bat file with 50 lines or more, and many of them had disk paths. We were migrating this to production, so I did “replace all” commands to change all the paths to production SAN/Server names. But then, I knew some of the paths existed, and some didn’t. So I wanted to find all the paths that didn’t exist, so either:
1) I could fix the filename, or
2) Create the path on the disk
So I needed to parse the file looking for file/path names. At first I tried RegEx, but then decided that just using “Split” was faster in my case. (Sometimes you just want to get the job done in the shortest amount of time.)
The following works when you have a prefix on each directory path. I’m sure there are variations you could make on this depending on your filenames. I’m only looking for lines that have .exe, because the .bat file is running various C# program to process the files.
Sample file Test.bat:
line1 Small.exe \\MyServer\Messages\Dir1 and more words
line2 Biggertest2.exe \\MyServer\Messages\Dir1 parm2 \\MyServer\Messages\Dir2 parm4