Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Evaluating a String as if It Was a Function

Status
Not open for further replies.

Michael42

Programmer
Oct 8, 2001
1,454
US
Hello I have a text file I read using FSO. In it I would like to have a parameter for a default value where I can specify an ASP function like Date or Time (or a custom function).

The file looks something like this:
default1=date()
default2=myCustomFunction()

I can easily read the value into a variable (sDefault1) doing something like this sDefault1=iniFile("default1"). Note: iniFile() is a function I wrote to read text files.

How can I evaluate\use a string value that represents a function?

Another way to put this would be, what is the syntax to make the string variable sDefault1 run as a function?

Thanks very much for your advice,

Michael
 
Check this:

[thread333-177353] This is not a bug - it's an undocumented feature...
;-)
 
Wow! This is great stuff!!! Below is a test that I used to confirm it is working. I did not even know the EXECUTE command existed as such.

Dim sDate, xDate
xDate = "sDate = Date()"
EXECUTE xDate
Response.Write sDate & &quot;<br>&quot;


Many, many thanks,

Michael
 
You're welcome ;) This is not a bug - it's an undocumented feature...
;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top