Question
How to add a script to bridgeTalk in illustrator
// Function to run Illustrator script
function runIllustratorScript() {
var aiFile = new File('~/Desktop/myfile.ai'); // Replace with your desired file path and name
var doc = app.documents.add();
doc.saveAs(aiFile);
doc.close(SaveOptions.DONOTSAVECHANGES);
runPhotoshopScript();
}
// Function to run Photoshop script
function runPhotoshopScript() {
var bt = new BridgeTalk();
bt.target = 'photoshop';
bt.body = 'var psFile = new File("~/Desktop/myfile.psd");\n' +
'var docRef = app.documents.add();\n' +
'docRef.saveAs(psFile);\n' +
'alert("Photoshop file created!");';
bt.send();
}
runIllustratorScript();
The above script was working fine but when i include a 1000line script like this in bt.body it was not
// Function to run Illustrator script
function runIllustratorScript() {
var aiFile = new File('~/Desktop/myfile.ai'); // Replace with your desired file path and name
var doc = app.documents.add();
doc.saveAs(aiFile);
doc.close(SaveOptions.DONOTSAVECHANGES);
runPhotoshopScript();
}
// Function to run Photoshop script
function runPhotoshopScript() {
// Open Photoshop using BridgeTalk
var bt = new BridgeTalk();
bt.target = 'photoshop';
// Specify the path to the Photoshop script file
var scriptFilePath = '~/Desktop/myPhotoshopScript.jsx'; // Replace with the path to your script file
// Read the contents of the script file
var scriptFile = new File(scriptFilePath);
scriptFile.open('r');
var scriptContents = scriptFile.read();
scriptFile.close();
// Execute the Photoshop script
bt.body = scriptContents;
bt.send();
}working at all.Is there any way to include script path or assign it directly to the bt.body as a variable. I have tried it that also not working. I have attached the code below for reference.
