Just today I saw your request, you must enter your directory replacing where I will leave it demarcated. "mainDirectory"
// Initializing some variables
RESET LOCALVARS
STRING mainDirectory = dirname(project_pathname(0), "/")
STRING LIST foldersPathList = list_files("dirs", mainDirectory)
// looping over folders
BOOl matchFound = 0
WHILE (True) {
// Asking the user to choose a folder to "Save As" the project into
INT C = INPUT CHOICE $foldersPathList "Choose a folder: "
STRING choosenFolderPath = foldersPathList[C]
STRING choosenFolderName = basename(choosenFolderPath, "/")
STRING queryMsg = "The choosen folder: " + choosenFolderName + crlf + "Yes = Confirm" + crlf + "No = Choose a Sub-Folder"
$matchFound = Query $queryMsg
// Asking the user whether to confirm the choosen folder or explore sub-folders
// If the user confirms the choice, then, the macro "Save As" the project using the model name & current date
IF ($matchFound) {
OBJECT time = local_time(time())
STRING currentDate = time.day + "-" + time.month + "-" + time.year
ENTITY LIST myModel = folder("Model")[0]
STRING projectSaveName = myModel.Name + "_" + currentDate
CD $choosenFolderPath
PROJECT SAVE AS $projectSaveName
BREAK
} ELSE {
$foldersPathList = list_files("dirs", choosenFolderPath)
IF is_empty(foldersPathList) {
MESSAGE ERROR "There is no sub-folder in (" + choosenFolderName + ")"
MACRO ABORT
}
}
}