Clipboard to photoshop text layer (.BAT to .TXT to .JSX) new line not being recognized
New line or other object not being recognized by photoshop. Is there a good workaround for this? I assume I'll have to do str replace in the bat or photoshop. Is there a guide on what characters or new lines or other operative/invisible/special characters aren't accepted in photoshop? What syntax to use? People already said you couldn't paste into photoshop using scripting but I just did it (maybe they meant using only jsx), just need to fix formatting. Thanks for any help.
Method:
Copy html table from web, run jsx in photoshop.
Result:
Bat file:
@4628292 off
powershell -command "& {Get-Clipboard}" > "I:\output.txt"Jsx file:
// Function to execute a system command and capture its output
function executeCommand(command) {
var fileObj = new File(command);
fileObj.execute();
}
// Get clipboard data using the Batch script
var clipboardData = "";
try {
executeCommand('I:\\RunPowershell.bat');
// Read the output file
var outputFile = new File('I:\\output.txt');
outputFile.open('r');
clipboardData = outputFile.read();
outputFile.close();
outputFile.remove();
} catch (e) {
alert("Error executing Batch file: " + e);
}
// Create a new text layer in Photoshop
var textLayer = app.activeDocument.artLayers.add();
textLayer.kind = LayerKind.TEXT;
textLayer.textItem.contents = clipboardData;