Sign in to follow this  
Followers 0
Raluvian

not working out

18 posts in this topic

im not very good with autoit3 so i am going to post my last post asking that maybe one of you could make a scipt i was trying to make. it has supposed to read a directory for folders and list the folders in a list and when you press a button it gave it to the ini for storage. then when the user pressed another button it would read the ini for all the folders there and take the subdirectorys and add them to another folder.

thank you for all your support and findness

if anyone makes this i would be very pleased.

Share this post


Link to post
Share on other sites



You know, its by actually doing stuff like this that you become "good" with autoit3. Give it a shot, one step at a time and ask for help while your working on it. You will get a lot more assistance that way.


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

This will get you going, only minimun error checking in it though, use the beta version of autoit!

#include <Array.au3>
Dim $aList[1]

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 710,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_Dir = GuiCtrlCreateInput("", 20, 20, 240, 20)
$Browse = GuiCtrlCreateButton("Browse", 280, 20, 90, 20)
$Edit = GuiCtrlCreateEdit("", 20, 60, 350, 560)
$Go = GuiCtrlCreateButton("Go", 40, 650, 150, 40)
$Save = GuiCtrlCreateButton("Save", 220, 650, 140, 40)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    
    Case $msg = $Browse
        
            $folder = FileSelectFolder( "Please select the folder to update","d:\","","Customise")
            GUICtrlSetData($Input_Dir, $Folder)
    Case $msg = $Go
            
            If GuiCtrlRead ($input_Dir) <> "" and FileExists(GuiCtrlRead ($input_Dir)) Then
                SplashTexton ("Dir Search", "Wait Searching", 220, 50)
                Search(GuiCtrlRead ($input_Dir))
                SplashOff()
                If Ubound ($aList) -1 = 0 then Msgbox (0,"Error", "No directories found")
                For $i = 1 to Ubound ($aList) -1
                    GUICtrlSetData ($Edit, $aList[$i] & @CRLF,1)
                Next
                Endif
    Case $msg = $Save
            If GuiCtrlRead ($input_Dir) <> "" then  
            $FileSave = FileSaveDialog ("Save to", @desktopDir, "Config file (*.ini)", 2)
                If $FileSave <> "" then
                    If StringRight( $FileSave, 4)  <> ".ini" then $FileSave = $FileSave & ".ini"
                    $file = FileOpen($FileSave, 1)
                    FileWriteLine ($file ,"[" & GuiCtrlRead ($input_Dir) & "]")
                    
                    For $i = 1 to Ubound ($aList) -1
                        FileWriteLine ($file , $i & "=" & $aList[$i])
                    Next
                    FileClose ($file)
                    msgBox (0,"Saved", "File saved to " & $FileSave)
                EndIf
            Endif
                
    Case Else
        ;;;
    EndSelect
WEnd
Exit


Func Search($current)

    Local $search = FileFindFirstFile($current & "\*.*")
    While 1
        Dim $file = FileFindNextFile($search)
        If @error Or StringLen($file) < 1 Then ExitLoop

        If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
            _ArrayAdd ($aList,$current & "\" & $file)
            Search($current & "\" & $file)
            
        EndIf
    WEnd
    FileClose($search)

EndFunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

spook...i did ask for help and i got no help once so ever..

and ChrisL do you have an aol or msn or yahoo?

Edited by Raluvian

Share this post


Link to post
Share on other sites

when you say use the beta version...

can i get by using "beta compile"

or what exactly are you refering to... I have seen this a lot and am not sure :-/

Share this post


Link to post
Share on other sites

when you say use the beta version...

can i get by using "beta compile"

or what exactly are you refering to... I have seen this a lot and am not sure :-/

When someone says "use the beta version", they mean have the AutoIt3 Beta installed and in SciTE you can run the script using the the AutoIt Beta by either selecting "Beta Run" from "Tools" or pressing Alt+F5... Or you can compile by pressing Alt+F7.

Share this post


Link to post
Share on other sites

spook...i did ask for help and i got no help once so ever..

and ChrisL do you have an aol or msn or yahoo?

only that I use for work, post your questions here I'm sure others can answer them as well as me

Share this post


Link to post
Share on other sites

How do i add exclusion to that script??

like exclusion of the folder -modcache?

Share this post


Link to post
Share on other sites

See the $excludelist line, put the folders in seperated by commas

If you add a folder to the list it will be ignored totally and so will the sub directories

#include <Array.au3>
Dim $aList[1]

$excludeList = "bitmaps800,greenscreen"

$excArray = Stringsplit ($excludelist, ",")
#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 710,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_Dir = GuiCtrlCreateInput("", 20, 20, 240, 20)
$Browse = GuiCtrlCreateButton("Browse", 280, 20, 90, 20)
$Edit = GuiCtrlCreateEdit("", 20, 60, 350, 560)
$Go = GuiCtrlCreateButton("Go", 40, 650, 150, 40)
$Save = GuiCtrlCreateButton("Save", 220, 650, 140, 40)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    
    Case $msg = $Browse
        
            $folder = FileSelectFolder( "Please select the folder to update","d:\","","Customise")
            GUICtrlSetData($Input_Dir, $Folder)
    Case $msg = $Go
            
            If GuiCtrlRead ($input_Dir) <> "" and FileExists(GuiCtrlRead ($input_Dir)) Then
                SplashTexton ("Dir Search", "Wait Searching", 220, 50)
                Search(GuiCtrlRead ($input_Dir))
                SplashOff()
                If Ubound ($aList) -1 = 0 then Msgbox (0,"Error", "No directories found")
                For $i = 1 to Ubound ($aList) -1
                    GUICtrlSetData ($Edit, $aList[$i] & @CRLF,1)
                Next
                Endif
    Case $msg = $Save
            If GuiCtrlRead ($input_Dir) <> "" then  
            $FileSave = FileSaveDialog ("Save to", @desktopDir, "Config file (*.ini)", 2)
                If $FileSave <> "" then
                    If StringRight( $FileSave, 4)  <> ".ini" then $FileSave = $FileSave & ".ini"
                    $file = FileOpen($FileSave, 1)
                    FileWriteLine ($file ,"[" & GuiCtrlRead ($input_Dir) & "]")
                    
                    For $i = 1 to Ubound ($aList) -1
                        FileWriteLine ($file , $i & "=" & $aList[$i])
                    Next
                    FileClose ($file)
                    msgBox (0,"Saved", "File saved to " & $FileSave)
                EndIf
            Endif
                
    Case Else
        ;;;
    EndSelect
WEnd
Exit
Func Search($current)

    Local $search = FileFindFirstFile($current & "\*.*")
    While 1
        Dim $file = FileFindNextFile($search)
        If @error Or StringLen($file) < 1 Then ExitLoop

        If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
            
            $Skip = 0
            
            For $i = 1 to Ubound ($excArray) - 1
                If $file = $excArray[$i] then $skip = 1
                Next
            If $Skip <> 1 then  
            _ArrayAdd ($aList,$current & "\" & $file)
            Search($current & "\" & $file)
        EndIf
        
            
        EndIf
    WEnd
    FileClose($search)

EndFunc

Share this post


Link to post
Share on other sites

i have been looking at the help file and i don't see anything about short list names. so its not d:\...\...\...\...\...

so its just one subdirectory and thats it. so like i have a folder called sureyaright in d:\woot\games\awesome

so it only reads that subdirectory and nothing further, or would i have to exclude all thouse?

Share this post


Link to post
Share on other sites

i have been looking at the help file and i don't see anything about short list names. so its not d:\...\...\...\...\...

so its just one subdirectory and thats it. so like i have a folder called sureyaright in d:\woot\games\awesome

so it only reads that subdirectory and nothing further, or would i have to exclude all thouse?

Not sure I understand what you mean

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Not sure I understand what you mean

i mean like it only shows a certain level of subdirectorys

Edited by Raluvian

Share this post


Link to post
Share on other sites

i mean like it only shows a certain level of subdirectorys

OK if you had a path of

C:\Dir1\Dir2\Dir3\Dir4\Dir5\Dir6\Dir7

If you put Dir4 in the exclude list then Dir4 will be ignored and so will the subdirectories 5,6 and 7 in the last code I posted

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

like how would i shortain what it shows in the text box? like... it shows d:\dir\dir\dir\dir

i only want to it shortain the text to just a certain directory instead of that just have it just a \dir\ show up

Edited by Raluvian

Share this post


Link to post
Share on other sites

like how would i shortain what it shows in the text box? like... it shows d:\dir\dir\dir\dir

i only want to it shortain the text to just a certain directory instead of that just have it just a \dir\ show up

Like this?

$showfullPath = 0 list the Directory names without the full path

$showFullPath = 1 List the full path

#include <Array.au3>
Dim $aList[1]

$ShowFullPath = 0
$excludeList = "bitmaps800,greenscreen"

$excArray = Stringsplit ($excludelist, ",")
#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 710,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_Dir = GuiCtrlCreateInput("", 20, 20, 240, 20)
$Browse = GuiCtrlCreateButton("Browse", 280, 20, 90, 20)
$Edit = GuiCtrlCreateEdit("", 20, 60, 350, 560)
$Go = GuiCtrlCreateButton("Go", 40, 650, 150, 40)
$Save = GuiCtrlCreateButton("Save", 220, 650, 140, 40)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    
    Case $msg = $Browse
        
            $folder = FileSelectFolder( "Please select the folder to update","d:\","","Customise")
            GUICtrlSetData($Input_Dir, $Folder)
    Case $msg = $Go
            
            If GuiCtrlRead ($input_Dir) <> "" and FileExists(GuiCtrlRead ($input_Dir)) Then
                SplashTexton ("Dir Search", "Wait Searching", 220, 50)
                Search(GuiCtrlRead ($input_Dir))
                SplashOff()
                If Ubound ($aList) -1 = 0 then Msgbox (0,"Error", "No directories found")
                For $i = 1 to Ubound ($aList) -1
                    GUICtrlSetData ($Edit, $aList[$i] & @CRLF,1)
                Next
                Endif
    Case $msg = $Save
            If GuiCtrlRead ($input_Dir) <> "" then  
            $FileSave = FileSaveDialog ("Save to", @desktopDir, "Config file (*.ini)", 2)
                If $FileSave <> "" then
                    If StringRight( $FileSave, 4)  <> ".ini" then $FileSave = $FileSave & ".ini"
                    $file = FileOpen($FileSave, 1)
                    FileWriteLine ($file ,"[" & GuiCtrlRead ($input_Dir) & "]")
                    
                    For $i = 1 to Ubound ($aList) -1
                        FileWriteLine ($file , $i & "=" & $aList[$i])
                    Next
                    FileClose ($file)
                    msgBox (0,"Saved", "File saved to " & $FileSave)
                EndIf
            Endif
                
    Case Else
        ;;;
    EndSelect
WEnd
Exit
Func Search($current)

    Local $search = FileFindFirstFile($current & "\*.*")
    While 1
        Dim $file = FileFindNextFile($search)
        If @error Or StringLen($file) < 1 Then ExitLoop

        If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
            
            $Skip = 0
            
            For $i = 1 to Ubound ($excArray) - 1
                If $file = $excArray[$i] then $skip = 1
                Next
            If $Skip <> 1 then  
                If $showfullpath = 1 then 
                    _ArrayAdd ($aList,$current & "\" & $file)
                Else
                    _ArrayAdd ($aList,$file)
                Endif
            Search($current & "\" & $file)
        EndIf
        
            
        EndIf
    WEnd
    FileClose($search)

EndFunc

Share this post


Link to post
Share on other sites

i am not sure im at the high school computer right now so when i get back to my pc i will.

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

that worked perfectly, i also changed the box where the dirs are displayed to a list so that i can try to find a way so i can click a dir and press a putton and it saves t to an ini and to be later used in a mass dirmove

Edited by Raluvian

Share this post


Link to post
Share on other sites

do you know how to make this so in my past post? so its easily pluged into that scipt and runs? i tryed to get it working but nothing

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