Sign in to follow this  
Followers 0
le15

How to make this in AutoIt

11 posts in this topic

How to make same of this command in AutoIt ?

For /R "D:\MyProgramFolder\" %1 in (.) do echo %~f1 >> "TmpFile.txt"

I didn't want use the TmpFile.txt so it would be better to use an Array

Someone have idea ?

Share this post


Link to post
Share on other sites



What are you attempting to do?


Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites

What are you attempting to do?

I am working in project WinBuider

I need to make a list of all folder in where is located an application that i want to make a plugin

See file attached

Share this post


Link to post
Share on other sites

How to make same of this command in AutoIt ?

For /R "D:\MyProgramFolder\" %1 in (.) do echo %~f1 >> "TmpFile.txt"

I didn't want use the TmpFile.txt so it would be better to use an Array

Someone have idea ?

Search ("d:\Kiosk", @scriptdir & "\output.txt");replace with your search directory and output file

Func Search($current,$textfile)

    Local $search = FileFindFirstFile($current & "\*.*")
    While 1
        Dim $file = FileFindNextFile($search)
        If @error Or StringLen($file) < 1 Then ExitLoop
        If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then

            ;this is where you write the log
            FileWriteLine ($textfile,$current & "\" & $file) 
               
        EndIf
        If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
            Search($current & "\" & $file, $textfile)
            
        EndIf

    WEnd
    FileClose($search)

EndFunc

Share this post


Link to post
Share on other sites

or i guess you could use _FileListToArray () if you don't need it in a file see the help file for more details

Thank you

That's what i want

I have just change this line for having just the list of all folder without the filename

If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then

By

If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then

I will try this _FileListToArray () if i can make it work

Ihave a little more understand how to make a function

Thank you

Share this post


Link to post
Share on other sites

or i guess you could use _FileListToArray () if you don't need it in a file see the help file for more details

#Include <File.au3>
#Include <Array.au3>

$FileList = _FileListToArray("E:\WB_Source\Applications\IrfanView", "*", 2)

            ;_FileListToArray($sPath, $sFilter = "*", $iFlag = 0)

If (Not IsArray($FileList)) and (@Error=1) Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
_ArrayDisplay($FileList,"$FileList")

--------------------------------------------------------------------------------------------------------------------------
>C:\Program Files\AutoIt3\SciTE\..\au3check.exe "E:\AutoIT Apps\Nouveau AutoIt v3 Script (5).au3"
AutoIt3 Syntax Checker v1.54  Copyright (c) Tylo 2006

E:\AutoIT Apps\Nouveau AutoIt v3 Script (5).au3(79,19) : ERROR: _FileListToArray() called with wrong number of args.
_FileListToArray ()
~~~~~~~~~~~~~~~~~~^
E:\AutoIT Apps\Nouveau AutoIt v3 Script (5).au3(30,58) : REF: definition of _FileListToArray().
Func _FileListToArray($sPath, $sFilter = "*", $iFlag = 0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:\AutoIT Apps\Nouveau AutoIt v3 Script (5).au3 - 1 error(s), 0 warning(s)
>Exit code: 2    Time: 0.207

I can't make this work

Why , I get error ?

Share this post


Link to post
Share on other sites

What version of AutoIT are you running.

I just ran this

#Include <File.au3>
#Include <Array.au3>

$FileList = _FileListToArray("E:\WB_Source\Applications\IrfanView", "*", 2)

           ;_FileListToArray($sPath, $sFilter = "*", $iFlag = 0)

If (Not IsArray($FileList)) and (@Error=1) Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
_ArrayDisplay($FileList,"$FileList")

With no problem, I did have to change the search directory to one I actually had.

Create a script with this in

MsgBox (0,"",@AutoItVersion)

to get the version

Share this post


Link to post
Share on other sites

What version of AutoIT are you running.

I just ran this

#Include <File.au3>
#Include <Array.au3>

$FileList = _FileListToArray("E:\WB_Source\Applications\IrfanView", "*", 2)

          ;_FileListToArray($sPath, $sFilter = "*", $iFlag = 0)

If (Not IsArray($FileList)) and (@Error=1) Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
_ArrayDisplay($FileList,"$FileList")

With no problem, I did have to change the search directory to one I actually had.

Create a script with this in

MsgBox (0,"",@AutoItVersion)

to get the version

Ok i've found the error i've _FileListToArray() in bottom that i didn't see

But by this way it doesn't work like the first one

It doesn't list sub folder

i've try to make it work like the first but i can't

Share this post


Link to post
Share on other sites

Will this help?

#include <array.au3>

Dim $folderlist [1]
Dim $fileList [1]

Search ("d:\Kiosk");replace with your search directory 

Func Search($current)

    Local $search = FileFindFirstFile($current & "\*.*")
    While 1
        Dim $file = FileFindNextFile($search)
        If @error Or StringLen($file) < 1 Then ExitLoop
        If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
            
             $FileList[0] = ($FileList[0] + 1)
             _ArrayAdd ($fileList, $current & "\" & $file)
           
               
        EndIf
        If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
            
            $FolderList[0] = ($folderList[0] + 1)
            _arrayAdd ($folderList,$current & "\" & $file)
            Search($current & "\" & $file)

        EndIf

    WEnd
    FileClose($search)

EndFunc


_arrayDisplay ($FolderList,"Folders")
_arrayDisplay ($FileList,"Files")

Share this post


Link to post
Share on other sites

Yes that's what i want :whistle:

Thank you very much

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