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

How to cope with "undefined is not an object" ?

Community Expert ,
Feb 09, 2015 Feb 09, 2015

Copy link to clipboard

Copied

I'm tiptoeing towards a solution, but stepped on a thumbtack:

The following snippet creates an error in the function GetTplParams

var template = "DDD-BibFM-tpl.fm";  // located in script-dir var outFile  = "DDD-BibFM.fm";      // located in the source dir   oDoc = OpenTemplate (); alert ("Is template open now?"); function OpenTemplate () {   var tplDir, tplFile, openParams, openReturnParams, oFile;   tplFile = "E:\\_DDDprojects\\FM+EN-escript\\escript\\DDD-BibFM-tpl.fm" // SimpleOpen does not take the tplFile, but opens the dir of the active document //  oFile = SimpleOpen (tplFile, true);   openParams = GetTplParams ();    openReturnParams =  new PropVals();    oFile = Open (tplFile, openParams, openReturnParams);    return oFile; }   function GetTplParams() {  // =>>> "undefined is not an object" on line 22 var params, i;  // Change the params   i = GetPropIndex(params, Constants.FS_RefFileNotFound);    params.propVal.ival = Constants.FV_AllowAllRefFilesUnFindable;    i = GetPropIndex(params, Constants.FS_FileIsOldVersion);    params.propVal.ival = Constants.FV_DoOK;    i = GetPropIndex(params, Constants.FS_FontNotFoundInDoc);    params.propVal.ival = Constants.FV_DoOK;    i = GetPropIndex(params, Constants.FS_LockCantBeReset);    params.propVal.ival = Constants.FV_DoOK;    i = GetPropIndex(params, Constants.FS_FileIsInUse);    params.propVal.ival = Constants.FV_OpenViewOnly;    i = GetPropIndex(params,Constants.FS_AlertUserAboutFailure);    params.propVal.ival=Constants.FV_DoCancel;  /*   i = GetPropIndex(params,Constants.FS_MakeVisible );    params.propVal.ival=false;  */   return (params);  }

(inserting JS code really has its quirks in this editor).

TOPICS
Scripting

Views

988

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

correct answers 1 Correct answer

Enthusiast , Feb 09, 2015 Feb 09, 2015

Hi Klaus,

There's missing something like this in you function GetTplParams() :

params = GetOpenDefaultParams();

Votes

Translate

Translate
Community Expert ,
Feb 09, 2015 Feb 09, 2015

Copy link to clipboard

Copied

To get the code somewhat more useful, see https://dl.dropboxusercontent.com/u/55332862/t-very-simple.jsx

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
Enthusiast ,
Feb 09, 2015 Feb 09, 2015

Copy link to clipboard

Copied

Hi Klaus,

There's missing something like this in you function GetTplParams() :

params = GetOpenDefaultParams();

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 ,
Feb 09, 2015 Feb 09, 2015

Copy link to clipboard

Copied

Hi Klaus, Can you tell me exactly what you are trying to do? I should be able to help you but I need to know what you are specifically trying to do. Thanks. -Rick

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 ,
Feb 10, 2015 Feb 10, 2015

Copy link to clipboard

Copied

LATEST

Thanks Klaus - now it works!

To Rick.

The presented piece of code is part of a 're-furbishing' the FameMaker to EndNote 'connection.

In a first step I collect temporary citations (such as [Daube, 1969, #123] ) from text, footnotes and tables into an array. This part already works fine (I had to postpone further development for a year now...).

Then I write this data to a new document (which is created from the template - this is where the mentioned piece comes into play.

This file then is saved as rtf to be worked off by the bibliographic application EndNote (or Citavi in another case) to resolve the temporary citation into formatted citations and the bibliography.

After that the modified rtf is read in FM and the temp. citations in the FM-document/book are replaced by the formatted citations.

The user then copies the bibliography (as text only) into his appropriate chapter/section and formats it to his liking.

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