Advertisement
Guest User

Untitled

a guest
Sep 30th, 2022
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. var csvFile = File.openDialog('Select a CSV File');
  2.  
  3. csvFile.open("r");
  4. var txtFile = csvFile.read();
  5. csvFile.close();
  6.  
  7. var iText = txtFile.split("\n");
  8.  
  9. var multiArray = new Array(iText.length-1)
  10.  
  11. var doc = app.activeDocument;
  12. var mm = 2.834645;
  13.  
  14. var artBoard = doc.pathItems.roundedRectangle (0, -5000, 1, 1, 0, 0);
  15. artBoard.name="delete"
  16.  
  17. for (i=0; i<iText.length-2; i++) {
  18.  
  19. var T = iText[i+1].split( ";");
  20.  
  21.  
  22. var valueQty = Number(T[4])
  23. var valueW = (T[7])*mm
  24. var valueH = (T[8])*mm
  25.  
  26. for (j=0; j<valueQty; j++) {
  27.  
  28.  
  29. var pos3 = doc.pathItems[0].position
  30. var pos4 = doc.pathItems[0].width
  31.  
  32. var artBoard = doc.pathItems.rectangle (0, 0, valueW, valueH)
  33. artBoard.name="Artboard"+i
  34.  
  35. var obj2move = artBoard
  36.  
  37.  
  38.  
  39. obj2move.position = new Array (pos3[0]+pos4+10,0);
  40.  
  41. }
  42.  
  43. }
  44.  
  45. doc.pathItems.getByName("delete").remove();
  46. app.executeMenuCommand('selectall')
  47. app.executeMenuCommand('setCropMarks')
  48. doc.artboards[0].remove();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement