Dataviews scripting error

New Here ,
Jun 10, 2022 Jun 10, 2022

Copy link to clipboard

Copied

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

Views

76

Likes

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

Copy link to clipboard

Copied

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

Likes

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

Copy link to clipboard

Copied

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

Likes

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

Copy link to clipboard

Copied

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. 

Likes

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

Copy link to clipboard

Copied

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
}

 

 

 

Likes

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

Copy link to clipboard

Copied

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.

Likes

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