Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Error 21: null is not an object.

Community Beginner ,
Jan 26, 2019 Jan 26, 2019

Copy link to clipboard

Copied

I am using this script:

RePlace My Design In All Mockups SmartObjects

I have 10 mockup PSD and about 20 000 jpgs. The script will replace content from jpg-->smart object in each psd (/3) and save jpg.

It 's working fine when i select only few hundreds jps, but when i select all jpgs (20000 jpgs) there are error:

Error 21: null is not an object.

Line: 12

--> if (theDesigns.length >0) {

I know that that seem the error come from memory limit or something similar. But is there an alternative way to process huge number file without split it manually? it take me too much time to process 20 000 jpgs....

TOPICS
Actions and scripting

Views

1.0K

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 , Jan 26, 2019 Jan 26, 2019
The array theDesigns was not set.  You did not show the script.  Just yesterday there was a thread where a user was processing a 38K file filelist. The script was still running and working well  at that point in time the script was running for over 24 hours as still going. theFiles is a an array of 38K file paths var theFiles = Folder("/d/Canvas Project/Images/3x2-correct size/JPEG").getFiles(/\.(jpg|tif|psd)$/i); You may want to try changing  the select files to select a folder then get th...

Likes

Translate

Translate
Adobe Community Professional ,
Jan 26, 2019 Jan 26, 2019

Copy link to clipboard

Copied

The array theDesigns was not set.  You did not show the script.  Just yesterday there was a thread where a user was processing a 38K file filelist. The script was still running and working well  at that point in time the script was running for over 24 hours as still going. theFiles is a an array of 38K file paths

var theFiles = Folder("/d/Canvas Project/Images/3x2-correct size/JPEG").getFiles(/\.(jpg|tif|psd)$/i);

 

 

You may want to try changing  the select files to select a folder then get the Jpg file list in that folder

 

if ($.os.search(/windows/i) != -1) {var theDesigns = File.openDialog ("please select files", "*.psd;*.psb;*.tif", true)}
else {var theDesigns = File.openDialog ("please select files", getFiles, true)};

 

to

 

var folder = Folder.selectDialog("Select folder", "C:\\");
if (folder) theDesigns = folder.getFiles(/\.(psd|tif|jpg)$/i);
else no folder selected throw some error

 

 

The code may work on both PC and Mac  the test  for platform was need because of the differences between PC and  Mac file open dialog selection.  Windows can filter via a selection filter Mac  can not have a selection filter but can have a selection function.

 

I use windows that code will work on windows. However it will also get any PSD and TIF files also in the folder.

JJMack

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
Community Beginner ,
Jan 27, 2019 Jan 27, 2019

Copy link to clipboard

Copied

Thanks JJMack, i test with 10000jpgs it's working. so great!

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 ,
Nov 08, 2021 Nov 08, 2021

Copy link to clipboard

Copied

Ingen tycks veta hur man slipper från detta elände!    ??  skulle det vara bäst att slopa PS? kanske ta till Gimp?

 

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 08, 2021 Nov 08, 2021

Copy link to clipboard

Copied

LATEST

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 ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

Hur skall jag slippa ur problemet... allt annat tycks arbeta men inte när jag går in på photomerhge så kommer detta meddelande: Error 21: null is not an objekt. Tacksam för svar olle.haavisto@gmail.com.

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