Copy link to clipboard
Copied
Hello everyone!
Guys is there any possibility of a script working correctly in Photoshop CS3.
It serves to import a price table via a text.text file into a dialog window, once the text is loaded, I will have to make some changes to the text after saving.
At the company I work for, it works perfectly on the latest versions, however, in my house my computer is very limited and I can only work with the CS3 version of Photoshop
and this script I will need to use more often in my house.
All help is valid!
Here the script and the price list:
dle = new Window("dialog"); dle.text = "Tabela de Preços!";
dle.orientation = "column";
fFile = File ( "~/desktop/Preços.txt" );
fFile.open("r"); stringFromTextFile = fFile.read(); valores = stringFromTextFile.split();
edittext1 = dle.add('edittext {size: [240.59,305.556], properties: {name: "edittext1", multiline: true}}');
edittext1.text = valores
gp1 = dle.add("group", undefined, {name: "gp1"});
bt2 = gp1.add("button", undefined, undefined, {name: "bt2"});
bt2.text = "Salvar"; bt2.preferredSize.width = 90;
bt1 = gp1.add("button", undefined, undefined, {name: "bt1"});
bt1.text = "Fechar"; bt1.preferredSize.width = 90;
bt2.onClick = function (){
dle.close(); var URL = new File("~/desktop/Preços.txt"); URL.open("w"); URL.writeln(edittext1.text);
}
dle.show();
ADESIVO: 75,00 | Amador 65,00 | Profissional ----------------------------- CANVAS: 85,00 | Amador 75,00 | Profissional ----------------------------- LONA: 95,00 | Amador 85,00 | Profissional ----------------------------- PAPEL: 150,00 | Amador 120,00 | Profissional ----------------------------- OUTRO: 0,00 -----------------------------
I found a user with windows XP and Photoshop CS3 installed 😄😄😄
In general, it looks like this is a feature of a particular version - it really cannot display an array as a string. There is no such problem in CS2, but multiline is not supported there.
The solution is to remove the .split ()
dle = new Window("dialog"); dle.text = "Tabela de Preços!";
dle.orientation = "column";
fFile = File ( "~/desktop/Preços.txt" );
fFile.open("r"); stringFromTextFile = fFile.read(); valore
...
Copy link to clipboard
Copied
What you mean it does not work for you correctly?
Copy link to clipboard
Copied
Hi @Kukurykus , for you it worked on the CS3 version??
In mine here it doesn't work.
Copy link to clipboard
Copied
Loll you talk like I have pretty old one realese 😉
In ESTK CC there's no problem as well as Ps & Br CS6.
Try without: , properties: {name: "edittext1", multiline: true}
If you'll see .txt content in one row, use more edittexts to display them separatly.
The last chance is to try this workaround: edittext1.text = eval(valores.toSource())
Copy link to clipboard
Copied
@Kukurykus tentei todas as suas alternativas porém sem sucesso
1: edittext1 = dle.add('edittext {size: [240.59,305.556]}'); ///
2: fFile.open("r"); stringFromTextFile = fFile.read(); valores = stringFromTextFile.split();
edittext1 = dle.add('edittext {size: [240.59,305.556], properties: {name: "edittext1", multiline: true}}');
edittext1.text = eval (valores.toSource ())
Copy link to clipboard
Copied
Could also see if trying first tip, so removing the part I asked makes all in one row?
Copy link to clipboard
Copied
why is split () here? The string will simply turn into an array with one element, which is what your edittext1 shows
valores = stringFromTextFile.split();
Copy link to clipboard
Copied
Oi @jazz-y ! Este script não é meu, não tenho conhecimento de fazer scripts, encontrei em outro fórum há muito tempo. Não tenho ideia de como fazer isso. Sua ajuda é muito valiosa. Ele funciona bem em versões recentes, mas não funciona no meu Photoshop CS3.
Copy link to clipboard
Copied
Just remove .split() from this line
stringFromTextFile.split()
Copy link to clipboard
Copied
Good catch! It seems later versions evaluate array content.
Still I wonder if my workaround makes the same. Let's see!
Copy link to clipboard
Copied
Perhaps this is a feature of CS3, since in later versions I repeatedly displayed the contents of the array simply by passing it to the textbox.
dle = new Window("dialog"); dle.text = "Tabela de Preços!";
edittext1 = dle.add('edittext {size: [240.59,305.556], properties: {name: "edittext1", multiline: true}}');
edittext1.text = ['test1','test2','test3']
dle.show();
P.S. if there are problems with displaying the array, then why eval? 🙂
edittext1.text = eval(valores.toSource())
Copy link to clipboard
Copied
@jazz-y Aqui testado no notebook do vizinho e funciona bem em versões recentes.
I opened the window, modified the table text, saved it, then opened it again with the values correctly updated.
 
Copy link to clipboard
Copied
Loll, then maybe double eval will help:
edittext1.text = eval(eval(valores.toSource()))
Copy link to clipboard
Copied
I added and it still doesn't work
Copy link to clipboard
Copied
More important now is to check what I asked 35 minutes ago.
Copy link to clipboard
Copied
I found a user with windows XP and Photoshop CS3 installed 😄😄😄
In general, it looks like this is a feature of a particular version - it really cannot display an array as a string. There is no such problem in CS2, but multiline is not supported there.
The solution is to remove the .split ()
dle = new Window("dialog"); dle.text = "Tabela de Preços!";
dle.orientation = "column";
fFile = File ( "~/desktop/Preços.txt" );
fFile.open("r"); stringFromTextFile = fFile.read(); valores = stringFromTextFile;
edittext1 = dle.add('edittext {size: [240.59,305.556], properties: {name: "edittext1", multiline: true}}');
edittext1.text = valores
gp1 = dle.add("group", undefined, {name: "gp1"});
bt2 = gp1.add("button", undefined, undefined, {name: "bt2"});
bt2.text = "Salvar"; bt2.preferredSize.width = 90;
bt1 = gp1.add("button", undefined, undefined, {name: "bt1"});
bt1.text = "Fechar"; bt1.preferredSize.width = 90;
bt2.onClick = function (){
dle.close(); var URL = new File("~/desktop/Preços.txt"); URL.open("w"); URL.writeln(edittext1.text);
}
dle.show();
P.S.
@Kukurykus wrote:
Try without: , properties: {name: "edittext1", multiline: true}
Does what you would expect from removing the multiline, but does not solve the problem (the array still cannot be displayed).
But another obvious option works: 🙂
edittext1.text = valores[0]
Copy link to clipboard
Copied
Copy link to clipboard
Copied
It should be read literally 🤣🤣🤣
When multiline is enabled In CS2, the text wraps width of control. However, ASCII control characters do not work, that is, you cannot control the contents of the textbox:
🤷
Copy link to clipboard
Copied
I don't have CS2 anymore, but maybe try to turn vlaores to jsxbin and use in the code as eval('jsxbinCode'). That sometimes helps to not miss out the '\' characters. Just an idea.
Copy link to clipboard
Copied
They are not lost - if we read the contents of the textbox character by character, then all the control codes will be in their place.
They just don't work.
Copy link to clipboard
Copied
What about changing \n to \r or etcetera? Probably another faux pas from my side 😛
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You mean that's going to work in CS2?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Another good found that recalled me something from deep past when I had problem with $.screens. After I put at end [0] it finally started to work with .left, .right etc. Too bad I didn't remember that earlier 😄