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

Explorer ,
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

53

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

correct answers 1 Correct answer

Adobe Community Professional , Nov 24, 2021 Nov 24, 2021
Shoudn't it be: PSString = {}

Likes

Translate

Translate
Adobe Community Professional ,
Nov 24, 2021 Nov 24, 2021

Copy link to clipboard

Copied

Shoudn't it be: PSString = {}

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
Explorer ,
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.

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 ,
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...

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