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

Finding a paragraph via its format tag

Advocate ,
Jan 31, 2012 Jan 31, 2012

Hello all,

I have read and tried the Find/Replace script that was posted by Russ / Ian last year, and made some modifications to get the result that I need: finding any paragraph that has a particular paragraph format tag. It does not work and I fail to see why.

Entering the "WritersNoteText" paragraph tag in the Find function gives me plenty of hits. But using ExtendScript there is nothing, just an error code -2. Using PrintErrno translates this error code into FE_Success.

var doc = app.ActiveDoc;

var findParams = new PropVals();

var trange = new TextRange();

flow = doc.MainFlowInDoc;

frame = flow.FirstTextFrameInFlow;

trange.beg.obj = trange.end.obj = frame.FirstPgf;

trange.beg.offset = trange.end.offset = 0;

findParams = AllocatePropVals (1);

findParams[0].propIdent.num = Constants.FS_FindPgfTag;

findParams[0].propVal.valType = Constants.FT_String;

findParams[0].propVal.sval = "WritersNoteText";

FA_errno = Constants.FE_Success;

trange = doc.Find (trange.beg, findParams);

if ( FA_errno == Constants.FE_Success ) {

          doc.DeleteText( trange );

} else {

          PrintErrno ();

}

Where's the error in my code or in my thinking ?

Jang

TOPICS
Scripting
930
Translate
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

correct answers 1 Correct answer

Advocate , Jan 31, 2012 Jan 31, 2012

Strange things happening here. I restarted Windows and FM10 and the same script works... In Debra Herman's blog I found a reference to an include file for the FDK that lists at least some of the error codes - that showed that the -2 was an invalid book or document. There must have been some bad communication going on between the ESTK and FM10 when I was testing my script.

Anyway, on to the next pitfall...

Ciao

Jang

Translate
Advocate ,
Jan 31, 2012 Jan 31, 2012
LATEST

Strange things happening here. I restarted Windows and FM10 and the same script works... In Debra Herman's blog I found a reference to an include file for the FDK that lists at least some of the error codes - that showed that the -2 was an invalid book or document. There must have been some bad communication going on between the ESTK and FM10 when I was testing my script.

Anyway, on to the next pitfall...

Ciao

Jang

Translate
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