Sunday, March 11, 2012

Using SimpleOpen() without User Interaction

SimpleOpen() can be called interactively or without user interaction. This distinction makes a difference if you are dealing with files that have issues.

If you are calling SimpleOpen() interactively, the user decides what to do when there are missing fonts, locked files, or other problematic situations.

If you call SimpleOpen() without user interaction FrameMaker defaults to very conservative behavior.
I created a simple a test to demonstrate this behavior. I cobbled together a set of files, each with a distinct issue, and put those files into a FrameMaker book. Each of my four files has one of the following issues:
  • It is locked.
  • It contains missing graphics.
  • It uses unavailable fonts.
  • It is in an older FrameMaker version.
Opening these files from the user interface brings up a dialog that allow the user to proceed or abort the open. Opening these files using the following code produces no user interaction and only one of the files opens: the locked file is opened in view only mode.

doc = SimpleOpen(compName, false);

2 comments:

  1. I tried to use this to open a document, but it seems to always return an invalid object. I did this:

    var FactsFile =File("C:\\table.fm");
    var doc = SimpleOpen (FactsFile,false) ;

    But if I check the "doc" to see if its valid, it is not.

    if (doc.ObjectValid()) {
    $.writeln("doc invalid");
    }

    Any idea as to what I am doing wrong. I also tried SimpleOpen with true an selected the doc and it still says its invalid.

    Thanks

    ReplyDelete
    Replies
    1. The first thing to check is whether you file opens from the UI without any dialog box coming up. If there are font issues, missing graphics or the like. SimpleOpen() won't open it. Also, check FA_errno. That should tell you why it did not open.

      Delete