• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Conversion to Extends Script from FrameScript

New Here ,
Jul 04, 2019 Jul 04, 2019

Copy link to clipboard

Copied

Hi, I want to convert my frameScript code into extends script. And as we know in frameScript most of the functions are predefined and i am not able to find the alternate of those function in ExtendScript
Please find my frameScript below

Set PlatformEncodingMode = True;

Set Displaying = 0;

Execute Fc KbdMinimize;

Set gvBookName       = Arg1;

Set gvMarkerFileName = Arg2;

Open Book File (gvBookName) NewVar(bookobj)

               BookIsInUse(ResetLockAndContinue)    

               FileIsInUse(ResetLockAndContinue)

               RefFileNotFound(Cancel)

               UpdateXRefs(No)

               ReturnFilename(returnFilename)

               FontNotFoundInDoc (OK)

               FileIsOldVersion (OK)

               AlertUserAboutFailure(False);

    Set ActiveBook = bookobj;

    write console 'book path'+returnFilename;

   Run eSys.ExtractPathName FullPath(returnFilename) NewVar(Pathname);

    Open Document File (Pathname+'2.CompilerProfile.fm') NewVar(docobj)

                       BookIsInUse(ResetLockAndContinue)    

                       FileIsInUse(ResetLockAndContinue)

                       RefFileNotFound(Cancel)

                       UpdateXRefs(No)

                       ReturnStatus(gvErrorList)

                       FontNotFoundInDoc (OK)

                       FileIsOldVersion (OK)

                       AlertUserAboutFailure(False);

    If ErrorCode = 0

       eStr.SaveToTextFile{' ', gvMarkerFileName};

        Set vDoc = ActiveDoc;

        Set vMarker = vDoc.FirstMarkerInDoc;

        Loop While (vMarker)

            If vMarker.MarkerTypeId.InvariantName = 'AutoEdoc'

                Find String ('ds2mif') InString(vMarker.MarkerText) ReturnStatus(gvfound);

                If gvFound = 1

                    Set tmp = eStr.ReplaceAll{vMarker.MarkerText, 'CR LF', ''};

                    Set vMarkerText = '{' + tmp  + '} ';

                    Write Console 'The current marker is '+vMarkerText;

                    Set gvIntVal = eStr.SaveToTextFile{vMarkerText, gvMarkerFileName, 'APPEND'};

                EndIf

            EndIf

            Set vMarker = vMarker.NextMarkerInDoc;

        EndLoop

        Close Document DocObject(docobj) IgnoreMods;

   EndIf

Close Book BookObject(bookobj) IgnoreMods;

Quit Session;

The highlighted texts are the built-in function in FrameScript my question is are the same in extendScript as well?

I am very new at extendScript. Can anyone suggest me how can I write this script into ExtendScript?


Also, anyone has any study material in this please share it with me at my email: manish13102373@gmail.com.

Thanks,
Manish

TOPICS
Scripting

Views

919

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 05, 2019 Jul 05, 2019

Copy link to clipboard

Copied

Quitt Session => app.Close

For other file related issues use File object, to work with filenames and writing text

Markus

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 07, 2019 Jul 07, 2019

Copy link to clipboard

Copied

Okay But i want to run this script via command line and i have to open the frammaker file and then read all the markers, put their text into a txt file and then close it
is it possible in extendScript. Please suggest me some study material for extendScript.


Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 09, 2019 Jul 09, 2019

Copy link to clipboard

Copied

Hi,

you can implement an event driven script, with listens to Constants.FA_Note_PostOpenDoc/FA_Note_PostOpenBook.

You can register events with

Notification(Constants.FA_NotePostOpenDoc, true)

and listen to events with

function notify(note, object, sparam, iparam)

{

//your code

}

(more Information see https://help.adobe.com/en_US/framemaker/pdfs/framemaker_scripting.pdf on page 82)

Then you start FM with FM-book/-document as first Parameter, do what you want to do, and close document an session again.

Side note: the FM EULA doesn't allow to fully automate stuff without user interaction. please check if EULA works with these scenarios.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 09, 2019 Jul 09, 2019

Copy link to clipboard

Copied

Hi

I tried Notification function but getting an error that notfication function is not defined
Do we have to import any function here?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 10, 2019 Jul 10, 2019

Copy link to clipboard

Copied

Put this at the top of your script:

#target framemaker

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 24, 2019 Oct 24, 2019

Copy link to clipboard

Copied

LATEST

I've started putting this in the top of my files instead, so that it is compatible with Visual Studio Code. It also seems to be compatible with Adobe Extendscript Toolkit:

 

 

//@target framemaker

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines