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

Error 21: null is not an object.

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

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

Community Expert , 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

...

Votes

Translate

Translate
Adobe
Community Expert ,
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

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

Copy link to clipboard

Copied

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

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
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?

 

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

Copy link to clipboard

Copied

LATEST

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

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