AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

reading INI in the same working directory

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
AHK newbie
Guest





PostPosted: Mon Mar 15, 2010 2:54 am    Post subject: reading INI in the same working directory Reply with quote

Hi.. I am a newbie in AHK..
I was trying to design a program, this program will read all the directory from INI file..

But to start of, I first need to locate the setup ini file. In order to do this, I got to hard code the setup ini file into the code.
Is there a way for me to do it?

Like for example, i managed to read a script from the same working directory for AHK script using

Code:
%A_script%/test.ahk


but when I try to apply this to ini file

Code:
setup:=%A_script%/setup.ini
IniRead,dir,%setup%,test section,key


It seems like setup:=%A_script%/setup.ini does not work for INI file.. it shows me "setup.ini" contains illegal character.

Is there a way for me read the setup.ini in the same working directory?
Back to top
answer4u
Guest





PostPosted: Mon Mar 15, 2010 3:05 am    Post subject: Reply with quote

Have you tried the Built-in Variables? Also, this following is incorrect syntax:
Code:
setup:=%A_script%/setup.ini
You prolly meant:
Code:
setup = %A_ScriptDir%/setup.ini
; -OR-
setup := A_ScriptDir "/setup.ini"
Back to top
Tuncay



Joined: 07 Nov 2006
Posts: 1886
Location: Germany

PostPosted: Mon Mar 15, 2010 3:20 am    Post subject: Reply with quote

just to mention, windows uses backslash for pathes (this is "\"). Normal slashes are accepted mostly, but sometimes not.
_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Guest






PostPosted: Mon Mar 15, 2010 3:31 am    Post subject: Reply with quote

Making up your own AHK variables? Using *nix slashes? Man, get a grip on reality.
Where do you find A_Script?? Look at the help file! A_ScriptDir
Code:
setup = %A_ScriptDir%\setup.ini
IniRead, dir, %setup%, test section, mykey
msgbox, %dir%
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group