Jump to content
Sign in to follow this  
alienkillaz

automaticly locate an .ini file

Recommended Posts

alienkillaz

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
closeupman

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
IanR

; 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
MHz

closeupman gave a great hint.

@ScriptDir & "\INIname.ini"

Share this post


Link to post
Share on other sites
alienkillaz

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.