Sign in to follow this  
Followers 0
Izebize

Directory structure file

4 posts in this topic

Hi!

I want to create a script to download programs from the internet via the given link to it.

I've created a "directory structure file" to arrange files (links) into folders, so it would be more see through.

The structure looks like this (filestruct.txt):

DirectoryName
.SubDirName
..FileName
...-link
...-mirror
..FileName
...-link
DirectoryName2
.FileName
..-link
.SubDirName
..FileName
...-link

I jump through the lines with FileReadLine.

I use StringRegExp, to determinate the type of the current line (dir,subdir,file,link).

But I have no idea how can I store it in a dinamical array.

If I want to store it in an array, then I need at least a 5D array.

I afraid that if I would use ReDim for every line, after some it would be slower and slower, if I add more and more files to it.

Anyone knows another method for this, or to keep it fast? Maybe an already existing method to store a structure like this?

And here is a simple 5D array declaration error:

Dim $a1[1][1][1][1] = [[[[1]]]] ;Good
Dim $a2[1][1][1][1][1] = [[[[[1]]]]] ;syntax & wrong nesting error

Share this post


Link to post
Share on other sites



Try to combine array and structure.

I've not tested this, but i think i'ts possible.

I know, that structure not so fast like an array.

Dim $tagStructure = "wchar dir[1024];wchar sub[1024];wchar file[256];wchar link[1024];wchar mirror[1024]"
Dim $aStuff[1000]
For $i = 0 To UBound($aStuff) -1
    $aStuff[$i] = DllStructCreate($tagStructure)
Next

; set data for current value
DllStructSetData($aStuff[$current], 'dir', 'the_directory')
DllStructSetData($aStuff[$current], 'sub', 'the_subdirectory')
DllStructSetData($aStuff[$current], 'file', 'the_file')
DllStructSetData($aStuff[$current], 'link', 'the_link')
DllStructSetData($aStuff[$current], 'mirror', 'the_mirror')

Best Regards BugFix  

Share this post


Link to post
Share on other sites

Sounds good, thanks!

I also tryin to do it with xml, but for this I have to learn it a bit. :)

Share this post


Link to post
Share on other sites

You need a 5 d array to store this ? what is wrong with using a 2d array?

Anyways how did you figure that the first line is correct because it isn't?

Dim $a1[1][1][1][1] = [[[[1]]]] ;Good 
Dim $a2[1][1][1][1][1] = [[[[[1]]]]] ;syntax & wrong nesting error

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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