Yuliascript
Participant
Yuliascript
Participant
Activity
‎Feb 23, 2024
09:31 AM
1 Upvote
Thank you, Mark. It works perfectly!
... View more
‎Feb 22, 2024
03:36 PM
1 Upvote
Hi, I need to create rectangular frame with 0.5 pt stroke with CMYK value of 0, 0, 0 , 100 and with overprint on specific layer. Here what I have figured out so far, maybe: var myDoc = app.activeDocument; var myLayer = myDoc.layers.add(); myLayer.name = "GUIDES"; myCardWidth = myDoc.width; myCardHeight = myDoc.height; myTrimLine = myLayer.pathItems.rectangle.add(); myTrimLine.geometricBounds = (0, 0, myCardWidth, myCardHeight); myTrimLine.filled = false; myTrimLine.stroked = true; myDoc.strokeWidth = 0.5 pt; myDoc.documentColorSpace.CMYK var newCMYKColor = new cmykColor(); newCMYKColor.black = 100; newCMYKColor.cyan = 0; newCMYKColor.magenta = 0; newCMYKColor.yellow = 0; Thank you for your help. Yulia
... View more
‎Aug 31, 2023
11:09 AM
Thank you. It's strange that first version did not work. I don't see anything wrong with it. It's not crashing, only not doing anything. But 2nd version works perfectly.
... View more
‎Aug 30, 2023
02:29 PM
5 Upvotes
Hi, I need to resize one out of 2 pages in Indesign with javascript. What would be the correct sintaks for it: myDoc.pages[0].resizeIndividually (8.5,11); Thank you Yulia
... View more
‎Aug 21, 2023
03:33 PM
6 Upvotes
Hi, I need to ask question for InDesign scripting, but I am unable to find a way to created new post in InDesign scripting section. Greatly appreciate the help. Yulia
... View more
‎Mar 10, 2020
05:09 PM
Hi everybody, Thank you for your help. Kasyan, I am on a Mac, I am using your mac version, I entered my Excel file path into your script and running it in open indesign document. It returns correct path, so it should be finding the file. My Excel file is very simple for now. Only one sheet, a title row and couple of rows with 4 columns of data. When I run your script, it stops at applescript doScript line. The error message tells me that 'it can't get sheet 1 of missing value'. What is it that I am missing? Thank you Yulia
... View more
‎Mar 09, 2020
07:14 PM
Hi, I need to read Excel data from Indesign CS6 with js. And what I found so far is not working: readData(x,y);
// https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/783724f0-526d-4c1d-a565-ebcdbca83cb8/how-to-read-excel-file-using-javascript?forum=sidebargadfetdevelopment
function readData(x,y){
var excel=new ActiveXObject("Excel.Application");
excel.Workbooks.Open(myFilePath);
//var excel.workbooks.open(myFolderPath);
var data = excel_sheet.cells(x,y).value; //x,y consider the coordinate of row and column or the data
alert (data)
return data;
} Thank you for your help Yulia
... View more
‎Aug 09, 2019
08:04 PM
Thank you, Kasyan, Your approach gave different idea that worked for me too. I am comparing them like strings instead of numbers now: if((docNameSize == myPageWidth+"x"+myPageHeight) || (docNameSize == myPageHeight+"x"+myPageWidth)){ }else{ alert("Incorrect document size. \nReload xml and InDesign file and re-apply template script."); exit(); } Thank you Yulia
... View more
‎Aug 08, 2019
02:46 PM
Hi, I am checking indesign document size through the script comparing it to order specs, and it works great with standard numbers (if I can call them that way), like 3.5x2, 4x6, 2.125x2.125, etc. But when I get strange numbers, like 1.8x4.1, it tells me that size is wrong when size is correct. Why would it matter what kind of number it is and how I can make it work? Here is my script (I check both orientations): if((myXmlWidth == myPageWidth && myXmlHeight == myPageHeight) || (myXmlWidth == myPageHeight && myXmlHeight == myPageWidth)){ }else{ alert("Incorrect document size."); exit(); } Thank you Yulia
... View more
‎Jul 19, 2019
09:41 AM
1 Upvote
Yes, it did it! Thank you
... View more
‎Jul 18, 2019
02:51 PM
Hi, I tried all the above, was able to edit and replace the file, but it did not help. What else can I do? Thank you Yulia
... View more
‎May 29, 2019
05:15 PM
Thank you, Sunil. It looks now that there is more to the story, because with your code I get 0 Margin and 0 Gutter, but small sizes still fail to resize. I have few sizes in the script set up in the same way, when one is bigger than I inch by 1 inch it works, but when when one is smaller it fails at resizing line. If this helps, here is my code: myWidth = 0.625; // art size myHeight = .25; with(myDoc.documentPreferences){ pageHeight = myHeight; pageWidth = myWidth; } Thank you Yulia
... View more
‎May 28, 2019
06:24 PM
Hi, I am unable to resize page document size in Indesign CS6 js smaller than 1 inch. I set the Margin to 0, but unable to set Gutter to 0. Maybe that is the reason: masters = myDoc.masterSpreads.item('A-Master').pages; for (i = 0; i < masters.length; i++) { masters.marginPreferences.properties = { top: 0, left: 0, right: 0, bottom: 0 }} myPageCount = "1"; myPageCount = eval (myPageCount); with(myDoc.documentPreferences){ pagesPerDocument = 2; } myDoc.spreads[0].remove(); with(myDoc.documentPreferences){ pagesPerDocument = myPageCount; } while ( pg = pgs.pop() ) { app.marginPreferences.properties = { top:0, left:0, bottom:0, right:0, columnGutter:0, columnCount:1 }; } Thank you Yulia
... View more
‎Aug 22, 2018
05:37 PM
My number is coming from dialog box, so I think, script perceives it as string.
... View more
‎Aug 21, 2018
06:27 PM
I know why. I had to add this: myScale = eval (myScale); before this: myArt.horizontalScale = myScale; myArt.verticalScale = myScale; Yulia
... View more
‎Aug 21, 2018
04:31 PM
Thank you, Manan, It makes perfect sense. But for whatever reason when I try to run it, it stops at the line: myArt.horizontalScale = xScale; Thank you. Yulia
... View more
‎Aug 20, 2018
02:01 PM
Hi, I get user's input through dialog how much to enlarge or reduce artwork in % and than re-scale it based on that. When indesign does it in UI, it allows user to go back to 100% by just inputting 100% into re-size window. How can I access this information through my script, because right now if artwork was resized to 110%, request for 100% will not do anything in my script: var myRectangle = myDoc.pages .rectangles[0]; var myArt = myRectangle.graphics[0]; var xScale = myScale / 100; var yScale = myScale / 100; myArt.horizontalScale = myArt.horizontalScale * xScale; myArt.verticalScale = myArt.verticalScale * yScale; Thank you. Yulia
... View more
‎Jul 26, 2018
11:42 AM
Hi, How I can set focus on OK button in the dialog in indesign CS6 javascript: var myDialog = app.dialogs.add({name:"Place PDF file", canCancel:true}); Thank you. Yulia
... View more
‎Jun 25, 2018
02:19 PM
I got it working. Thank you everybody for your help, every bit of information was useful. try{ myDoc.layers.itemByName("Crease").remove({name:"Crease"}); }catch (e){} myDoc.layers.add({name:"Crease"}); var myRectangle = myDoc.pages[0].rectangles.add (myDoc.layers.item ("Crease")); myRectangle.geometricBounds = ["-.125 in","-.125 in", myPageHeight+.125, myPageWidth+.125]; myRectangle.strokeWeight = 0; myRectangle.fillColor = "None"; myRectangle.strokeColor = "None"; myPDFPage = myRectangle.place (myFile); myPDFPage[0].itemLink.unlink(); myArt = myRectangle.graphics[0]; var layers = myArt.graphicLayerOptions.graphicLayers; var layerA = layers.itemByName ("Register"); layerA.isValid && layerA.currentVisibility = false; myArt = myRectangle.graphics[0]; var layers = myArt.graphicLayerOptions.graphicLayers; var layerB = layers.itemByName ("Crease"); layerB.isValid && layerB.currentVisibility = true; myArt = myRectangle.graphics[0]; var layers = myArt.graphicLayerOptions.graphicLayers; var layerC = layers.itemByName ("Thru-cut"); layerC.isValid && layerC.currentVisibility = false; Yulia
... View more
‎Jun 23, 2018
03:47 PM
Thank you, Uwe, I get some impression. I was testing just small part of the script in separate window based on human preselecting the artwork. It would run through the script and turn off only one of 3 layers, then I would reselect the artwork myself and run the same snippet, and it would deselect on more layer. (Did not pay attention if I end up with correct layers, was just happy it worked at all). So, I tried to go the same rout in full script: select with js my pdf and turn off one of the layers and reselect my pdf. And that's were it all started. If I only had one of the layers assigned to false or true at first, I could reselect my pdf, but if I added 2nd layer with on or off switch before re-selection, the reselection won't work anymore, it's like it can't recognize or find the object. It's like it does not perceive it as pdf anymore. Could it be because it's linked and actual file has all the layers on? I will see if embedding the file will help.
... View more
‎Jun 22, 2018
08:26 PM
I can do it in Indesign UI, it works: I am trying to setup the update policy, and something is not working there: var layers = myPDFPage.graphicLayerOptions.graphicLayers; var layerA = layers.itemByName ("Register"); var layerB = layers.itemByName ("Crease"); var layerC = layers.itemByName ("Thru-cut"); layerA.isValid && layerA.currentVisibility = true; layerB.isValid && layerB.currentVisibility = false; myPDFPage.graphicLayerOptions.updateLinkOptions = UpdateLinkOptions.KEEP_OVERRIDES; layerC.isValid && layerC.currentVisibility = false; Something in the grammar of this line: myPDFPage.graphicLayerOptions.updateLinkOptions = UpdateLinkOptions.KEEP_OVERRIDES; And I am not sure what would be correct place for it. Thank you. Yulia
... View more
‎Jun 21, 2018
04:29 PM
I am sorry, I am just trying to figure out scripting on my own. I don't have an idea of what this is and what to do about it.
... View more
‎Jun 21, 2018
02:51 PM
ok, this is working now. One more challenge that I have, when I added 3rd layer in pdf, it's not turning on and off correct layers. It only turns off 1 of the layers and leaves other 2 on. Even though I only need 1 layer remain visible. var layers = myPDFPage.graphicLayerOptions.graphicLayers; var layerA = layers.itemByName ("Register"); var layerB = layers.itemByName ("Crease"); var layerC = layers.itemByName ("Thru-cut"); layerA.isValid && layerA.currentVisibility = false; layerB.isValid && layerB.currentVisibility = false; layerC.isValid && layerC.currentVisibility = true; Thank you. Yulia
... View more
‎Jun 21, 2018
01:10 PM
Something is not working in it for me: myPDFPage = myPage.itemLayer("Crease").place(File(myFile), [0,0])[0]; Thank you. Yulia
... View more
‎Jun 20, 2018
08:45 PM
This is perfect, thank you. My new challenge: because I am using PageItem to place my pdf, I am not sure how to place it onto specific layer. Let's say onto 'Crease' layer in indesign: myPage = myDoc.pages[0]; myPDFPage = myPage.place(File(myFile), [0,0])[0]; var layers = myPDFPage.graphicLayerOptions.graphicLayers; var layerA = layers.itemByName ("Register"); var layerB = layers.itemByName ("Crease"); var layerC = layers.itemByName ("Thru-cut"); layerA.isValid && layerA.currentVisibility = false; layerB.isValid && layerB.currentVisibility = true; layerC.isValid && layerC.currentVisibility = false; Thank you. Yulia
... View more
‎Jun 19, 2018
06:58 PM
Hi Loic.Aigon, If I understand you correctly, it can not be done through scripting and can only done by person? Thank you Yulia
... View more
‎Jun 18, 2018
02:51 PM
Hi, I have multi-layered pdf file and I need to place into indesign CS6 only specific layer from that pdf: creaseLayer = myDoc.layers.item("Crease"); How can I do it with javascript? Thank you. Yulia
... View more
‎May 31, 2018
12:44 PM
Sorry, everybody, I was not very clear about what I need. And 'red' was not good name for the sample ether. Let's say myColor is 'Foil' and it's 100 magenta only. I need it to keep the same name, but to change to new color values, let's say 100 black only, so that all the objects assigned to the color export as black, but then go back to original 100 magenta, with same spot color name 'Foil'. Thank you. Yulia
... View more
‎May 30, 2018
07:52 PM
Hi, I need temporary change color values for existing spot color in indesign CS6, javascript. I have it created, not sure how to change it: try{ myColor = myDoc.colors.item("red"); myName1 = myColor.name; } catch (myError){ myColor = myDoc.colors.add({name:"red", model:ColorModel.spot, colorValue:[0, 100, 80, 0]}); } Thank you. Yulia
... View more
‎Apr 12, 2018
07:26 PM
Hi, I have script for dialog with radio buttons, but I need it to be with check boxes instead ( in Illustrator CS6, javascript 😞 var myDoc = app.activeDocument; dialogSelection (); function dialogSelection (docSize){ /////////////// DialogBox Definition/////////////////////// var resultBox=false; var ressource="dialog { \ text: 'Standard Spot Colors', frameLocation:[100,100], \ MyPanelTemplates: Panel { orientation:'column', alignChildren:['left','Top'], \ text: 'Please select Spot Color', \ title: Group { orientation: 'column', \ myColor1: RadioButton { alignment:'left', text: 'Red', value:true}, \ myColor2: RadioButton { alignment:'left', text: 'Green', value:false}, \ myColor3: RadioButton { alignment:'left', text: 'Blue', value:false}, \ } \ }, \ Valid: Panel { orientation:'column', alignChildren:['left','Top'], \ title: Group { \ CancelBtn: Button { text: 'Cancel', properties:{name:'cancel'} }, \ OkBtn: Button { text: 'OK', properties:{name:'ok'} }, \ } \ }, \ }"; /////////////////////////////////////////////////////////// var dlg = new Window(ressource); //build dialog box dlg.Valid.title.OkBtn.onClick=function(){ //VALID Button test resultBox=true; dlg.close(); return resultBox; }; dlg.show(); // show dialogbox if (resultBox){ // if press OK button if (dlg.MyPanelTemplates.title.varRoundedBC.value){ myColor1 = "Red"; addHPIWhite ('spotwhite', 50, 0, 0, 0); } if (dlg.MyPanelTemplates.title.varFlower.value){ myColor2 = "Green"; addHPIWhite ('spotwhite', 50, 0, 0, 0); } if (dlg.MyPanelTemplates.title.varHeart.value){ myColor3 = "Blue"; addHPIWhite ('spotwhite', 50, 0, 0, 0); } } } function addHPIWhite(name, c, m, y, k) { try { swatch = app.activeDocument.swatches[name]; // if swatch exists.... addSpot (name+='1', c, m, y, k); // ...add 1 to swatch name } catch (e) { var newSpot = app.activeDocument.spots.add(); newSpot.name = name; var newColor = new CMYKColor(); newColor.cyan = c; newColor.magenta = m; newColor.yellow = y; newColor.black = k; newSpot.colorType = ColorModel.SPOT; newSpot.color = newColor; var newSpotColor = new SpotColor(); newSpotColor.spot = newSpot; } } Thank you for your help. Yulia
... View more