Arrays - non variant - in VBScript

Author Message
jeni

  • Total Posts : 5
  • Scores: 0
  • Reward points : 0
  • Joined: 4/23/2008
  • Status: offline
Arrays - non variant - in VBScript Wednesday, April 23, 2008 5:05 AM (permalink)
0
Apologies if this is already covered somewhere in the forum but I haven't been able to find it if it is....

I have an active X control that is dealing with merging data with a word document. The control is called TX Textcontrol.

I have a really annoying problem in that I need to find the current position of the caret which is helpfully given by the control in "CurrentInputPosition", but (and it's a big but) this is returned as an array of longs. Although my code can see that it has a vartype of 8195, it can see it's an array and its upper and lower bounds.... but i can't do anything with the actual values. I realise it's because vbscript only works with variant datatypes... but I'm at a loss as to how to get at the numbers inside this array.

Could anyone help or give me pointers? I'm afraid this is beyond my classic asp abilities (i'm used to .NET), I need someone's help!!

Many thanks in advance....

J
 
#1
    ebgreen

    • Total Posts : 8219
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    RE: Arrays - non variant - in VBScript Wednesday, April 23, 2008 6:06 AM (permalink)
    0
    Could you post some actual code of how you are trying to access the data and explain how it fails? Is there an error?
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2
      jeni

      • Total Posts : 5
      • Scores: 0
      • Reward points : 0
      • Joined: 4/23/2008
      • Status: offline
      RE: Arrays - non variant - in VBScript Wednesday, April 23, 2008 7:57 PM (permalink)
      0
      dim cur
         cur = objTX.CurrentInputPosition
         
         dim intvartype, intlbound, intubound, intCurrentPage     
        
      intvartype  = vartype(cur)
         intlbound    = lbound(cur)
         intubound    = ubound(cur)

      This returns 8195, 0 and 2 respectively
        
         intCurrentPage = cur(0)
      This fails with a "Type mismatch" error

      The object objTX is the TextControl object which deals with creating a word document, merging data etc. All that is working OK I just can't get at the values inside the (long) array that is returned from "objTX.CurrentInputPosition". I'm afraid I'm stuck with VBScript as this is a legacy system that I've been asked to change something on.....

      Is there a way I can put some kind of add in (dll????) that will take a long array and convert it into a variant type array??..... I'm at a loss how to go about that though..
      <message edited by jeni on Wednesday, April 23, 2008 8:16 PM>
       
      #3
        ebgreen

        • Total Posts : 8219
        • Scores: 98
        • Reward points : 0
        • Joined: 7/12/2005
        • Status: offline
        RE: Arrays - non variant - in VBScript Thursday, April 24, 2008 1:59 AM (permalink)
        0
        What do you get for:
         
        VarType(cur(0))
        "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
        Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
        http://www.visualbasicscript.com/m_47117/tm.htm
         
        #4
          jeni

          • Total Posts : 5
          • Scores: 0
          • Reward points : 0
          • Joined: 4/23/2008
          • Status: offline
          RE: Arrays - non variant - in VBScript Thursday, April 24, 2008 2:02 AM (permalink)
          0
          Type mismatch 'cur'
           
          #5
            ebgreen

            • Total Posts : 8219
            • Scores: 98
            • Reward points : 0
            • Joined: 7/12/2005
            • Status: offline
            RE: Arrays - non variant - in VBScript Thursday, April 24, 2008 2:11 AM (permalink)
            0
            Hmmmm.....annoying. Unfortunately I think you may be stuck with writing your own .Net component that will sit between the TextControl and your VBScript code to make it play nice with VBS.
            "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
            Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
            http://www.visualbasicscript.com/m_47117/tm.htm
             
            #6
              jeni

              • Total Posts : 5
              • Scores: 0
              • Reward points : 0
              • Joined: 4/23/2008
              • Status: offline
              RE: Arrays - non variant - in VBScript Thursday, April 24, 2008 2:22 AM (permalink)
              0
              hmmm.. yes.. after a day or so of beating my head against the computer I think i agree with you - vbscript just can't cope with that array that's been returned. I'll look into maybe doing a small .NET module that can be used.


              :(
               
              #7

                Online Bookmarks Sharing: Share/Bookmark

                Jump to:

                Current active users

                There are 0 members and 1 guests.

                Icon Legend and Permission

                • New Messages
                • No New Messages
                • Hot Topic w/ New Messages
                • Hot Topic w/o New Messages
                • Locked w/ New Messages
                • Locked w/o New Messages
                • Read Message
                • Post New Thread
                • Reply to message
                • Post New Poll
                • Submit Vote
                • Post reward post
                • Delete my own posts
                • Delete my own threads
                • Rate post

                2000-2012 ASPPlayground.NET Forum Version 3.9