Jump to content

Populate input boxes from ini file values


lyledg
 Share

Recommended Posts

lmao! No doubt! I'm about to head out to OutBack and see the movie Narnia with the kids and wife. So, I'll get the 'Fat Bastard Steak' , 'Fat Bastard Onion', 'Fat Bastard Beer', and the 'Fat Bastard Pop-Corn'!! :P

you should upgrade the 'Fat Bastard Beer' to the "half price happy hour long island". it's perfect for washing down the ayer's rock strip, and making family fun less of an oxymoron.
Link to comment
Share on other sites

@lyledg I believe that if you mentined at the begining of your post that you were using a Command Line called RoboCopy.exe from MS and wrapped around with you GUI, it would be easier for the others to help you. Even though I haven't seen your code I believe this is what you want....

$IniFile = @ScriptDir & '\Test.txt'

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype

#include <GuiConstants.au3>

GuiCreate("RoboCopy", 312, 182,(@DesktopWidth-312)/2, (@DesktopHeight-182)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Label_1 = GuiCtrlCreateLabel("Source", 10, 20, 40, 20)
$Label_2 = GuiCtrlCreateLabel("Target", 10, 50, 40, 20)
$Label_3 = GuiCtrlCreateLabel("Files", 10, 80, 40, 20)
$Label_4 = GuiCtrlCreateLabel("Log", 10, 110, 40, 20)
$Input_5 = GuiCtrlCreateInput("", 60, 20, 240, 20)
$Input_6 = GuiCtrlCreateInput("", 60, 50, 240, 20)
$Input_7 = GuiCtrlCreateInput("", 60, 80, 240, 20)
$Input_8 = GuiCtrlCreateInput("", 60, 110, 240, 20)
$Button_9 = GuiCtrlCreateButton("Close", 10, 150, 50, 20)
$Button_10 = GuiCtrlCreateButton("Load", 90, 150, 50, 20)
$Button_11 = GuiCtrlCreateButton("Save", 170, 150, 50, 20)
$Button_12 = GuiCtrlCreateButton("Run", 250, 150, 50, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_9
        ExitLoop
    Case $msg = $Button_10
        $Source = StringReplace(IniRead($IniFile, 'Settings', 'Sourcedir', ''), '"', '')
        $Target = StringReplace(IniRead($IniFile, 'Settings', 'Destdir', ''), '"', '')
        $File = StringReplace(IniRead($IniFile, 'Settings', 'Files', ''), '"', '')
        $Log = StringReplace(IniRead($IniFile, 'Settings', 'Logoverwrite', ''), '"', '')
        GUICtrlSetData($Input_5, $Source)
        GUICtrlSetData($Input_6, $Target)
        GUICtrlSetData($Input_7, $File)
        GUICtrlSetData($Input_8, $Log)
    Case $msg = $Button_11
        IniWrite($IniFile, 'Settings', 'Sourcedir', GUICtrlRead($Input_5))
        IniWrite($IniFile, 'Settings', 'Destdir', GUICtrlRead($Input_6))
        IniWrite($IniFile, 'Settings', 'Files', GUICtrlRead($Input_7))
        IniWrite($IniFile, 'Settings', 'Logoverwrite', GUICtrlRead($Input_8))
    Case $msg = $Button_12
        If StringInStr($Log, '/log:') Then $Log = '/LOG:"' & StringMid($Log, StringInStr($Log, ':') + 1) & '"'
        MsgBox(0, 'Running RoboCopy', 'RoboCopy.exe "' & $Source & '" "' & $Target & '" "' & $File & '" ' & $Log) 
    Case Else
    ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---
I recently did a script for the company that I worked for, using RoboCopy.exe to migrate data for the user old computer to the new computer over the network. Some advice, double check your Run() or RunWait() systax if the systax is wrong robocopy will backup everything into %Windir%\System32 folder.

@SmOke_N How was the movie I want to take my kids to see it....

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...