Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Arrays - non variant - in VBScript

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,59401
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Arrays - non variant - in VBScript
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Arrays - non variant - in VBScript - 4/23/2008 4:05:43 AM   
  jeni

 

Posts: 5
Score: 0
Joined: 4/23/2008
Status: offline
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
 
 
Post #: 1
 
 RE: Arrays - non variant - in VBScript - 4/23/2008 5:06:55 AM   
  ebgreen


Posts: 4411
Score: 29
Joined: 7/12/2005
Status: offline
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

(in reply to jeni)
 
 
Post #: 2
 
 RE: Arrays - non variant - in VBScript - 4/23/2008 6:57:21 PM   
  jeni

 

Posts: 5
Score: 0
Joined: 4/23/2008
Status: offline
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 -- 4/23/2008 7:16:17 PM >

(in reply to jeni)
 
 
Post #: 3
 
 RE: Arrays - non variant - in VBScript - 4/24/2008 12:59:46 AM   
  ebgreen


Posts: 4411
Score: 29
Joined: 7/12/2005
Status: offline
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

(in reply to jeni)
 
 
Post #: 4
 
 RE: Arrays - non variant - in VBScript - 4/24/2008 1:02:43 AM   
  jeni

 

Posts: 5
Score: 0
Joined: 4/23/2008
Status: offline
Type mismatch 'cur'

(in reply to jeni)
 
 
Post #: 5
 
 RE: Arrays - non variant - in VBScript - 4/24/2008 1:11:41 AM   
  ebgreen


Posts: 4411
Score: 29
Joined: 7/12/2005
Status: offline
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

(in reply to jeni)
 
 
Post #: 6
 
 RE: Arrays - non variant - in VBScript - 4/24/2008 1:22:30 AM   
  jeni

 

Posts: 5
Score: 0
Joined: 4/23/2008
Status: offline
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.


:(

(in reply to ebgreen)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Arrays - non variant - in VBScript Page: [1]
Jump to:





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
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts