Copy link to clipboard
Copied
Hi
I'm Loay
I want to learn VBscript on Illustrator
But I do not know where to access
any one can help my Please.
Copy link to clipboard
Copied
You will need to download the appropriate info from the devnet…
Copy link to clipboard
Copied
Thank you
I download the "Adobe Illustrator CS5 Reference: VB Script (PDF, 2.0M)"
Copy link to clipboard
Copied
Oh you will have to wait for someone else to answer that question… Sorry Im mac so 0 about VB
Copy link to clipboard
Copied
are you familiar with VB, VBA or VBS already? do you have MS Office?
Copy link to clipboard
Copied
Hi
yes, in VB and VBA, and I have MS Office, and working VBA under CorelDraw X5, in Win7
I want to make Script under Illustrator CS5
Thank you for all
Best Regard
Copy link to clipboard
Copied
good, you can use any of them, not sure about Corel VBA, you could try and let us know
to use VBS, any text editor like Notepad would do, I use Notepad++. Code your hear away and save a file (myAiScript.vbs for example).
to use VB you could use VB express edition...same as above, save myAiScript.exe for example.
I prefer to use VBA, since I always have Excel open, I use its editor. To make a hello world script with excel VBA
- Open Excel
- hit Alt+F11, to bring up the editor
- in the Tools menu, click on References...
- add a reference to "Adobe Illustrator CS5 Type Library"
- in the Personal.xls (or in any other book) add a Module
- and type the following in that module
Sub helloWorld()
Dim iapp As New Illustrator.Application
Dim idoc As Illustrator.Document
Dim iframe As Illustrator.TextFrame
Set idoc = iapp.ActiveDocument
Set iframe = idoc.TextFrames.Add
iframe.Contents = "Hello World from Excel VBA!!"
Set iframe = Nothing
Set idoc = Nothing
Set iapp = Nothing
End Sub
- open Illustrator and create a new document first
- to run, move the cursor anywhere inside the Sub and hit F5
Copy link to clipboard
Copied
Thank you very much
its so easy
Best Regard
Loay
Copy link to clipboard
Copied
Dear Carlos
How can I save the script?
Best regard
Copy link to clipboard
Copied
vba? you don't save it, you run it from Excel. I mean, you don't save it as a "stand alone" script, you save the workbook where you added the module.
Copy link to clipboard
Copied
Separation,
Just a side thought too -- not to steer you away from the guidance of Carlos and Muppet Mark -- these guys are incredibly talented and SOOO generous with their time to others it's amazing! But if you are comfortable with VB, you could also develop in VB if you use an IDE (like VS2010 I know works and probably most others), and save the project. While I've never compiled for distribution, you could probably do that too. The only thing is that you have to run the VB runtime concurrently with AI. I don't have a problem doing that. The nice thing about developing in VS is that you get the benefit of the full DOM and full code hinting -- great for not-so-smart guys like me. Again - just a thought.
Best of luck,
TT
Copy link to clipboard
Copied
Hi all
Thank you for your time
I have some problem
the "Adobe Illustrator CS5 Scripting Reference, and Guide" don't explain all command and method, and i search for vbscript in Illustration but I don't found it.
I'm not professional in VBS, commands, method
so I failed to get my Script
Please can you help my the solve this point.
Best Regard
Copy link to clipboard
Copied
You will need to provide a fuller explaination of what you were hoping to achieve? Just a list of steps I don't do VB but the object model is the same in all the laguages…
Copy link to clipboard
Copied
Here's a link that should provide most of the documentation you'll need:
http://www.adobe.com/devnet/illustrator/scripting.html
I think that the scripting reference files are also included in the installation files somewhere in your install directory, but I don't remember for sure, so the link will help you in case you don't find them. You will need the 1) Scripting Guide of the CS version that you have that gives you an overview and 2) the Scripting Reference for the scripting language of choice.The Object model is mostly the same in all languages; there are some subtle differences in which one language has access to something that another does not, but that is the rare exception.
Hope this helps.
TT
Copy link to clipboard
Copied
ThinkingThings, thanks for your comments, to use a VB project or to distribute it to other users, it would need to be compiled into an exe program and double clicking on will launch it , or we could also place the exe file into the scrips folder and run it from the File->Scripts menu (I guess), and yes the users should have the runtime libraries, but these days I think all windows machines have them.
Separation, what happened? you said it was "easy" , kidding, as posted above, everything, and I mean everything is in the Documentation. If you have trouble finding and/or implementing what's in there, then ask a specific question and we'll try to help.
if possible, post your code, we might be able to spot the problem.
Copy link to clipboard
Copied
Hi Carlos,
Yeah, I thought that I would just offer that up as a possibility. I pretty much have VS open all day. SInce I just use my scripts for me, I typically just F5 to run a debug build in VS and it floats a Windows Form which I can minimize, so that when I am working in AI I can just bring the WinForm up and have a type of "control panel" complete with buttons, etc. which run different scripts. It's my way of not having to learn (yet at least) how to write extensions, I guess. So for me it's easier and more flexible.
Anyway... FWIW.
TT
Copy link to clipboard
Copied
Good Morning every one
Thank you for your response, I'm not said, I'm "Enthusiastic"
Sir, before 1 year I used the VBA under CorelDraw X5, and it good in my job, we learn to write the code and Macros from the "CorelDraw X5 Macros Help" its easy, and I and my girl friend create good Macros with Excel data file and other applications.
When I used "Adobe Illustrator CS5", I found it toooooooo easy to make my job with excellent degree, so I'm try to find "Macros help" but no way yet, yes the Reference and Guide have a rich information, but I'm need "Macros Help" to make my a good basement. and go with us.
Best Regard
Copy link to clipboard
Copied
I'm not familiar with Corel, but if you're looking for Macros as in Excel Macros....there's no such thing for Illustrator. The closest thing to Macro Recording is called "Actions" but in the usual Illustrator fashion it is very limited, you don't get to modify what's recorded...you're only able to "play" the recorded steps.
so, in short, there are no Macros in Illustrator.
Copy link to clipboard
Copied
OK
I'll be re read the Guild and Reference
But I want to used a "ArtboardRect", how can I identify the size and position for this command?
Thank you and Best Regard
Copy link to clipboard
Copied
Sub scaleArtboards()
Dim iapp As New Illustrator.Application
Dim idoc As Illustrator.Document
Dim ab As Illustrator.Artboard
Set idoc = iapp.ActiveDocument
Set ab = idoc.Artboards(1)
abW = ab.ArtboardRect(2) - ab.ArtboardRect(0)
abH = ab.ArtboardRect(1) - ab.ArtboardRect(3)
MsgBox "width = " & abW
MsgBox "height = " & abH
Set ab = Nothing
Set idoc = Nothing
Set iapp = Nothing
End Sub
Copy link to clipboard
Copied
Dear Carlos
thank you
Sorry, but the code not work?
Best Regard
Copy link to clipboard
Copied
Hi, yes it will not work like that...we have been talking VBA since the begining, Notepad++ is used for stand alonde vbs.
follow my instructions in my first VBA sample and see if you're able to make it work.
or let me know if we forget the whole thing about VBA and start all over creating a working vbs sample.
Copy link to clipboard
Copied
Dear All
That is right.
I'm still now confused and puzzled, which editor I'll be used, and did I use VBA or VBS or any....
Please can you show my the way to start from begening.
Best Regard
Copy link to clipboard
Copied
Hi Loay, if you're confused, read everything I've posted again, what is it you don't understand?
...I'll give it one more try....
this time open Notepad++ and paste the following VBS script, save it as lastChance.vbs, save it in your default script folder, restart illustrator and go to File->Scripts and click on your script
Set iapp = CreateObject("Illustrator.Application")
Set idoc = iapp.ActiveDocument
Set ab = idoc.Artboards(1)
abRect = ab.ArtboardRect
abW = abRect(2)-abRect(0)
abH = abRect(1)-abRect(3)
MsgBox "width = " & abW
MsgBox "height = " & abH
Set ab = Nothing
Set idoc = Nothing
Set iapp = Nothing
Copy link to clipboard
Copied
Hi Carlos
thank you for this code, then how can I create 2 Artboard size A3, landscape, 25mm between them?
Best Regard