uplink477 Posted March 26, 2008 Posted March 26, 2008 Ok guys so basically i need help trying to get my Autoit script to define functions from an ini file. here is what i have so far :config.ini [functions] _get()=inetget("http://www.google.com/index.html","C:\index.html",1,0) :Script.au3 $var = IniReadSection("config.ini", "functions") For $i = 1 To $var[0][0] MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1]) $Name = $var[$i][0] $func = $var[$i][1] func $name $func EndFunc Next _get() Any help would be greatly appreciated.
Valuater Posted March 26, 2008 Posted March 26, 2008 (edited) You cannot "call" a function from an ini file, however, you can have functions in the script that can be "called" and that function can use parameters from the ini file ;[functions] ;_get()="http://www.google.com/index.html,C:\index.html,1,0" Dim $Name, $Func $var = IniReadSection("config.ini", "functions") For $i = 1 To $var[0][0] MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1]) $Name = $var[$i][0] $Func = $var[$i][1] Call($Name) Next Func _Get() $Split = StringSplit($Func, ",") If $Split[0] <> 4 Then MsgBox(0x0, "error", "The ini file has an incorrect number of parameters ", 5) Return EndIf InetGet($Split[1], $Split[2], $Split[3], $Split[4]) EndFunc ;==>_Get 8) Edited March 26, 2008 by Valuater
uplink477 Posted March 26, 2008 Author Posted March 26, 2008 i see what you mean. but i was more looking for a way to sort of store functions for later look up and use? wow i think my head is going explode if i think about this anymore
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now