static void LabelFileExport(Args _args)
{
#File
SysLabelFile sysLabelFile;
str labelModule, labelFileName, labelLanguage;
str labelSaveAsLanguage, labelSaveAsFileName;
container labelModuleCon;
int i;
FilePath path;
FileName fileName;
path = @"D:\TempNav\LabelFiles"; // folder to export to
labelModuleCon = str2con("ASC,ASG"); // labels to export
labelLanguage = "en-us";
labelSaveAsLanguage = "en-za"; // set as "" to export with original language name
if (!strEndsWith(path, #FilePathDelimiter))
{
path += #FilePathDelimiter;
}
info(strFmt("Export path: %1", path));
for (i = 1; i <= conLen(labelModuleCon); i++)
{
labelModule = conPeek(labelModuleCon, i);
try
{
labelFileName = strFmt("Ax%1%2.ald", labelModule, labelLanguage);
if (labelSaveAsLanguage != "")
{
labelSaveAsFileName = strFmt("Ax%1%2.ald", labelModule, labelSaveAsLanguage);
fileName = path + labelSaveAsFileName;
}
else
{
fileName = path + labelFileName;
}
sysLabelFile = SysLabelFile::newFilename(labelFileName);
sysLabelFile.toFile(fileName);
if (labelSaveAsLanguage != "")
{
info(strFmt("Successfully exported label file %1 as %2", labelFileName, labelSaveAsFileName));
}
else
{
info(strFmt("Successfully exported label file %1", labelFileName));
}
}
catch
{
info(strFmt("Failed to export label file %1", labelFileName));
}
}
}
This posting is provided "AS IS" with no warranties. Use code at your own risk.
No comments:
Post a Comment