I am trying to create a template for our team that is as fool-proof as possible. In one of my methods, I use the 'writeExcelFile' method to export data from the model. For organization purposes, I have the file saved into a sub-directory in which the model exists. This works fine as long as that sub-directory was already created before the code is executed.
My question is this, is there a way with SimTalk to create a sub-directory in windows if it doesn't already exist? I've combed through the forum and the help file and haven't found any such tool.
Any help would be greatly appreciated. Thank you!
Solved! Go to Solution.
you could try the command system; with system you can send operation system commands
So you could try to change in your directory; if this fails system returns 1. In this case you create the directory e.g.
if system("cd d:\\data1") = 1 then
freelance simulation specialist
You can also do something like the following to do the same without any pop up windows being shown.
var saveLocation: String := copy(modelFile, 1, strRpos("\\", modelFile)) + "Data1"
if NOT existsFile(saveLocation)
startExtProc(To_Str("cmd.exe /C mkdir \"", saveLocation, "\""), false, true)
Oh ok, normally when running stuff with the System command it shows me a pop up window while it is running. Guess what is running is so quick that you cant see it.