Sign in to follow this  
Followers 0
alienkillaz

automaticly locate an .ini file

5 posts in this topic

if someplace in a scrpit calls for an iniread or iniwrite whats is the way to tell the script that the ini is located in the same dir as the script?

Share this post


Link to post
Share on other sites



if someplace in a scrpit calls for an iniread or iniwrite whats is the way to tell the script that the ini is located in the same dir as the script?

<{POST_SNAPBACK}>

Check the help file, there's an easy way to find the script dir (hint: @)

Share this post


Link to post
Share on other sites

; Look for an .ini file as scriptexename.ini:

$iniFileName=stringleft(@ScriptFullPath,stringinstr(@ScriptFullPath,".",0,-1)) & "ini"

; Alternatively, look for an .ini file in the same folder as the executable, but with a different name:

$iniFileName=pathonly(@ScriptFullPath) & "yourinifile.ini"

func pathonly ($pathtostrip)
If stringinstr($pathtostrip,"\") =0 then
 $pathtostrip = $pathtostrip & "\"
endif
return stringleft($pathtostrip,stringinstr($pathtostrip,"\",0,-1))

Share this post


Link to post
Share on other sites

closeupman gave a great hint.

@ScriptDir & "\INIname.ini"

Share this post


Link to post
Share on other sites

closeupman gave a great hint.

@ScriptDir & "\INIname.ini"

<{POST_SNAPBACK}>

thank you

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0