Illustrator Scripting :: Script Suddenly Halts After Setting Crop Box
Nov 25, 2012
I'm working on a custom batch exporter, and at one point I need to set the crop box (inside an iteration of the current user-selection). Here's the relevant code:
getMaxRect is a function that calculates the maximum bounding box between the current object ref and a group of overlapping items that I've already computed. The alert on the second line gives a nice set of numbers, so I'm fairly confident that the code thus far is ok. (In addition, I've inspected the crop marks subsequent to the execution of the above lines, and it looks all right.)
Here's the thing. Once doc.cropBox (doc being the active document) is set, it seems like the script execution simply halts. The crop box is actually set in the active document, but it seems to stop after setting this. I never see the second alert, and I don't see any error messages either.
How to export below snapshot setting through idExportJPG type since could not find color model, format, and resolution settings in javascript export options.
Is there any way of setting draw mode through a script?
I can't find any info.
What I'd like is to set the draw mode to paint inside for a selected path through a script instead of clicking twice on the toolbar button or hit Shift+D twice.
In Illustrator CS5+, I'm looping through the objects in a document, exporting each of them to an image using exportArtBoardasImage(). They need to be trimmed afterwards, as they generally have a tonne of whitespace. Normally, I run an ImageMagick shell script (mogrify -trim). It'd be awesome if I could reproduce this functionality from within illustrator. I've seen people handle this by copy-and-pasting each object into a new file, sizing the artboard to that object, exporting, then closing the file. I'd rather not do this, as it's *way* too slow.
trying to have an applescript place a PDF as an Illustrator Link at the PDF's Media Box using "make new placed item". The only result possible as far as I can tell is a link at the PDF's Art Box.
I've seached around and have seen others with the same issue, but no answers as to whether it is actually possible. As with most Applescript stuff, I am either way overthinking it or it is not possible directly.
Currently I have a workaround using an Applescript script controlling Acrobat to sidestep the problem by setting the Art and Crop box to Media box, then place as a link in Illustrator, but it is not a direct route into illustrator.
I have also noticed that in the "Adobe Illustrator CS5 Scripting Reference" that the "PDF options object properties" do not honor the PDF crop bounds (except for the default value of Media Box). Is this an inherent problem with Applescript/Illustrator and PDF crop boxes? Could it be that the options for Open PDF and Place PDF are crossed?
I crop all my pics at 8.5 x 11.How can I change my default to that size instead of highlighting the crop overlay and changing it to 8.5 x 11 for each photo.
Having difficulty setting the CROP tool outlines. It seems to snap to the CENTER of pixels? and the edges are difficult to grab, especially when zoomed way in to the corners/pixel level. Also dragging the outline edges seems sluggish and I don't see four numerical readouts in the CORP tool palett like earlier Jasc versions.
p.s. I almost always crop to the hearest 5 pixels, i.e. 675x495.
I'm try to automate the importing of the Varaible and datasets into my graphs via Scripting, but the ImportVaraibles() function doesn't seem to work. Here is my Script, mostly copied from the example script provided with Illustrator (CS5). And, this works manually, using the file names in the script, via Load Variable Library
Set appRef = CreateObject(strIllistratorVersion)
'Open the file and import the datasets Set docRef = appRef.Open(strTemplate & "200-500.ai") 'docRef.Datasets.RemoveAll docRef.Variables("Yearbook").Delete
Here is the problem, after I delete the previous library, then this next line, right from the example, does nothing The script then exits with 'No Datasets in this document'
docRef.ImportVariables (strXMLFolder & "Lumber_200-500.xml") 'appRef.DoJavaScript "alert('Template:" & strTemplate & strRange & ".ai | XML file:" & strXMLFolder & "" & objFile.Name & "^')" If (appRef.Documents.Count > 0) Then Set docRef = appRef.Documents(1)
[Code]....
If I remove that delete line, the script runs, but just uses whatever Variables I had last loaded, not the XML file.
It's simply not loading. What do I need to do to get it to load?
with illy cs5.5 I suddenly can't start new files. The dialogue box opens huge and is blank. other windows are also corrupted. I deleted the prefs file with no change.
I was working on a project and using Smart Guides, but suddenly, they disappeared. I don't know what I did, the Smart Guide box is still checked in the View panel, and if I open a new document, they work just fine again. what other settings I should check?
the logos i created are suddenly no longer editable, neither paths nor text! i can select each element with the selection tool but anchor points don't show up so i can't edit them, and i can't select the text itself to edit it. nothing's locked, i've ungrouped everything, i can see the specs for everything. yesterday i used save to web a couple of times. today i started recreating the logos and it happened again after i exported (not save to web) once or twice. and today i can select the paths, but they're no longer a single path but a tracing, as if it was bitmapped and then traced. but i haven't rasterized or traced. and the type is still unselectable and uneditable as type. it happened again after updating. i have since reinstalled and reupdated, but i still have to re-create all four logos - and it's possible it could happen again! as it is, one "unrasterized" version of the logos allows me to select the paths but doesn't show the anchor points - and still won't let me edit the text.
I bought a macbook pro and the student suite about 3 months ago. They work fine together (better than the couple windows-adobe), but i've got a problem. Today colors of my macbook suddenly changes when i create a new web-profile file on Illustrator. I inspect my mac wtih the utility colorsync, and this was the result:
/Library/Application Support/Adobe/Color/Profiles/RedBlueYelllow.icc Etichetta 'pseq': Il profilo richiesto non è presente. Non può essere riparato. /Library/Application Support/Adobe/Color/Profiles/Smokey.icc Etichetta 'pseq': Il profilo richiesto non è presente. Non può essere riparato. /Library/Application Support/Adobe/Color/Profiles/TealMagentaGold.icc Etichetta 'pseq': Il profilo richiesto non è presente. Non può essere riparato. /Library/Application Support/Adobe/Color/Profiles/TotalInkPreview.icc Etichetta 'pseq': Il profilo richiesto non è presente. Non può essere riparato.
I've relaunched and tried re-installing Illustrator CC twice and didn't solve this unexpected crash problem. It has never happened since I paid for this software months ago.
Illustrator won't crash when: - using the keyboard arrows to manually move any path or drawn shapes/ objects - using my wireless mouse to draw objects/ new paths from clipboards, colour boards etc.
Illustrator CRASHES when: - using my wireless mouse and macbook's touchpad mouse to move any new or old drawn paths/ objects/ shapes/ lines etc.
In my Opinion - ROOT OF PROBLEM: - Wirelss and macbook's touchpad mouse cursor causees it to hang then crash 1 minute later.
Why would my mouse cursor suddenly be the cause of this crash problem when it was working fine all along?
Below is the error message, I use this software to run my design business.
All of the sudden I can't create a customer profile when creating a new document. Earlier I selecting the print profile. I tried opening a new document and creating a custom profile but that option is grayed out.
I created custom brushes yesterday but they don't appear today. Is that because of the profile that the brushes were created with and without that profile I won't see the brushes?
I'm creating a document with this background color #3399ff, and this color font #b4fff8. Neither of which sticks.They change slightly as soon as I close the color picker box. what I need to check?
is there anyway to keep the pen and brush setting remember as per layer , let say i have 2 layers of different stroke setting , after i draw 1 to another , it always revert to 1pt stroke width automatically .
i want to keep all the setting : transparency , color , stroke width to be remembered in layer . Therefore, i dont need to change again or remember whenever i draw in between layers.
The Print setting in Photoshop remember everything for the file once reopened like 'type of paper, color profile, etc.', but not in Illustrator. It doesn't save the information about the Printing Preferences set with the printer for the printed file.
I don't have CS6 yet, but I'd love ask if this can be done in CS6?
I'm having a problem changing brush settings back to basic, having pencil tool selected. Still I can draw basic line after I've clicked basic, but the line selection doesn't show. That occured after I chose the brush to be "Charcoal pencil". I still can change the brush to be anything else from the library (like different kind of calligraphics, inked, decorative brushed, even image brushed) but not back to basic. The width-settings are to uniform.
When I use the paintbrush tool, If I try to click "basic" and the straight line it simply does not do it no matter what, it reverts to 3pt round. Can you not use the basic setting on the paintbrush? Only the pencil?
I wrote the following AppleScript to open a PDF file and export is as PNG. I am using Illustrator CS5.
The export command gets an error: Adobe Illustrator got an error: Can't get current document. when it encounters the export command.
set inputFile to (choose file with prompt "Open PDF file to convert to PNG:") as text set exportFile to inputFile & ".png" tell application "Adobe Illustrator" if not frontmost then activate open inputFile as alias without dialogs export current document to exportFile as PNG24 ¬ with options {class:PNG24 export options ¬ , resolution:300 ¬ , matte color:{red:0, green:0, blue:0}} close current document saving no end tell
Im trying to add a pdf on top of an existing PDF in illustrator using a script. This is supposed to be done by anyone at my firm so that is why I want it in a script. I also have a lot of other functions that works that will do some other stuff with this document.
Created this from the scripting guide but it doesnt work. Im pretty sure its the embedDoc var thats empty and i dont understand why. Im not sure if the File "points" to the directory of the script or the original file but Ive tried both ofcoarse.
This is the masterpiece
var embedDoc = new File("/temp/testfile1.pdf"); if ( app.documents.length > 0 && embedDoc.exists ) { var doc = app.activeDocument; var placed = doc.groupItems.createFromFile( embedDoc ); }else {alert("suck")}
Is it possible to reference layers or groups by their names instead of their index using VBA? If so, what is the sytax? I know you can do it in Extendscript, but I'm not finding info for VBA.