Quantcast
Channel: Adobe Community: Message List - FrameMaker Scripting
Viewing all articles
Browse latest Browse all 3715

Re: Automating an unstructured text selection into a new DITA document

$
0
0

Hello again Cronos,

 

Here is a routine I created as a function to call from almost all my scripts. This function not only allows opening an FM document without updating all kinds of stuff but also doing this as read-only and/or invisible. Note that when you have opened a FM document invisible, it will remain invisible unless you change its visibility status. In general, you should make sure you close all invisibly opened files before your script quits (even in case an error occurs).

 

 

function OpenDoc ( sFilename, sOptions )

{

          var oaOpenProps = GetOpenDefaultParams ( );

 

    if ( sOptions.match ( "invisible" ) )

    {

        i = GetPropIndex ( oaOpenProps, Constants.FS_MakeVisible );

        oaOpenProps[i].propVal.ival = Constants.FV_DoCancel;

    }

 

          i = GetPropIndex ( oaOpenProps, Constants.FS_FileIsOldVersion );

          oaOpenProps[i].propVal.ival = Constants.FV_DoOK;

 

          i = GetPropIndex ( oaOpenProps,Constants.FS_FontNotFoundInCatalog );

          oaOpenProps[i].propVal.ival = Constants.FV_DoOK;

 

          i = GetPropIndex ( oaOpenProps,Constants.FS_FontNotFoundInDoc );

          oaOpenProps[i].propVal.ival = Constants.FV_DoOK;

 

          i = GetPropIndex ( oaOpenProps,Constants.FS_RefFileNotFound );

          oaOpenProps[i].propVal.ival = Constants.FV_AllowAllRefFilesUnFindable;

 

          i = GetPropIndex ( oaOpenProps,Constants.FS_UpdateTextReferences );

          oaOpenProps[i].propVal.ival = Constants.FV_DoNo;

 

          i = GetPropIndex ( oaOpenProps,Constants.FS_UpdateXRefs );

          oaOpenProps[i].propVal.ival = Constants.FV_DoNo;

 

          i = GetPropIndex ( oaOpenProps,Constants.FS_AlertUserAboutFailure );

          oaOpenProps[i].propVal.ival = false;

 

          i = GetPropIndex ( oaOpenProps,Constants.FS_UseRecoverFile );

          oaOpenProps[i].propVal.ival = Constants.FV_DoShowDialog;

 

    if ( sOptions.match ( "readonly" ) )

    {

                    i = GetPropIndex ( oaOpenProps,Constants.FS_OpenDocViewOnly );

                    oaOpenProps[i].propVal.ival = true;

          }

    else

    {

                    i = GetPropIndex ( oaOpenProps,Constants.FS_FileIsInUse );

                    if ( sOptions.match ( "forcewritable" ) )

                    {

                              oaOpenProps[i].propVal.ival = Constants.FV_ResetLockAndContinue;

                    }

                    else

                    {

                              oaOpenProps[i].propVal.ival = Constants.FV_DoShowDialog;

                    }

          }

 

          oaRetParms = new PropVals ( );

          oDocOpen = Open ( sFilename, oaOpenProps, oaRetParms );

          return oDocOpen;

}

 

 

Good luck

 

Jang


Viewing all articles
Browse latest Browse all 3715

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>