Sign in to follow this  
Followers 0
Raluvian

ini help

5 posts in this topic

ChrisL gave me this script and i have been exparamenting with it and i don't know how do do this very well and i i can't get it to write the ini so it writes it as a variable in the ini with a directory attatched.

so i can just have

iniread(blah blah blah)

dirmove(multible variables put into one line)

we and chrisL have this

; [Made by ChrisL and Raluvian]
#include <Array.au3>
Dim $aList[1]

$ShowFullPath = 0
$excludeList = "-modcache,cfg,lua,manual,maps,materials,music,resource,models,scripts,settings,sound"

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

GuiCreate("Garry's Mod File Manager", 392, 710,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_Dir = GuiCtrlCreateInput("", 20, 80, 290, 20)
$Browse = GuiCtrlCreateButton("Browse", 310, 80, 70, 20)
$Edit = GuiCtrlCreateList("", 20, 110, 360, 500)
$Go = GuiCtrlCreateButton("Go", 20, 640, 70, 50)
$Save = GuiCtrlCreateButton("Save", 100, 640, 70, 50)
$AddCache = GuiCtrlCreateButton("Add to Cache", 230, 640, 70, 50)
$Execute = GuiCtrlCreateButton("Execute", 310, 640, 70, 50)
$Progbar = GuiCtrlCreateProgress(20, 610, 360, 20)
$Pic_9 = GuiCtrlCreatePic("Pic9", 20, 0, 200, 80)
$Pic_10 = GuiCtrlCreatePic("Pic10", 220, 0, 160, 80)

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 want it so the scipt still had the showfulldirectory 0

and when i click save it writes them to an ini so it would save like this

[section]

$var[0] = d:\dir\dir\dir\dir

$var[1] = d:\dir\dir\dir\dir

$var[2] = d:\dir\dir\dir\dir

$var[3] = d:\dir\dir\dir\dir

so then i can add in the scipt

dirmove ("$var[0]", "$varTargetDir")

dirmove ("$var[1]", "$varTargetDir")

dirmove ("$var[2]", "$varTargetDir")

Share this post


Link to post
Share on other sites

I think you still need to be a little clearer on exactly what your trying to do.

Explain it like I was 6 years old step by step.

I can only guess at this, in the list box it shows only the folder names but writes the full path to an ini file.

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

$ShowFullPath = 0
$excludeList = "-modcache,cfg,lua,manual,maps,materials,music,resource,models,scripts,settings,sound"

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

GuiCreate("Garry's Mod File Manager", 392, 710,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_Dir = GuiCtrlCreateInput("", 20, 80, 290, 20)
$Browse = GuiCtrlCreateButton("Browse", 310, 80, 70, 20)
$Edit = GuiCtrlCreateList("", 20, 110, 360, 500)
$Go = GuiCtrlCreateButton("Go", 20, 640, 70, 50)
$Save = GuiCtrlCreateButton("Save", 100, 640, 70, 50)
$AddCache = GuiCtrlCreateButton("Add to Cache", 230, 640, 70, 50)
$Execute = GuiCtrlCreateButton("Execute", 310, 640, 70, 50)
$Progbar = GuiCtrlCreateProgress(20, 610, 360, 20)
$Pic_9 = GuiCtrlCreatePic("Pic9", 20, 0, 200, 80)
$Pic_10 = GuiCtrlCreatePic("Pic10", 220, 0, 160, 80)

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 ($aFull) -1
                        FileWriteLine ($file , $i & "=" & $aFull[$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
                 _ArrayAdd ($aFull,$current & "\" & $file)
            Search($current & "\" & $file)
        EndIf
       
           
        EndIf
    WEnd
    FileClose($search)

EndFunc

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

alright i am going to explane the whole thing.

1 browse for a directory

2 press go

3 be able to select multiple list items

4 press add to cache

5 it adds the selected list items to the ini in the format $var = D:\directory\directory

6 press execute

7 it adds the folders to a directory

8 also pressing execute will add only the subdirectorys of selected text to another directory separate from the previous

9 have the progress bar work with number 7 thou 8

10 have the save button add the directorys like it does so later it remembers the past directorys that were browsed for

11 also i need to add a button so that it will erase the listed items

12 and have a button that pulls every file and folder that that text game to the directory move

And i have two pictures waiting to be put into the scipt... i am confuzed on how to add them to the script

a :)

Edited by Raluvian

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