Copy link to clipboard
Copied
the same ps version run the same script ,some computer always occur the error,said "This functionality may not be available in this version of ps".The question is our computer ps version are all the same
the script content is about to create some text layer ,move the layer posion, kind of stuff like these.
Have you tried changing the line to something like this
scLayerText.position=[222, Number (697+number*547)]
The message mentions that the Scratch Disks are full – is that a plausible problem?
Copy link to clipboard
Copied
What is the code?
When run in ESTK at which exact line does it throw the error?
Some Preferences may for example affect naming and lead to problems same as with Actions; if the Script tries to address by name a Layer that has been created by duplicating a Layer its name may contain " copy" on one station but not on another.
Copy link to clipboard
Copied
How can i upload the whole test file and code and the error picture for you here?
Copy link to clipboard
Copied
The code you can paste as text, images (not all formats, though) can be posted with the camera-icon button.
Copy link to clipboard
Copied
//Author: wubi Fan
//----------------------------------------------------------------------Get active layer and group------------------------------------------------------------
activeLayer=app.activeDocument.activeLayer
if (activeLayer.typename=="ArtLayer")
{activeGroup=activeLayer.parent}
else
{activeGroup=activeLayer}
//-----------------------------------------------------------------Get needed groups and BG layer--------------------------------------------------------
bgLayer=app.activeDocument.artLayers[0]
groups=app.activeDocument.layerSets
tarGroups=new Array()
for (i=0; i<groups.length; i++)
{
if (activeGroup!=groups)
{tarGroups.push(groups)}
else
{ break }
}
tarGroups.push(activeGroup)
tarGroups=tarGroups.reverse()
//---------------------------------------------------------------Check, create title layer and sc layers------------------------------------------------------
for (k=0; k<tarGroups.length; k++)
{
tarLayers=tarGroups
test00Layers=new Array()
testTitleLayer=new Array()
testSCLayers=new Array()
for (l=0; l<tarLayers.length; l++)
{
testName15=tarLayers
testName16=testName15[testName15.length-1]
if (testName16=="title") {testTitleLayer.push(tarLayers
if (testName16=="sc") {testSCLayers.push(tarLayers
if (testName16!="sc" && testName16!="title" && testName16!="text" && testName16!="add")
{test00Layers.push(tarLayers
}
test00Layers=test00Layers.reverse()
if (testTitleLayer.length==0)
{
scLayer=tarLayers.add()
scLayer.name=tarGroups
scLayer.kind=LayerKind.TEXT
scLayerText=scLayer.textItem
scLayerText.position=[224,300]
scLayerText.contents=tarGroups
scLayerText.size=15
scLayerText.justification=Justification.CENTER
}
if (testSCLayers.length==0)
{
number=0
for (a=0; a<test00Layers.length; a++)
{
scLayer=tarLayers.add()
scLayer.move(test00Layers,ElementPlacement.PLACEBEFORE)
testName17=test00Layers.name
scLayer.name=testName17+"_sc"
scLayer.kind=LayerKind.TEXT
scLayerText=scLayer.textItem
if (testName17.match("wide")!=null)
{testName17=testName17.replace("_wide","")}
scLayerText.position=[222,697+number*547]
if (testName17.match("long")!=null)
{
testName17=testName17.replace("_long","")
number+=1
}
scLayerText.contents=testName17
scLayerText.size=15
scLayerText.justification=Justification.CENTER
number+=1
}
}
}
//------------------------------------------------------------------Create sc layer for add layer---------------------------------------------------------
activeLayers=activeGroup.artLayers
for (j=0; j<activeLayers.length; j++)
{
if (activeLayers
{
scLayer=activeLayers[j-3].duplicate (activeLayers
activeLayerName=activeLayer.name
test01=activeLayerName.replace("_add","")
if (activeLayerName.match("wide")!=null)
{test01=test01.replace("_wide","")}
if (activeLayerName.match("long")!=null)
{test01=test01.replace("_long","")}
scLayer.name=test01+"_sc_add"
scLayerText=scLayer.textItem
scLayerText.contents=test01+"_add"
break
}
}
//-----------------------------------------------------------------Get needed layers in active group--------------------------------------------------------
activeLayers=activeGroup.artLayers
activeLayersTar=new Array()
for (j=0; j<activeLayers.length; j++)
{
if (activeLayers[j+2]==activeLayer) { break }
{activeLayersTar.push(activeLayers
}
activeLayersTar.shift()
activeLayersTar=activeLayersTar.reverse()
//---------------------------------------------------------------move and rename layers in active group------------------------------------------------------
for (m=0; m<activeLayersTar.length; m++)
{
activeLayersTar
if (activeLayer.name.match("long")!=null)
{activeLayersTar
testName03=activeLayer.name.split("_")
if (testName03.length>2)
{
testName05=activeLayersTar
if (testName05[0]==testName03[0] && Number(testName05[1])>=Number(testName03[1]))
{
testName04=String(Number(testName05[1])+1)
if (testName04.length==1) {testName04=0+testName04}
if (testName05[testName05.length-1]=="sc")
{
scLayerText=activeLayersTar
testContent00=scLayerText.contents.split("_")
testContent00[1]=testName04
scLayerText.contents=testContent00.join("_")
}
testName05[1]=testName04
activeLayersTar
}
}
else
{
testName07=activeLayersTar
testName08=String(Number(testName07[0])+1)
if (testName08.length==1) {testName08=00+testName08}
if (testName08.length==2) {testName08=0+testName08}
if (testName07[testName07.length-1]=="sc")
{
scLayerText=activeLayersTar
testContent00=scLayerText.contents.split("_")
testContent00[0]=testName08
scLayerText.contents=testContent00.join("_")
}
testName07[0]=testName08
activeLayersTar
}
}
activeLayers=activeGroup.artLayers
activeLayerName=activeLayer.name
activeLayer.name=activeLayerName.replace("_add","")
activeSCLayer=activeLayers.getByName(activeLayer.name+"_sc_add")
activeSCLayer.name=activeSCLayer.name.replace("_add","")
scLayerText=activeSCLayer.textItem
scLayerText.contents=scLayerText.contents.replace("_add","")
activeTextLayer=activeLayers.getByName(activeLayer.name+"_text_add")
activeTextLayer.name=activeTextLayer.name.replace("_add","")
//------------------------------------------------------------------rename layers in another group---------------------------------------------------------
for (n=1; n<tarGroups.length; n++)
{
firLayer=tarGroups[n-1].artLayers[3]
testName10=firLayer.name.split("_")
testName11=tarGroups
lastLayer=testName11[testName11.length-1]
testName12=lastLayer.name.split("_")
if (Number(testName10[0])==Number(testName12[0]))
{
if (testName10.length>=2)
{
for (a=0; a<testName11.length; a++)
{
test03=testName11.name.split("_")
if (test03.length>=2 && test03[0]==testName10[0])
{
...
.textItem
testContent00=scLayerText.contents.split("_")
...
.name.match("title")==null)
{
test03[1]=testName04
....name=test03.join("_")
}
}
else
{
...
.textItem
testContent00=scLayerText.contents.split("_")
...
.name.match("title")==null)
{
test03[0]=testName04
....name=test03.join("_")
}
}
}
}
else
...
.name.split("_")
testName04=String(Number(test03[0])+1)
if (testName0...
.textItem
testContent00=scLayerText.contents.split("_")
testCo...
.name.match("title")==null)
{
test03[0]=testName04
....name=test03.join("_")
}
}
}
}
}
//-------------------------------...
Copy link to clipboard
Copied
I have tested 10 stations, just 3 of them can run the script correctly, others all throw this error.
Copy link to clipboard
Copied
When run in ESTK at which exact line does it throw the error?
Copy link to clipboard
Copied
Line 65
Copy link to clipboard
Copied
Copy link to clipboard
Copied
//Author: wubi Fan
//----------------------------------------------------------------------Get active layer and group------------------------------------------------------------
activeLayer=app.activeDocument.activeLayer
if (activeLayer.typename=="ArtLayer")
{activeGroup=activeLayer.parent}
else
{activeGroup=activeLayer}
//-----------------------------------------------------------------Get needed groups and BG layer--------------------------------------------------------
bgLayer=app.activeDocument.artLayers[0]
groups=app.activeDocument.layerSets
tarGroups=new Array()
for (i=0; i<groups.length; i++)
{
if (activeGroup!=groups)
{tarGroups.push(groups)}
else
{ break }
}
tarGroups.push(activeGroup)
tarGroups=tarGroups.reverse()
//---------------------------------------------------------------Check, create title layer and sc layers------------------------------------------------------
for (k=0; k<tarGroups.length; k++)
{
tarLayers=tarGroups
test00Layers=new Array()
testTitleLayer=new Array()
testSCLayers=new Array()
for (l=0; l<tarLayers.length; l++)
{
testName15=tarLayers
testName16=testName15[testName15.length-1]
if (testName16=="title") {testTitleLayer.push(tarLayers
if (testName16=="sc") {testSCLayers.push(tarLayers
if (testName16!="sc" && testName16!="title" && testName16!="text" && testName16!="add")
{test00Layers.push(tarLayers
}
test00Layers=test00Layers.reverse()
if (testTitleLayer.length==0)
{
scLayer=tarLayers.add()
scLayer.name=tarGroups
scLayer.kind=LayerKind.TEXT
scLayerText=scLayer.textItem
scLayerText.position=[224,300]
scLayerText.contents=tarGroups
scLayerText.size=15
scLayerText.justification=Justification.CENTER
}
if (testSCLayers.length==0)
{
number=0
for (a=0; a<test00Layers.length; a++)
{
scLayer=tarLayers.add()
scLayer.move(test00Layers,ElementPlacement.PLACEBEFORE)
testName17=test00Layers.name
scLayer.name=testName17+"_sc"
scLayer.kind=LayerKind.TEXT
scLayerText=scLayer.textItem
if (testName17.match("wide")!=null)
{testName17=testName17.replace("_wide","")}
scLayerText.position=[222,697+number*547]
if (testName17.match("long")!=null)
{
testName17=testName17.replace("_long","")
number+=1
}
scLayerText.contents=testName17
scLayerText.size=15
scLayerText.justification=Justification.CENTER
number+=1
}
}
}
//------------------------------------------------------------------Create sc layer for add layer---------------------------------------------------------
activeLayers=activeGroup.artLayers
for (j=0; j<activeLayers.length; j++)
{
if (activeLayers
{
scLayer=activeLayers[j-3].duplicate (activeLayers
activeLayerName=activeLayer.name
test01=activeLayerName.replace("_add","")
if (activeLayerName.match("wide")!=null)
{test01=test01.replace("_wide","")}
if (activeLayerName.match("long")!=null)
{test01=test01.replace("_long","")}
scLayer.name=test01+"_sc_add"
scLayerText=scLayer.textItem
scLayerText.contents=test01+"_add"
break
}
}
//-----------------------------------------------------------------Get needed layers in active group--------------------------------------------------------
activeLayers=activeGroup.artLayers
activeLayersTar=new Array()
for (j=0; j<activeLayers.length; j++)
{
if (activeLayers[j+2]==activeLayer) { break }
{activeLayersTar.push(activeLayers
}
activeLayersTar.shift()
activeLayersTar=activeLayersTar.reverse()
//---------------------------------------------------------------move and rename layers in active group------------------------------------------------------
for (m=0; m<activeLayersTar.length; m++)
{
activeLayersTar
if (activeLayer.name.match("long")!=null)
{activeLayersTar
testName03=activeLayer.name.split("_")
if (testName03.length>2)
{
testName05=activeLayersTar
if (testName05[0]==testName03[0] && Number(testName05[1])>=Number(testName03[1]))
{
testName04=String(Number(testName05[1])+1)
if (testName04.length==1) {testName04=0+testName04}
if (testName05[testName05.length-1]=="sc")
{
scLayerText=activeLayersTar
testContent00=scLayerText.contents.split("_")
testContent00[1]=testName04
scLayerText.contents=testContent00.join("_")
}
testName05[1]=testName04
activeLayersTar
}
}
else
{
testName07=activeLayersTar
testName08=String(Number(testName07[0])+1)
if (testName08.length==1) {testName08=00+testName08}
if (testName08.length==2) {testName08=0+testName08}
if (testName07[testName07.length-1]=="sc")
{
scLayerText=activeLayersTar
testContent00=scLayerText.contents.split("_")
testContent00[0]=testName08
scLayerText.contents=testContent00.join("_")
}
testName07[0]=testName08
activeLayersTar
}
}
activeLayers=activeGroup.artLayers
activeLayerName=activeLayer.name
activeLayer.name=activeLayerName.replace("_add","")
activeSCLayer=activeLayers.getByName(activeLayer.name+"_sc_add")
activeSCLayer.name=activeSCLayer.name.replace("_add","")
scLayerText=activeSCLayer.textItem
scLayerText.contents=scLayerText.contents.replace("_add","")
activeTextLayer=activeLayers.getByName(activeLayer.name+"_text_add")
activeTextLayer.name=activeTextLayer.name.replace("_add","")
//------------------------------------------------------------------rename layers in another group---------------------------------------------------------
for (n=1; n<tarGroups.length; n++)
{
firLayer=tarGroups[n-1].artLayers[3]
testName10=firLayer.name.split("_")
testName11=tarGroups
lastLayer=testName11[testName11.length-1]
testName12=lastLayer.name.split("_")
if (Number(testName10[0])==Number(testName12[0]))
{
if (testName10.length>=2)
{
for (a=0; a<testName11.length; a++)
{
test03=testName11.name.split("_")
if (test03.length>=2 && test03[0]==testName10[0])
{
...
.textItem
testContent00=scLayerText.contents.split("_")
...
.name.match("title")==null)
{
test03[1]=testName04
....name=test03.join("_")
}
}
else
{
...
.textItem
testContent00=scLayerText.contents.split("_")
...
.name.match("title")==null)
{
test03[0]=testName04
....name=test03.join("_")
}
}
}
}
else
...
.name.split("_")
testName04=String(Number(test03[0])+1)
if (testName0...
.textItem
testContent00=scLayerText.contents.split("_")
testCo...
.name.match("title")==null)
{
test03[0]=testName04
....name=test03.join("_")
}
}
}
}
}
//-------------------------------...
Copy link to clipboard
Copied
Have you tried changing the line to something like this
scLayerText.position=[222, Number (697+number*547)]
The message mentions that the Scratch Disks are full – is that a plausible problem?
Copy link to clipboard
Copied
I have tried changing that line, I have also tried changing the scratch disk from C disk to D disk, but they all didn't work.
This is really anoying me,the same script why some station can run it,others can't ? I really can't figure out the reason.
Please help me, thanks very much.
And how can i upload the test ps file for you? can you help me test it in you computer?
Copy link to clipboard
Copied
Did you try increasing the scratch disk size? If it runs somewhere, could really be about running out of memory. Scripts can be memory intensive as they rack up a lot of change history quickly. One thing you can try is suspending history tracking for the doc by running your code through doc.suspendHistory, i.e.
function do_everything() {
// your code
}
doc.suspendHistory("Do everything", do_everything)
Copy link to clipboard
Copied
I tried the suspendHistory command, didn't work either. Like before ,just that 3 station can run the script, I don't know if my command is wrong somewhere,when finished,it throw a error like below showed.
Copy link to clipboard
Copied
In the call to suspendHistory, remove parenthesis from the function, i.e. 'doc.suspendHistory("Do everything", do_everything)'. What you want is to give the function as a parameters (in Javascript, functions are a data type same as numbers and objects) and let suspendHistory call your function. What you are now doing is first calling the function and giving suspendHistory the return value of the function (probably undefined).
Copy link to clipboard
Copied
Could you please post a screenshot of the image in Photoshop with the Layers Panel visible when it fails?
Copy link to clipboard
Copied
Here is my ps screen picture, the 01_title layer,001_sc layer,002_sc layer are created by script, the "wrong" station always throw the error when runs to the 002_sc layer, before they throw the error, below picture appears several times
And one of the "wrong" station throws another error,like below shows:
For now, I have tested 15 stations, still just 3 of them can run the script correctly.