Jump to content

create list of diretories from ini file


Recommended Posts

Hi All,

I am trying to create a directories by reading an ini file ,but its not interpreted properly.

thax in advance for any replay.

EA

#include <Array.au3>

#include <file.au3>

#include <Date.au3>

$Plantcode = IniRead("Config.ini", "Environment_Variables", "Plantcode", "NotFound")

$env_code = IniRead("Config.ini", "Environment_Variables", "env_code", "NotFound")

$AproAppDrv = IniRead("Config.ini", "Environment_Variables", "AproAppDrv", "NotFound")

$AproDBDrv = IniRead("Config.ini", "Environment_Variables", "AproDBDrv", "NotFound")

$TEST_DIR = IniRead("Config.ini", "TEST_DIR", "TEST_DIR", "NotFound")

;DirCreate($TEST_DIR)

MsgBox(0,"demo _PathMake",$TEST_DIR)

config.ini

[Environment_Variables]

Plantcode=0111

env_code=TEST2

AproAppDrv=D:

[TEST_DIR]

TEST_DIR=$AproAppDrv\$env_code\$Plantcode

Edited by ea9000
Link to comment
Share on other sites

Hi and Welcome to the forums!

IniRead returns a string, if you want it "interpreted" you have to do so yourself, like:

$TEST_DIR = Execute(IniRead("Config.ini", "TEST_DIR", "TEST_DIR", "NotFound"))

And this needs fixing, that is not valid AutoIt syntax:

TEST_DIR=$AproAppDrv\$env_code\$Plantcode

End result would be:

$Plantcode = IniRead("Config.ini", "Environment_Variables", "Plantcode", "NotFound")
$env_code = IniRead("Config.ini", "Environment_Variables", "env_code", "NotFound")
$AproAppDrv = IniRead("Config.ini", "Environment_Variables", "AproAppDrv", "NotFound")

$TEST_DIR = Execute(IniRead("Config.ini", "TEST_DIR", "TEST_DIR", "NotFound"))
MsgBox(0,"demo _PathMake",$TEST_DIR)

And:

[Environment_Variables]
Plantcode=0111
env_code=TEST2
AproAppDrv=D:
[TEST_DIR]
TEST_DIR=$AproAppDrv & "\" & $env_code & "\" & $Plantcode

Easy, isn't it? :blink:

Don't hesitate to ask if you got any further questions. This is a very active forum and someone should find you eventually.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...