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

How do I call ExtendScript functions from Javascript

Explorer ,
Apr 09, 2022 Apr 09, 2022

Hello!

I am struggling to connect JS and Extendscript. To start, my folder path is workspace/client/index.js and workspace/host/index.jsx.

My JS code is:

Screen Shot 2022-04-09 at 8.00.07 PM.pngexpand image

and my JSX code is:

Screen Shot 2022-04-09 at 8.00.30 PM.pngexpand image

I want to return the path, start, and end times from Extendscript, but I'm not getting any return value from JS. What am I doing wrong? Thank you!

 

TOPICS
How to , SDK
653
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
Explorer ,
Apr 09, 2022 Apr 09, 2022

"I'm not getting any return value from JS" - I meant JSX

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
Explorer ,
Apr 12, 2022 Apr 12, 2022

Also, I just realized that I'm missing a bracket, but after fixing that it still did not print the return value. I added a simple console.log("hi"); before the evalScript and that printed out though.

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
Explorer ,
Apr 17, 2022 Apr 17, 2022

Update: I removed the brackets from getInfo() in  ' csInterface.evalScript("getInfo()", function(array_string) ' and it printed the whole entire function as a string. Not what I intended, but at least that's something. What went awry? 

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
Explorer ,
Apr 17, 2022 Apr 17, 2022

Screen Shot 2022-04-17 at 11.39.35 PM.pngexpand image

 

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
Explorer ,
Apr 19, 2022 Apr 19, 2022

I just realized that getInfo returns a string of the function which is why it works. 

my jsx looks like this now:

Screen Shot 2022-04-19 at 12.13.48 PM.pngexpand image

and my js looks like this:

Screen Shot 2022-04-19 at 12.14.48 PM.pngexpand image

However, I'm getting an EvalScript Error and I don't know why.

Screen Shot 2022-04-19 at 12.15.23 PM.pngexpand image

Can somebody help? Thank you!

 

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
Adobe Employee ,
Apr 19, 2022 Apr 19, 2022

PProPanel offers multiple examples of getting data across the ExtendScript <--> JavaScript boundary. 


Also, when calling evalScript() within JavaScript, you'll need to include the outermost layer of ExtendScript defintion, so you'd reference '$._FUNCTIONS.getInfo', not 'getInfo'.

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
Explorer ,
Apr 20, 2022 Apr 20, 2022

Hello Bruce! 

I tried referencing the function as you stated, but I am not printing anything out to the debug console except for the "hello" before I call evalScript().

This is my js code right now:

Screen Shot 2022-04-20 at 4.51.51 PM.pngexpand image

This is my jsx code:

Screen Shot 2022-04-20 at 4.53.01 PM.pngexpand image

Ideally, getInfo() should return "hi" and then be printed out to the console, but at the moment it's not working. If I change .getInfo() to .printHi() though, it does print "hi" which is very puzzling. Thank you!

 

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
Adobe Employee ,
Apr 22, 2022 Apr 22, 2022
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
Explorer ,
Apr 26, 2022 Apr 26, 2022

I checked the post and they cited another post that helped them solve the issue. However, the one that they cited doesn't exist anymore, and they solved their problem by removing a manifest reference to an empty jsx file, which for me isn't empty. I tried to debug the code again and then I found out that the getInfo works when I just have a return "hi" statement, but fails to return anything when I copy my extendscript code into the function. I checked my extendscript code separately using the debugger before and it works, so is there anything else that would cause the return to fail? Thank you!

Screen Shot 2022-04-26 at 5.37.07 PM.pngexpand image

^fails

 

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
Adobe Employee ,
Apr 27, 2022 Apr 27, 2022

That makes no sense.

 

Send me the actual extension, please.

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
Explorer ,
Apr 27, 2022 Apr 27, 2022

The link isn't working for me

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
Adobe Employee ,
Apr 27, 2022 Apr 27, 2022
LATEST

Weird; the link is just my email address. 🙂 

bbb@adobe.com

 

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 ,
Apr 19, 2022 Apr 19, 2022

Your original post is only tagged with "How to." Tag it also with "SDK."

 

Stan

 

@Bruce Bullis 

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