Article View: adobe.scripting.indesign
Article #18881Fumbling first steps (VB)
From: Scott Hofmann
Date: Sun, 16 Feb 2003 06:23
Date: Sun, 16 Feb 2003 06:23
24 lines
2258 bytes
2258 bytes
OK I took Ole's advice and i'm attempting to understand VB to do some basic scripting for InDesign but i can't seem to even get the "Hello World" to run. I'm sure it is something silly but i need someone to point out to me what i'm missing. Here is what i've done so far:
- Installed the VB5CCE and the Help docs on my system.
- Opened up a new project file(standard exe)
- Added a CommandButton. Double Clicked on the button to see the code.
- Pasted in the text that was in the PDF scripting guide "hello world" example.
Private Sub Command1_Click()
Rem Hello World!
Dim myInDesign As InDesign.Application
Set myInDesign = CreateObject("InDesign.Application.2.0")
Rem Create a new publication and assign it to the variable "myDocument"
Set myDocument = myInDesign.Documents.Add
Rem Create a new text frame and assign it to the variable "myTextFrame"
Set myTextFrame = myDocument.Spreads.Item(1).TextFrames.Add
Rem Specify the size and shape of the text frame.
myTextFrame.GeometricBounds = Array("0p0", "0p0", "18p0", "18p0")
Rem Enter text.
myTextFrame.TextContents = "Hello World!"
End Sub
then i tried to Run/Start from the VB menu and it presents me with the button i made. I click on the button and get a message saying "User-defined type not defined" with the fisrt line of the code highlighted in Yellow.
So can someone kindly explain how i should have defined a type and what this means so i can proceed to the next step and eventually see the "hello World Script functtion?
- Scott
Technical Details
Message-ID:
<1de7dfc5.-1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,4b69acda5083344f,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-02-15 22:37:26 PST From: "Scott Hofmann" <shofmann@ccli.org> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Fumbling first steps (VB) Message-ID: <1de7dfc5.-1@WebX.la2eafNXanI> Date: Sat, 15 Feb 2003 22:23:44 -0800 Lines: 33 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit