Skip navigation
heatherb555
Currently Being Moderated

FM Doesn't Cut it Out...

Apr 6, 2012 6:45 AM

Tags: #framemaker10 #extendscript

Hi everyone,

 

I have a script that formats tables that are imported as RTF. Everyone on my team loves it, but it doesn't work for one colleague.

 

Part of the script cuts the first row of the table, adds a heading row, and then pastes into that heading row. The problem for my colleague is that it's pasting whatever is on his clipboard before he ran the script. So, in essence, it's not doing the cut properly.

 

I thought it might be related to his INI file, but when I took his file and used it as my own, I didn't have any trouble.

 

Are there any other environmental settings that would prevent the CUT operation from working properly?

 

Thank y'all!!!

Heather A

 

**Also, if anyone is interested in the script, I'm happy to share. Just let me know.

 

Here's the code that handles the cutting and pasting just in case I'm doing something dumb and it just happens to be working for some people:

 

     //Get the number of columns, but remember to subtract 1 for

                         //MakeTblSelection function which indexes from 0.

                         var num_columns = textItems[i].obj.TblNumCols -1;

                        

                     

                         //Add a new row to be used as the heading row

                         var row = textItems[i].obj.FirstRowInTbl;

                         row.AddRows(Constants.FV_Heading, 1); //Adds a heading row

                        

                                        

                       

                         //These 4 lines, select the now second row and cut it to the clipboard.

                         //This row was the original header row from the Word table.

                         //Next, paste the information to the new heading row

                         textItems[i].obj.MakeTblSelection(1, 1, 0, num_columns);

                         doc.Cut(Constants.FF_CUT_TBL_CELLS);

                                                               

                         textItems[i].obj.MakeTblSelection(0, 0, 0, num_columns);

                         doc.Paste(Constants.FF_REPLACE_CELLS);

                         var row = textItems[i].obj.FirstRowInTbl;

                        

                         //These two lines resize the table so that it fits into the 6.47 in  page.

                         scaledColWidths = scaleTblMetrics(textItems[i].obj, targetTbleWidth);

                         textItems[i].obj.TblColWidths = scaledColWidths;                        

                        

                         ApplyTableFormat(textItems[i].obj, doc);

                         ApplyTableTitle(textItems[i].obj,doc);

                         ApplyCellHeadingParaTag(textItems[i].obj, "CellHeading");

                    //     AdjustWidth(textItems[i].obj,doc);

                        

                         ApplyFullTableParaTag(textItems[i].obj, FullTablePgfTag);                        

                        

                        cntTables++;

 
Replies
  • Currently Being Moderated
    Apr 6, 2012 11:05 AM   in reply to heatherb555

    Hi Heather,

     

    You need to use the PushClipboard and PopClipboard commands. Here is the sequence you use:

     

    PushClipboard;

    Cut (or Copy)

    ...

    Paste

    PopClipboard;

     

    Here are the descriptions for the commands:

     

    Void PushClipboard ([: Void]) Pushes the current Clipboard contents onto the Clipboard stack.The method is useful if you want to use Clipboard functions, such as Copy() or Cut(), without losing the Clipboard’s original contents.

    On failure, the method assigns the following value to FA_errno:

    Error

    Reason

    Constants.FE_Transport (-1)

    A transport error occurred.

     

    int PopClipboard ([_: Void]) Pops the Clipboard stack, moving the entry on the top of the stack to the Clipboard.

    The method returns FE_Success on success. On failure, the method sets FA_errno to one of the following values:

    Error

    Reason

    Constants.FE_Transport (-1)

    A transport error occurred.

    Constants.FE_BadOperation (-27)

    Clipboard stack is empty.

     

    Rick Quatro

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points