Hey Glenn,
This Macro works great but I want to create a few If Else statements in here. I am trying to get the macro to decide which folder to place the file in. For example I have folders for each specific job. 6XXXX, 6AXXX, 6BXXX and so on. Right now this macro below will create only a 6XXXX folder and even if the part number is 6HXXX. It creates a directory like:
C:\Users\zwalker\Desktop\PROGRAMMED ELECTRODES\6XXXX\6H809\B Electrodes.
And I want it to create a directory like this:
C:\Users\zwalker\Desktop\PROGRAMMED ELECTRODES\6HXXX\6H809\B Electrodes.
In the past I have just simply replaced STRING X4 = "XXXX" with STRING X4 = "AXXX" or STRING X4 = "BXXX" but I would rather not have a bunch of the same macro buttons on my ribbon when I could have one macro that does the deciding for me.
I want to be able to have PMILL Create a folder or if it exists already just get into the correct folder to create the correct save path. I will post pictures below to hopefully better describe the scenario. I am not sure what terms I need to use to make this macro look at the line 16 (below) and have the macro determine whether this is an A, B, C, D or just another number.
STRING PATH2 = Substring("$ModelName", 1, 1)
Hopefully this makes sense to you as to what I am trying to accomplish. Thank you!

STRING LIST models = {}
FOREACH md IN FOLDER('model') {
IF position($md.name, "Planes") == -1 {
INT k = add_last($models, $md.name)
}
}
STRING ModelName = ''
IF size($models) == 1 {
$ModelName = $models[0]
} ELSE {
$ModelName = INPUT ENTITY MODEL "Choose model"
}
//Disect Model Name
STRING PATH1 = Substring("$ModelName", 0, 1)
STRING PATH2 = Substring("$ModelName", 1, 1)
STRING PATH3 = Substring("$ModelName", 0, 5)
STRING PATH4 = Substring("$ModelName", 6, 1)
STRING X4 = "XXXX"
STRING X3 = "XXX"
STRING ELECTRODE = $PATH4 + " Electrodes"
//Output path
STRING PATH0 = "C:\Users\zwalker\Desktop\Programmed Electrodes\" + $PATH1 + $X4 + "\" + $PATH3 + "\" + $ELECTRODE + "\" + $ModelName
STRING SaveAs = $PATH0
//if project already exist, just save it.
IF dir_exists($saveas) {
PROJECT SAVE
//if project doesn't exist, save it as modelname in model location
} ELSE {
BOOL NameCheck = FALSE
STRING $Question = "Is this path and modelname correct?" +CRLF+ $saveas
$NameCheck = QUERY $Question
IF $NameCheck {
PROJECT SAVE AS $saveas
STRING $Message = "Project has been saved in" +CRLF+ $saveas
MESSAGE INFO $Message
}
}