🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #19246

Re: Another Scripting Newbie

#19246
From: Olav Kvern
Date: Sat, 28 Dec 2002 09:48
45 lines
2779 bytes
M--

re: "Ole, pg. 9 first VB example, line 3. Isn't that missing a "= 0 Then" ? for it to work?"

I'll check--I lost odd characters when I converted the text from FrameMaker (don't get me started...) to ID for 2.0.

re: "1 What does "Dim" mean?"

Dim declares a variable as a specific type. In VB versions prior to .NET, it's optional. When you define a variable type, you get some speed improvements, but it can be less flexible than working with types that define themselves by context (which is how I think a scripting language *should* work, how VBScript *does* work, and *NOT* how VB.NET works).

As a side note, when you Dim a variable, you'll get all of the nifty pop-ups for object properties and methods--type the variable name followed by a period, and VB will pop up a menu of possible choices.

re: "2 Set myInDesign = CreateObject ("InDesign.Application.2.0") seems to be at the fore of every script. What does it do?"

In order to have an object to talk to, you have to create (or "instantiate") it. That's all.

re: "This a script that I made a long time ago..."

Something ilke this?



Dim myInDesign As InDesign.Application 
Set myInDesign = CreateObject("InDesign.Application.2.0") 
Rem Display a message box. 
myResult = MsgBox("This script will change every story in the document. Do you wish to proceed?", vbOKCancel, "Change All") 
If myResult = vbOK Then 
    Rem Clear Find/Change options 
    myInDesign.FindPreferences = idNothing 
    myInDesign.ChangePreferences = idNothing 
    Set myDocument = myInDesign.ActiveDocument 
    Rem Loop to fill in the number string. 
    For myCounter = 0 To 9 
        myDocument.Search "," & CStr(myCounter), False, False, ",^<" & CStr(myCounter) 
        myDocument.Search "." & CStr(myCounter), False, False, "," & CStr(myCounter) 
        myDocument.Search CStr(myCounter) & "%", False, False, CStr(myCounter) & "^<%" 
    Next 
End If 




Thanks,

Ole
Technical Details
Message-ID: <1de72635.0@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!oleane.net!oleane!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de72635.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,c9870728ff2b487a
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-12-28 02:07:37 PST
From: "Olav Kvern" <okvern@adobe.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!oleane.net!oleane!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Another Scripting Newbie
Message-ID: <1de72635.0@WebX.la2eafNXanI>
Date: Sat, 28 Dec 2002 01:48:36 -0800
References: <1de72635.-1@WebX.la2eafNXanI>
Lines: 55
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit