--- In [email protected], "Sheri" <sheri...@...> wrote:
>
> Do you think functions such as com.string(variable),
> com.double(variable), etc., would be worthwhile?
>
> e.g.,
>
> local r=myselect.Search(com.string(chgVec[i,1]), wholeword,
> casesensitive, com.string(chgVec[i,2]))
or, maybe more generic, com.typearg("string", chgVec[i,1])
I tried the following in vbscript. With quotes around the 123 on line 3, it
works perfectly. Without the quotes I get the error box shown after the
scriptlet. So the user is effectively setting the type, even though vbscript
doesn't allow variables to be Dim'ed "As" a type.
option explicit
Dim appRef, myselect, r, SFor, wholeword, casesensitive, STo
SFor = 123
wholeword = 1
casesensitive = 1
STo = "abc"
' Note Indesign is already running with a TextFrame selected
Set appRef = CreateObject("Indesign.Application")
Set myselect = appRef.Selection.Item(1)
Set r = myselect.Search(SFor, wholeword, casesensitive, STo)
appRef.Activate
MsgBox "Number of replacements processed:" & r.Count
Set myselect = Nothing
Set r = Nothing
Set appRef = Nothing
---------------------------
Windows Script Host
---------------------------
Script: C:\TestIndesign.vbs
Line: 11
Char: 1
Error: Invalid value for parameter 'For' of event 'Search'. Expected String,
but received 123.
Code: 800A770D
Source: C:\Program Files\Adobe\Adobe InDesign CS2\InDesign.exe
---------------------------
OK
---------------------------