Illustrator Scripting :: Reading A File Containing BridgeTalk
Feb 6, 2013
I have a scriptUI generated palette which contains 26 icons linked to their respective scripts. When an icon is pressed, it invokes the required script via this:
searchPanel.children[0].onClick = function(){
searchOne.open("r");
var bt = new BridgeTalk;
[Code].....
My other scripts have "normal" functions that don't cause any problems, so I'm assuming it has something with BridgeTalk being loaded inside the palette function (since the code that's read in from the file is inserted at the location from where it's called).
I now understand about serializing the message, and loading and running external scripts via opening, reading, and sending them within the context of BridgeTalk.
I have a palette window which contains a listbox of items that searches and lists the contents of over 400 products. This pic of the template below is typical for all items. The imprint area shown will change depending on the product.
Script #1: When the user selects a product from the list, that selection is used to open a file (illustrator template) for that item that shows a guide path box with height and width information for the imprint area on the product. The currently opened illustrator document contains the artwork they are working on at the time. This artwork is copied and pasted to the newly opened template file.
Script #2: This script contains an array of all the products in the palette list. Within each index of that array, each item will contain the following information:
Example (the name property of each item will match the name of the index box selection from script #1):
var itemArray = new Array(); //p may be saved at index 0 of itemArray var p = new Object(); p.name ="P- Shape P"; p.width = 189; p.height = 103.5; p.pos = [300,564];
I need to send the selection from script #1 to script #2 so I can loop through the array and find a match, at which point the information stored in the properties of the item will be used to scale the art and place it in the correct position on the template. Is there any way to send a variable from script #1 containing the name of the selection via BridgeTalk and have it stored in a variable in script #2? If not, I read somewhere where it might be possible to write/save it to disk and have the second script read it.
I'm new to scripting What I want to do and don't know how to go about it is to run a script that collects the saved file name and the full path where the file is saved on the network and displays it on my document.
I added CS6 COM reference in my VB.NET application and after that I have the following basic object creation in order to convert a eps file to svg. But for some reason when I create this COM object it is launching the Adobe Illustrator application. Why it is doing like this? It’s a simple COM object why it is interacting with Illustrator Editor?
My problem is to display graphic arts in "read only mode". That means when I'm done developing graphics in my .eps file, I want to display this graphics to other user without giving him option to edit it or delete it.
I'm trying to accomplish this true Visual Studio 2005, C# .net
When I open a PDF file I get the following warning:
The document contains PDF objects that have been reinterpreted.
- The font is missing
Can I somehow open the file without showing that error, or simply automate and click OK on that window? I am using C# with COM reference. See code below:
var iapp = new Illustrator.Application(); var idoc = iapp.Open(file, Illustrator.AiDocumentColorSpace.aiDocumentRGBColor, null);
how to place an image into illustrator via scripting with javascript, however I am having difficulties with text files. My code is:
var myDoc = app.activeDocument; var Layer1 = myDoc.layers[0]; function getTextFile() { return File.openDialog('Please select the text file to be imported:', undefined, undefined); } var myTextfile = getTextFile(); var myPlacedFile = Layer1.placedItems.add(); myPlacedFile.file = myTextfile;
But when I select a text file, it says it is an unsupported format. I'm assuming it has something to do with the extra options that come with importing a text document, specific for .txt and .doc for example.
For what it's worth I was working on an alternate method by read() ing in the contents of the .txt file and setting them equal to the contents of a textFrame, however it imported the text without carriage returns/newlines and I haven't been able to result that issue.
I am using following code to convert AI file to JPEG
exportFileToJPEG('~/Desktop/Harsh/1.jpg');
function exportFileToJPEG (dest) { if ( app.documents.length > 0 ) { var exportOptions = new ExportOptionsJPEG(); var type = ExportType.JPEG; var fileSpec = new File(dest);
[Code]...
but ir crope the document to the size of the image and resize the ArtBoard to the size of Image.
I want to convert the Existing ArtBoard Area only , i dont want to crope the image.
I want to execute a .JSX file by using Mac Terminal Command like i am doing in MS Windows by using following cmmand: C:/ start illustrator.exe Script.jsx
its working fine but i want to do the same thing in MAC, i am working on an Application in that I am using CS6 SDK to add some functionality in my Adobe Illustrator, but didnt find any method to execute JSX files directoly from VC++/CS6 SDK.
I have a simple script that I need to run when a file is opened in illustrator(cs5) on windows 7. I tried adding the script to the "startup scripts" folder but that only executes when a new instance of illustrator is started. If illustrator is already open and I go to "file/open", the script doesn't run.
I'm trying to read a text file into a textFrame. It reads in but is not including linefeeds so it's just one big long line of text. I'm using the following code to read the file. I attempted to insert a character after each readln() but that didn't work. I also tried creating a variable that the readln() was stuffed into before setting the textFrame.contents to the variable, but that didn't work either. I'm stumped.
while (! notesDoc.eof) { noteTextRef.contents += notesDoc.readln();}
So I deal with a lot of files each day that need to be saved according to their lead code, meaning that there is a folder that holds thousands of sub folders that have the same name as this lead code on a server.
So since I have the lead code in the file name I'm trying to use that in conjunction with the file path to tell illustrator where to save it with Javascript. Also the idea of a dynamic save path is useful.
Here's what I've got so far, it's not working yet but I feel like I'm close.
/*///////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// Dynamic Save Path//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////*/ #target illustrator
I want to save Current open Document on remote location (on server).
I am able to save it on my local machine(the machine i am presently working on).
Now I want to save it on some remote server.
I am using following code for that:
var doc=app.activeDocument(); var aiSaveOptions1=new IllustratorSaveOptions(); var aiFile1 = File( '/osn-pc-16/adobe/1/Original.ai' ); doc.saveAs(aiFile1,aiSaveOptions1)
I'm using a Javascript that will export as JPG a series of images from an AI file (that part is working fine), then rename them (that part isn't working). Writing and troubleshooting with Extendscript.
Trying to eliminate as many possible places to go wrong, I came up with the following:
myfile = new File; myfile = myfile.openDlg(); var newName = "NEW.ai"; myfile.rename(newName);
When run targeting Illustrator, it does nothing.
When run targeting ExtendScript, for some reason this blasts the file into oblivion, never to be found again.
I created and array to receive linked filed (let´s say var pItem = app.activeDocument.placedItems;)
After it, I used a loop to know the File each link is associated. So:
for (var g=0; g<pItem.length;g++){ var src = pItem.file >>>>>>>>>>>>>>>>>>> The problem is here. If we have a missing link in the document, the script will stop with the message. ... continue procedure };
Of Course, I could try using an "try" statement...but..Just to know: Is there any way to evaluate the status of a placedItem (to know if it´s missing or not)?? In the user manual I did not find any property that checks for this. We have properties to check for bounds, matrix, notes, tags, if it´s locked, visible...but not for checking the consistency of a placedItem, right?
Is it possible to have a script that would split up an Illustrator file that contains a number of groups of elements into individual files... for example, here is a download link for a file that has different types of moustaches and I want each moustache as an individual file... I have hundreds of Illustrator files like this that have 4, 8, 15, 20 or more illustrations all bunched onto the one file that I need to split up. I'm using CS4 [URL]....
I'm trying to figure out if Javascript is my answer to my problem. I've been able to re-write all my Applescripts that manipulate Illustrator except for the ones the need to use the file system. We have switched to PC's at work and now I'm forced to figure this out. Our art files are saved with a 7-digit number, followed by the name of the art in the file. Ex: 1000049-Bob's Garage. My applescript had a recursive loop that worked it's way down through the file structure on our art server until it found the lowest folder to which it belonged, then saved itself there. Here's an example of how the server file structure (these are folder names) is layed out:
1000000-1004999 1005000-1005999 1010000-1014999
and so on.
The script would load all the foldernames in the first tier of the directory, loop through them and look at the first and last name of each these folder names, then compare the Illustrator filename to them. If my file was between the two, then the loop called itself, loaded the folders inside that folder, and by doing so, worked it's way down through the folders, through the tree structure until there where no more folders. At that point, the file was saved, in order, where it should be.
For photoshop, there's URL... (scroll down to "ActionFileToJavascript") which can convert recorded photoshop actions into jsx. Is there any such resource for Illustrator?
How do I read input parameters from a script file name? For example, let’s say I want to run a script that requires 3 variables as input, but rather than prompting for the values I wish to read them from the script file name … e.g., the file name might be “Myscript.js (my_variable1, my_variable2, my_variable2)” … where variables are all real numbers. So I assume the script name when run should look something like … Myscript.js (10, 10, 100), but how do I then read these and assign these values to a var statement within the script?
var doc = app.activeDocument; var destFolder = Folder ("~/Documents");
if (destFolder) { var fileName = activeDocument.name; var destFile = new File(destFolder + '/' + fileName);
[Code] .....
This code I created exports my current Ai document as a PSD with set options. It also names the new file what it is called in Ai.
How can I call the created file and open it directly in Photoshop? Keep in mind I would be working on multiple files, so file names would change every time I ran this Export Script.
I could call a specifically named file and open that, but that's not what I need this script to do. I just need it to open the newly created PSD file.