Sign in to follow this  
Followers 0
Reminder

Array problem (newbie)

7 posts in this topic

Hi All,

I have been playing with AutoIt for a bit and now I am a bit stuck. For most of you this will be very simple ;-)

I want to create a customer directory and in that directory read subdirs from a ini file. I have the following code.

D:\"Customer"\"create subdirs" (subdir 1-9)

I have the ini in a array but I cant seem to get them to dircreate from a array.

CODE
Func AanmakenSubDir() ;-- Aanmaken subdirectories die gebruikt worden tijdens de conversie

Local $AvArray[199]

$AvArray[0] = iniread("Settings.ini","MapStructuur","01","999")

$AvArray[1] = iniread("Settings.ini","MapStructuur","02","999") ;-- must be a smarter way????

$AvArray[2] = iniread("Settings.ini","MapStructuur","03","999")

$AvArray[3] = iniread("Settings.ini","MapStructuur","04","999")

$AvArray[4] = iniread("Settings.ini","MapStructuur","05","999")

$AvArray[5] = iniread("Settings.ini","MapStructuur","06","999")

$AvArray[6] = iniread("Settings.ini","MapStructuur","07","999")

$AvArray[7] = iniread("Settings.ini","MapStructuur","08","999")

$AvArray[8] = iniread("Settings.ini","MapStructuur","09","999")

$DirLocatie = IniRead("Settings.ini","DirLocatie","PathLocatie","")

$SubDirArray = iniread("Settings.ini","MapStructuur","01-99","999")

;~ $Subdirlocatie = $dirlocatie&Guictrlread($input1)& "\" & $AvArray

While 3

;~ dircreate($subdirlocatie)

msgbox(0,"test",$SubDirArray)

ExitLoop

WEnd

If any of you can help me with this problem I would appriciate it!

Cheers.

Share this post


Link to post
Share on other sites



Hi All,

I have been playing with AutoIt for a bit and now I am a bit stuck. For most of you this will be very simple ;-)

I want to create a customer directory and in that directory read subdirs from a ini file. I have the following code.

D:\"Customer"\"create subdirs" (subdir 1-9)

I have the ini in a array but I cant seem to get them to dircreate from a array.

CODE
Func AanmakenSubDir() ;-- Aanmaken subdirectories die gebruikt worden tijdens de conversie

Local $AvArray[199]

$AvArray[0] = iniread("Settings.ini","MapStructuur","01","999")

$AvArray[1] = iniread("Settings.ini","MapStructuur","02","999") ;-- must be a smarter way????

$AvArray[2] = iniread("Settings.ini","MapStructuur","03","999")

$AvArray[3] = iniread("Settings.ini","MapStructuur","04","999")

$AvArray[4] = iniread("Settings.ini","MapStructuur","05","999")

$AvArray[5] = iniread("Settings.ini","MapStructuur","06","999")

$AvArray[6] = iniread("Settings.ini","MapStructuur","07","999")

$AvArray[7] = iniread("Settings.ini","MapStructuur","08","999")

$AvArray[8] = iniread("Settings.ini","MapStructuur","09","999")

$DirLocatie = IniRead("Settings.ini","DirLocatie","PathLocatie","")

$SubDirArray = iniread("Settings.ini","MapStructuur","01-99","999")

;~ $Subdirlocatie = $dirlocatie&Guictrlread($input1)& "\" & $AvArray

While 3

;~ dircreate($subdirlocatie)

msgbox(0,"test",$SubDirArray)

ExitLoop

WEnd

If any of you can help me with this problem I would appriciate it!

Cheers.

Certainly there are better methods (see IniReadSection() for creating the array) but you really are not giving us enough info to determine what the actual problem is.

I don't see where you have a path to the new folders defined. Is that already in your ini file? Better if you post a typical line from the ini file.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Certainly there are better methods (see IniReadSection() for creating the array) but you really are not giving us enough info to determine what the actual problem is.

I don't see where you have a path to the new folders defined. Is that already in your ini file? Better if you post a typical line from the ini file.

Sorry I understand here is my ini file:

== Function: Create directories for new customers

[DirLocatie]

PathLocatie=D:\Conversie\

[MapStructuur]

01=01 Aanlevering

02=02 Controleren aangeleverde bestanden

etc.

Share this post


Link to post
Share on other sites

Hi.

This might give you a start:

#include <array.au3> ; just for _arraydisplay()

$ini="C:\path\to\your\inifile.ini"
$section="MapStructuur"

IniReadSection($ini,$section)

_ArrayDisplay($section)

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

$ini="C:\path\to\your\inifile.ini";; This could use a macro like $ini = @ScriptDir & "\inifile.ini"
$section="MapStructuur"

$array = IniReadSection($ini,$section)
If NOT @Error Then
   For $i = 1 To Ubound($array) -1
      If NOT FileExists($array[$i][1]) Then DirCreate($array[$i][1])
   Next
EndIf

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Thanks allot I will go and try to figer it all out!

thanks.

Share this post


Link to post
Share on other sites

Cool have it working thanks all!

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