Copy link to clipboard
Copied
HI,
Is it possible to copy the active layer group name to clipboard and paste in a excel file to get get the value from the cells and return to user to notifies the product type as an message.
for example: I am having three layer-sets in the active document so now i click the first layer group named CYF022 and i need to copy it from Photoshop and paste it into the excel sheet to know the product information.
so i had an idea to copy the active layers name to clipboard but have no idea to paste that value in the sheet and get value from the next column cell and alerts into Photoshop
Anyone please help me on this !
my excel file will be like:
https://s16.postimg.org/qmpgkikpx/data.jpg
Thanks,
John
Copy link to clipboard
Copied
Photoshop and Excel won't communicate with each other regarding alerts and PS won't copy/paste into Excel. Maybe if you could explain your objective a bit more we could find a workaround.
Copy link to clipboard
Copied
i want to know the product type for image so that i am using the product code as my reference in layersets so using the name in layer group and get the details from stored excel sheet i want to know to product type while working in photoshop so if any other ideas please tell me out...like shell command or
Copy link to clipboard
Copied
If you create a master spreadsheet of all Product Codes and Product Types and save that as a CSV file you can write a Photoshop script that reads the name of the active layer, look up that value in the CSV file and return the Product Type in PS
Copy link to clipboard
Copied
Yeah even tried that but it take long time while reading data from the spreadsheet. Is there any way to do that quick .actually my master files in on the local server
Copy link to clipboard
Copied
How many rows is the CSV file? Could you paste the code you have for what you got so far?
Copy link to clipboard
Copied
#target photoshop
var doc = activeDocument
var gp = doc.activeLayer
var csvFile = new File ('~desktop/script-test.csv')
var fileInfo = readTextFile (csvFile)
var item= fileInfo.split('\n')[0].split (',')
var price = fileInfo.split('\n')[1].split(',')
for (var i=0;i<item.length;i++) {
if(item ==gp.name) {
doc.activeLayer = gp.layers[0]
doc.activeLayer.textItem.contents = price
}
}
function readTextFile(textFile) {
textFile.encoding = "UTF8"
textFile.lineFeed = "unix"
textFile.open ("r", "TEXT", "????");
var str = textFile.read ();
textFile.close();
return str
}
Copy link to clipboard
Copied
4 rows in the csv file