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

Whats going on here.. a bug? variable returns "anonymous"

Participant ,
Nov 24, 2021 Nov 24, 2021

Copy link to clipboard

Copied

I initialize all my action manager id this way. But it fails in one single instance..

When I try to get the ID for "name".

You would expect the code below to alert the same ID, but the first one is correct, the second one alerts "anonymous"

When I save the id to var = name; I get "Adobe Photoshop" returned.

When I save it to var = stringName it is correct. But I'm initializing a ton of ID's this way, why is this one "anonymous"?

 

alert(stringIDToTypeID('name'));

PSString = function() {};
PSString.name = stringIDToTypeID('name');
alert(PSString.name);
TOPICS
Actions and scripting

Views

187

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

LEGEND , Nov 24, 2021 Nov 24, 2021

Shoudn't it be: PSString = {}

Votes

Translate

Translate
Adobe
LEGEND ,
Nov 24, 2021 Nov 24, 2021

Copy link to clipboard

Copied

Shoudn't it be: PSString = {}

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
Participant ,
Nov 25, 2021 Nov 25, 2021

Copy link to clipboard

Copied

LATEST

Correct, I just copied it from "PSConstants", I thought it should be just an object instead of a function...

Whats going on here is that I actually request the name of the function, since its not named, it returns "anonymous".

I fixed it, and works fine now.

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
People's Champ ,
Nov 24, 2021 Nov 24, 2021

Copy link to clipboard

Copied

quote

When I save the id to var = name; I get "Adobe Photoshop" returned.

 

By @Marvin01

 

name == app.name // global variable

 

activeDocument == app.activeDocument

 

and so on...

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