Skip to main content
Participant
August 5, 2022
Question

Script to open file

  • August 5, 2022
  • 0 replies
  • 117 views

I just want to share with the community scripts that I have created

var propsToOpen = [
    {ask: Constants.FS_AlertUserAboutFailure, select: false},
    {ask: Constants.FS_DisallowMIF, select: false},
    {ask: Constants.FS_DisallowXml, select: false},
    {ask: Constants.FS_FileIsInUse, select: Constants.FV_ResetLockAndContinue},
    {ask: Constants.FS_BookIsInUse, select: Constants.FV_ResetLockAndContinue},
    {ask: Constants.FS_LockCantBeReset, select: Constants.FV_DoOK},
    {ask: Constants.FS_FileIsOldVersion, select: Constants.FV_DoOK},
    {ask: Constants.FS_FontChangedMetric, select: Constants.FV_DoOK},
    {ask: Constants.FS_FontNotFoundInCatalog, select: Constants.FV_DoOK},
    {ask: Constants.FS_FontNotFoundInDoc, select: Constants.FV_DoOK},
    {ask: Constants.FS_LanguageNotAvailable, select: Constants.FV_DoOK},
    {ask: Constants.FS_OpenAsType, select: Constants.FV_AUTORECOGNIZE},
    {ask: Constants.FS_UpdateTextReferences, select: Constants.FV_DoNo},
    {ask: Constants.FS_UpdateXRefs, select: Constants.FV_DoNo},
    {ask: Constants.FS_UseRecoverFile, select: Constants.FV_DoNo},
    {ask: Constants.FS_UseAutoSaveFile, select: Constants.FV_DoNo},
    {ask: Constants.FS_OpenFileNotWritable, select: Constants.FV_DoOK},
    {ask: Constants.FS_RefFileNotFound, select: Constants.FV_DoOK}
];

//Metodo para setear las propiedades y abrir archivo en el framemaker
 function OpenFile(path) {
    props = GetOpenDefaultParams();
    for(var i=0; i < propsToOpen.length; i++)
    {
        var index = GetPropIndex(props, propsToOpen[i].ask);
        if(index > -1)
            props[index].propVal.ival = propsToOpen[i].select;
    }

    var returnp = new PropVals();
    return Open(path, props, returnp);
}

OpenFile("C:\\Users\\USUARIO\\Documents\\framemakerfile.fm");

 

This topic has been closed for replies.