Announcement

Collapse
No announcement yet.

Another VB Script to PowerBasic Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Mattias
    replied
    Note that in InDesign......
    Doesn't change the admonition... sometimes the best way to "port" code to another language or operating system is to look at the problem and solve it in the new environment.

    Leave a comment:


  • Stuart McLachlan
    replied
    Originally posted by Robert Wallace View Post
    (One definition on the Net (not Adobe) says that "FindText" returns an "Array of Text")
    Note that in InDesign , "Text" is not a string of characters, It's a complex object with a coupe of hundred properties, some of which are themselves arrays of other objects.

    http://jongware.mit.edu/idcs6js/pc_Text.html

    Leave a comment:


  • Stuart McLachlan
    replied
    Originally posted by Michael Mattias View Post
    E.G.

    PB's 'TALLY' function will give you that.
    In an Adobe InDesign DTP document? I doubt that.

    Leave a comment:


  • Michael Mattias
    replied
    E.G.
    Code:
    MsgBox ("Found " & CStr(myFoundItems.Count) & " instances of the search string.")
    PB's 'TALLY' function will give you that.

    Leave a comment:


  • Michael Mattias
    replied
    Just in general..

    Don't always assume the best way to get the job done is to mindlessly port the VB script to PB. Maybe there is a better way to accomplish .. um, whatever it is this code is trying to accomplish.

    MCM

    Leave a comment:


  • Robert Wallace
    replied
    Using VARIANTVT function I found out that "list" contained IDispatch (9).

    I re-wrote the code as follows:

    Code:
    LOCAL vtemp AS VARIANT
    LOCAL mytexts AS DISPATCH
    LOCAL mytext AS DISPATCH
    .....
    .....
    OBJECT CALL myDocument.FindText TO mytexts
    OBJECT GET mytexts.count TO vtemp
    j = VARIANT#(vtemp)
    FOR k = 1 TO j
       OBJECT GET mytexts.item(k) TO mytext
       OBJECT GET mytext.contents TO vtemp
       MSGBOX "Found word" & STR$(k) & ": " & VARIANT$(vtemp)
    NEXT k
    I now have to try and find which page each word is on!!


    Leave a comment:


  • Stuart McLachlan
    replied
    Use a PowerArray object ? COPYFROMVARIANT ?

    Leave a comment:


  • Robert Wallace
    started a topic Another VB Script to PowerBasic Problem

    Another VB Script to PowerBasic Problem

    I have spent over a week trying to solve two lines of code!

    VBScript snippet:

    Code:
    Set myFoundItems = myInDesign.Documents.Item(1).FindText
    MsgBox ("Found " & CStr(myFoundItems.Count) & " instances of the search string.")
    COM Browser:

    Code:
    MEMBER CALL FindText <1181639764> (OPTIONAL IN prm_ReverseOrder AS VARIANT<0>) AS InDesignObjects ' <dispinterface>
    My Code - I have tried two ways:

    Code:
    LOCAL list AS VARIANT
    DIM listarray(1 TO 100) AS VARIANT
    .....
    ....
    OBJECT CALL myDocument.FindText TO list
    or

    Code:
    OBJECT CALL myDocument.FindText TO listarray()
    How do i define "myFoundItems" so that I can get "myFoundItems.Count" in PowerBasic?

    (One definition on the Net (not Adobe) says that "FindText" returns an "Array of Text")

Working...
X