Link to home
Start Free TrialLog in
Avatar of KenTan85
KenTan85

asked on

How do write this javascript for illustrator???

I want to write a javascript in illustrator to perform the extract function in illustrator, is it possible???
screenshot.jpg
Avatar of sundaramkumar
sundaramkumar

Avatar of KenTan85

ASKER

Hi sundaramkumar, I know javascript can be written in illustrator, what I am asking here is how I can write it to do this particular "extract" function...
Avatar of David Brugge
That function stumps me, but it seems like you should be able to.

I suggest you pose the same question in Adobe's Illustrator Scripter's Forum: http://www.adobeforums.com/webx?13@@.3bbf2757

Their response rate is not that stellar because they don't give away tee shirts for every 900 correct answers [grin], but it's where the scripting experts are. You may have to post several times before you hit someone who knows.

Best of luck,
David B.
Orh, this is bad... Because I need the solution badly, it would take long before someone answer my question...
The problem of course is not that you need someone that knows javascript, but knows the tags where to make the calls for Illustrator. I've only messed with Illustrator a couple of times and both times, I had an Illustrator expert looking over my shoulder. Unfortunately, the guy has moved away and I haven't been able to get  hold of him.

I'd still hit the Adobe forum and keep your finger's crossed.

As a user of many answer forums, IMHO, this one is by far the best. But scripting for Adobe products is an area where we don't shine so bright.

Sorry.
Orh, it would be great if you could continue helping me searching for an answser for this, thanks a lot.
I have no idea if this will help, but a guy named Rick Johnson (rjohnson@execpc.com)
wrote a freeware program some time back that extracts both placed and embedded raster objects from Illustrator files. Unfortunately, it is not compatable with versions higher than Illustrator 7 or with Windows XP...
however, I would sure think he would be a good person to contact. He has a large collection of free scripts and actions for Illustrator. He certainly would know what is involved in the extraction process.

His web address is:

http://rj-graffix.com/software/windows.html#extractor
This is great, at least I know this can be done, his program do not seem to work anyway, wonder whether he would be great share the extraction part of javascript.
I don't know anything about the guy, but since he doesn't charge for his stuff, he seems like someone who just likes to write code to help out fellow illustrators. (of course I don't know how well he knows how to code, but he's the best thing that I've come up with so far.)
Could not contact him as it seem either email is no more there or is full already, hai~~ back to square one.
well, not quite square one, it seems to confirm that a script can extract files...at least up through version 9
I just wrote to the webmaster of one of the sites that he used to run (and may still run) asking them to forward a message to him. I'll keep you posted. In the mean time, I'll see what else I can find.

his site: http://www.sooline.org/home.html

Ok great, will be waiting for your good news then. Thanks
I reached Rick Johnson at rick@sooline.org

His reply:

"Thanks for thinking I could tackle something as complex as this, but its way over my head. I think it would be a huge effort as a script, and probably a major undertaking as a plugin as well. Id just use functions like select same paint style, etc, and turning off unwanted layers to narrow down the selection to extract whatever object needs to be isolated. I dont know of any easy way to do this for either a user or programmer. Best of luck with it, though,

Rick"
I would write to him anyway and tell him what you are looking for.
That is very resourceful of you, you could contact him at such a short time. It is great, it would be nice if we could have some clue to work on, let keep our finger crossed.
BTW - have you posted anything in the Adobe Illustrator Scripter's Forum? It seems like a good secondary avenue.
Yes, I did post on the adobe forum, there is still no anwser form them yet.
BTW  - what is it that you are trying to achieve? I'm curious as to when you would need to extract vector data from linked files other than when they were missing? And if that is the case, why not hide the linked file and trigger the Illustrator function?

Just wondering.
The reason for me to do this function is that I had a EPS file with linked path inside but I do not have the actual linked file. So when I open those EPS file and do a resave, those linked linked path is gone because the actual linked file is not there, that is why I need to extract out the linked file so when I do a resave, the linked path n file is still there.

Please advice me if you have any better idea.
Doesn't the Repair, Replace, Extract dialog come up when you first open these files? Can't you extract them at that time? Or am I missing something?
It is because I am doing a batch script to do convertion, therefore I cant possible let user sit down there and keep pressing the extract button dialog, therefore I need this extract function to be done in script.
How many files do you have. I would consider bidding the job out and letting someone do it for a few cents a file. The alternative seems to pointing towards hiring someone to write the code for you, and that's always a time consuming and chancy proposition.
I am sorry that this is impossible, as I had over 40 000 of files to convert.
> over 40 000 of files to convert

You're in trouble.

Have you ever used a service such as Rent-A-Coder?

http://www.rentacoder.com/RentACoder/default.asp

We use them all of the time where I work. We have a few top level coders ourselves (none that know anything about Illustrator), but we use them to design software and send it out for the grunt work.

It's worked out very well for us and at a fraction of what it would cost us to have it done in house or to hire someone here in the states.

I suggest it because you could put out a bid with the specifications and see if you can attract someone who knows Illustrator objects and methods.
That is why I am looking for scripts to see if anyone could have a solution to do this extract method, it would be good if I know which library in the illustrator library to do this, at least it will get me started.
With a little digging, I have managed to find out that the _document_ object keeps a separate collection of placed vector art and placed raster art. Vector items are available with the _placedItems_ collection and raster art is available in the _rasterItems_ collection.

You can use _getByName_ (name) and _index_ (item key) to get elements from the vector collection.
also _placedItems_ has a property named _file_ which "contains the artwork" I don't know if this file contains all of the elements and the bounding box or not, but it's worth a shot.


Here's some other things I found while digging around.

Extracting figures from postscript files:
http://www-hermes.desy.de/notes/extras/postscript.html

The pre version 9 file format specifications:http://partners.adobe.com/public/developer/en/illustrator/sdk/AI7FileFormat.pdf

Info about basic EPS and PS encoding conventions:
http://www.answers.com/topic/encapsulated-postscript?cat=technology

and of course, the javascript reference:
http://www.adobe.com/devnet/illustrator/pdfs/IllustratorCS3_JavaScript_Reference.pdf
How is Rick Johnson side???? still no news from him?
ASKER CERTIFIED SOLUTION
Avatar of David Brugge
David Brugge
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial