Copy link to clipboard
Copied
Greetings Illustrator Scripting Gurus,
Looks like the scripting forum has been pretty busy lately compared to just a year ago. Kudos to all who have been answering questions. I hope to get some time again soon to participate more than I have been able to lately.
So I'm not sure if I nailed the topic correctly in my subject so please allow me to explain. I have written an application in Visual Basic that interects nicely with Illustrator CS5.1, or at least it did until I installed Illustrator CS6 Trial. I will move to that version at some time in the future, but for now I still need to use CS5.1. Previously (prior to CS6 Trial install) I just used -- CreateObject("Illustrator.Application") -- to create an instance of Illustrator. After I installed CS6 Trial, the current version CS6 kept launching. So I figured - easy enough - so my line now reads -- CreateObject(My.Resources.CurrentVersionCS) -- where My.Resources.CurrentVersionCS = "Illustrator.Application.CS5". But still CS6 continues to launch instead of CS5.
I have given searching the forums a good "college try" to try to find the answer before porstiong but have come up empty. Could anyone lend some direction to this for me?
Thank you very much in advance!
TT
this is such a pain...it didn't work in mine either until...
CreateObject("Illustrator.Application.CS5.1")
...that did the trick
Copy link to clipboard
Copied
Anyone?
I hate to think that I have to uninstall CS6 as a workaround for this... Please - if anyone has any info on this please let me know. Thank you!
Copy link to clipboard
Copied
Sorry I can offer NO help… other than I think you should be able to do this… In ExtendScript I can check what versions of an app is installed and bridgetalk the one I want. In AppleScript I can just reference the app by its full path… I would expect that VB would have something along those paths. On the mac a pref launch services informs the system what to open a file with don't the pc have some app registry…? Carlos is the only regular poster here who knows vb…
Copy link to clipboard
Copied
Hi Mark,
I KNEW I could count on you for a reply -- even if you couldn't help. Thank you! At least I know that my forum subscription is still working! Maybe Carlos will be around soon. On a PC, extension "associations" are similar to what I think you are referring to on the mac as "launch services", but I am not sure. I have made sure that the default application for the .ai extension is set to the CS5 app and not the CS6 app, but still I get the CS6 app anyway. Ho hum...
Thank you for your reply, though, Mark!
TT
Copy link to clipboard
Copied
so, if you double-click on an ai file, it opens with CS5? but using VB it opens with CS6?
I can't test now, when I get home I'll try it, I have CS4 and CS5, though.
Copy link to clipboard
Copied
Hi Carlos,
Yes, that is the case. Actually, the scenario is that 1) I have AI CS5.1 open. 2) I launch my VB application, which creates the object as described above, and THAT attempts open AI CS6. To double (and quadruple) check, I have double-clicked on an .AI file and it opens with CS5. I've checked program defaults (extension associations) and CS5 is the default. Go figure.
I'll continue to trace it...
Thanks in advance for your insight.
TT
Copy link to clipboard
Copied
Could there be a default scripting version (e.g. 16.0) that I am neglecting to change an association that, when called, assumes AI CS6? Just hopelessly thinking out loud...
Copy link to clipboard
Copied
for my own personal way of working, I never need to launch a script without Illustrator being opened first. If you're in a similar situation, you could try using getObject instead of createObject, see if that grabs the illustrator version already running (CS5) instead of CS6.
Copy link to clipboard
Copied
Howdy Carlos,
Changing CreateObject to GetObject yields an exception error "Cannot create ActiveX component.".
What I have here is an application that is the backend of a design shop, complete with interactive and real-time pricing of designs and integration into an eComm package. There are many other things that the application does so sometimes the app is being used without AI being launched, and the operator can "pull in" AI automatically which will be launched on command. Similarly, sometimes (often, actually) AI is used by itself and the app is opened later. So it is used both ways.
I've not used GetObject before. If the app needs AI, it is just interested in the active document and doesn't know any file names. As I said, I've not used GetObject so I don't know what class name as an alternative to file name to use.
TT
Copy link to clipboard
Copied
you don't just change create with get
this is how to use it, open Illustrator CS5 first
GetObject(,"Illustrator.Application")
Copy link to clipboard
Copied
Carlos,
I had tried it both ways (with and without the comma for the blank path field) and still got the same error. After your reply, I decided to leave AI CS5 open, but this time open CS6 as well when calling the script. When I do "that" with the GetObject(), I do NOT get the exception error, however it still only grabs AI CS6 and NOT AI CS5, even though the GetObject string (or CreateObject string as in my original example) is "Illustrator.Application.CS5".
TT
Copy link to clipboard
Copied
this is such a pain...it didn't work in mine either until...
CreateObject("Illustrator.Application.CS5.1")
...that did the trick
Copy link to clipboard
Copied
Carlos,
You remain... "the man". Thank you for your persistence. I can't remember for sure, but I honestly think that I even tried CS5.5 and that didn't work -- never thought of CS5.1. I figured that a minor version change from 5 to 5.1 would be in the same CS5 "family". It would sure be nice if there was even the slightest HINT of that in the documentation!! Before I posted I even downloaded the docs for CS6 to see if there was a syntax change there, but NO mention. Ugh!
Well, many thanks to you again, Carlos.
TT
Copy link to clipboard
Copied
thanks...I went the exact rout you described without success, I had to resort to going to the registry as Mark suggested to see if could spot something, not really sure what I was looking for...bingo.
...that should have definitely been mentioned in the Guide.
Copy link to clipboard
Copied
AI was one of the apps that didn't get an update when they released CS5.5 so instead of leaving it as CS5 they gave it the number CS5.1. Go figure.
Copy link to clipboard
Copied
Carlos,
As a followup to this, you may want to make note of the following:
will both open the latest installed version if not open. I suppose most other AI interfaces will as well. The strange part (at least for me) is the syntax that is needed to get around it, also not mentioned in the docs, I don't think.
You need:
I guess I would have expected the following to follow the hierarchy, but this does NOT work:
Anyway -- FWIW.
Thanks.
-TT
Copy link to clipboard
Copied
good to know TT, thanks for sharing
Copy link to clipboard
Copied
you are MOST welcome!