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

Dataviews scripting error

New Here ,
Jun 10, 2022 Jun 10, 2022

Hello,

I am taking my first steps in scripting in InDesign and I am faced with a simple issue. I am trying to execute this script from the Scripts Panel in InDesign CC 2021:

var easyCatalogFilePath = "testFile.txt"

var myEasyCatalog = app.easycatalogObject;
var myDS = app.easycatalogObject.datasources.item(easyCatalogFilePath );
var myDV = myDS.dataviews.add();
 
However, when I run this I get an error on line myDS.dataviews.add() that Object is Invalid. This should be a simple EasyCatalog script to open a data source. Has anyone faced a similar issue?
TOPICS
Scripting
351
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

Valorous Hero , Jun 10, 2022 Jun 10, 2022

Very interesting! I didn't know that EasyCatalog is scriptable. Do they have some sample scripts? Found them here. I don't have it installed but your very first line makes me embarrassed. From the variable name, I assume, it should be a full path to the file, not the file name. Something like this:

 

 

var easyCatalogFilePath = "/C/folder/subFolder/subSubFolder/testFile.txt";

 

 

 

Make sure to check if the file exists and if so go on with your code.

 

 

if (File(easyCatalogFilePath).exists) {
   // do so
...
Translate
Community Expert ,
Jun 10, 2022 Jun 10, 2022

Hi @Bill3862 var myEasyCatalog = app.easycatalogObject; would also throw an error because there‘s no easycatalogObject Application object.

 

Here’s the InDesign ExtendScript API:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Application.html

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
Community Expert ,
Jun 10, 2022 Jun 10, 2022

Rob, I believe Easy Catalog can be scripted: https://www.65bit.com/software/easycatalog/modules/scripting-module/

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
Community Expert ,
Jun 10, 2022 Jun 10, 2022

Don't know much about Easy Catalog scripting but I would start by ensuring you have the full path to your txt file. Ie, "~/Desktop/testFile.txt" would point to your desktop, whereas app.activeScript.fsName + "/testFile.txt" would point to the same directory as wherever you are executing the script from. 

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
Valorous Hero ,
Jun 10, 2022 Jun 10, 2022

Very interesting! I didn't know that EasyCatalog is scriptable. Do they have some sample scripts? Found them here. I don't have it installed but your very first line makes me embarrassed. From the variable name, I assume, it should be a full path to the file, not the file name. Something like this:

 

 

var easyCatalogFilePath = "/C/folder/subFolder/subSubFolder/testFile.txt";

 

 

 

Make sure to check if the file exists and if so go on with your code.

 

 

if (File(easyCatalogFilePath).exists) {
   // do something
}

 

 

 

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
New Here ,
Jun 10, 2022 Jun 10, 2022
LATEST

I think it's time to call it a day when you forget to paste the whole path and pay no mind to it! Thank you for pointing that out Kasyan.

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