Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


parameterising a function name?

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> parameterising a function name?
  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 >>
 parameterising a function name? - 6/27/2005 9:33:30 PM   
  pRdP

 

Posts: 5
Score: 0
Joined: 6/27/2005
From:
Status: offline
hi everyone,

this is my prob:

i have a function obj which takes a parameter, and looks up the parameter in a XML file, and performs the specific operation.

for eg,

obj("link1").click

this would look up the link1 in the XML file and identify the object on a web page and click it

now, i have this gui calender which has 31 links for 31 days

if i need to click day 3, i'd write obj("link3").click

now when i get the date as 12/23/2004, i want to parameterise the name of the variable, instead of writing a Select Case for 31 cases, something like:

dt = 12/23/2004
i = day(dt)

==> obj("link &i").click

how do i make the above step work(i know its wrong)? it should append the number to 'link' and execute it ...


any ideas [?][?][?]
 
 
Post #: 1
 
 Re: parameterising a function name? - 6/28/2005 3:12:16 AM   
  mbouchard


Posts: 1922
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
If I am getting you correctly, you want your end result to be something like, obj("link" & DAY).click where "link" & DAY would equal http://someurl/DAY.htm?

If that is the case you could do something like obj("link" & day(dt) & ".htm).click
Also, is link a variable from earlier in the script? i.e. Link = "http://someurl"
If so, then your line would be obj(link & "/" & day(dt) & ".htm).click

(in reply to pRdP)
 
 
Post #: 2
 
 Re: parameterising a function name? - 6/28/2005 4:57:29 PM   
  pRdP

 

Posts: 5
Score: 0
Joined: 6/27/2005
From:
Status: offline
Edit: obj(link & "/" & day(dt)) tried it, but not working


the line needs to dynamically insert number into the variable name:

obj(link & day(dt)) must be executed as obj("link1") when day(dt) is 1 at runtime

(in reply to pRdP)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> parameterising a function name? 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