[Date Prev][Date Next] [Thread Prev][Thread Next]
[Date Index] [Thread Index] [New search]

Re: Not for the faint of heart: Text Inset Problem



Hello Framers,

Thanks for the suggestions on solving this problem. I still haven't figured
how it the <TextInsetLocked Yes> gets set, but for you FrameScript users,
here is a script that will clear up the problem. It saves the active
document as MIF, changes <TextInsetLocked Yes> to <TextInsetLocked No>,
saves, and reopens the file.

Rick Quatro
Carmen Publishing
716 659-8267
rick@frameexpert.com
http://www.frameexpert.com

If ActiveDoc = 0
  MsgBox 'There is no active document.    ';
  LeaveSub;
Else
  Set vCurrentDoc = ActiveDoc;
EndIf

// Store the current document name.
Set vCurrentName = vCurrentDoc.Name;

Run ParseDocName vName(vCurrentDoc.Name);
// Save the current document as MIF.
Save Document DocObject(vCurrentDoc)
  File(vPath+DIRSEP+vFile+'.mif') FileType(SaveFmtInterchange);

// Open the MIF file as text.
Open Document File(vPath+DIRSEP+vFile+'.mif') NewVar(vMif)
  ForceOpenAsText(True) MakeVisible(False);

// Change the string in the MIF file.
Find String('<TextInsetLocked Yes>') InObject(vMif.MainFlowInDoc)
  ReturnRange(vRange) ReturnStatus(vFound);
Loop While(vFound)
  Delete Text TextRange(vRange);
  New Text TextLoc(vRange.Begin) '<TextInsetLocked No>';
  Find String('<TextInsetLocked Yes>') InObject(vMif.MainFlowInDoc)
    Start(vRange.Begin) ReturnRange(vRange) ReturnStatus(vFound);
EndLoop

// Save the document as text and close it.
Save Document DocObject(vMif) FileType(SaveFmtText);
Close Document DocObject(vMif) IgnoreMods;

// Close the original FrameMaker file.
Close Document DocObject(vCurrentDoc) IgnoreMods;

// Open the MIF and save it as a FrameMaker document.
Open Document File(vPath+DIRSEP+vFile+'.mif') NewVar(vMif)
  MakeVisible(False) AlertUserAboutFailure(False);
Save Document DocObject(vMif) File(vCurrentName)
  FileType(SaveFmtBinary);
Close Document DocObject(vMif) IgnoreMods;

// Open the original document.
Open Document File(vCurrentName) NewVar(vCurrentDoc)
  AlertUserAboutFailure(False);

Sub ParseDocName
// ParseDocName takes a document name and returns the following variables:
// "vPath" is the pathname only, "vFile" is the filename only; and "vExt"
// is the file extension only.
//
Find String(DIRSEP) InString(vName) Back ReturnPos(vSlashPos);
Get String FromString(vName) StartPos(0) EndPos(vSlashPos-1)
  NewVar(vPath);
Get String FromString(vName) StartPos(vSlashPos+1)
  NewVar(vFileExt);
Find String('.') InString(vFileExt) Back ReturnPos(vDotPos)
  ReturnStatus(vFound);
If vFound
  Get String FromString(vFileExt) EndPos(vDotPos-1) NewVar(vFile);
  Get String FromString(vFileExt) StartPos(vDotPos+1) NewVar(vExt);
Else
  Set vFile = vFileExt;
  Set vExt = '';
EndIf
//
EndSub



** To unsubscribe, send a message to majordomo@omsys.com **
** with "unsubscribe framers" (no quotes) in the body.   **