Jump to content

Logic Help


Recommended Posts

I have created a "+" button for the user to click when the user would want multiple Locations to be backup with a maximum of 5 fields.

Now i have no idea how do i make the newly created buttons functions inside the loop.

See code and screenshots

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>

Global $Location = [140,168,196,222]
Global $ButtonArrayIndex = UBound($Location)
Global $Button[$ButtonArrayIndex]
Global $BrowseFields[$ButtonArrayIndex]
Global $ButtonCount = 0

$MainForm = GUICreate("Auto Backup", 453, 180, 900, 247)

$BackupLocation = GUICtrlCreateLabel("Location of the Backup Folder:", 8, 8, 169, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
   GUICtrlSetResizing($BackupLocation,$GUI_DOCKALL)
$BrowseButton = GUICtrlCreateButton("Browse", 8, 112, 65, 17)
   GUICtrlSetResizing($BrowseButton,$GUI_DOCKALL)
$BrowseField = GUICtrlCreateEdit("", 80, 32, 329, 17, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
   GUICtrlSetResizing($BrowseField,$GUI_DOCKAlL)


$FolderBackup = GUICtrlCreateLabel("Locations of the Folder to be Backup:", 8, 80, 205, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
   GUICtrlSetResizing($FolderBackup,$GUI_DOCKALL)
$BrowseButton2 = GUICtrlCreateButton("Browse", 8, 32, 65, 17)
   GUICtrlSetResizing($BrowseButton2,$GUI_DOCKALL)
$BrowseField2 = GUICtrlCreateEdit("", 80, 112, 329, 17, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
   GUICtrlSetResizing($BrowseField2,$GUI_DOCKALL)



$BackupButton = GUICtrlCreateButton("Backup", 200, 144, 73, 25)
$ExpandButton = GUICtrlCreateButton("+", 416, 112, 17, 17)
GUICtrlSetResizing($ExpandButton,$GUI_DOCKALL)

GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit


        Case $ExpandButton
            If $ButtonCount <= 3 Then
               ExpandGUI()
               AddField()
               $ButtonCount = $ButtonCount + 1
            Else
               MsgBox($MB_SYSTEMMODAL, "Notice", "Maximum Number of Locations Reached")
            EndIf

    EndSwitch


WEnd

Func ExpandGUI()
   Local $GuiPosition = WinGetPos($MainForm) ; Get the GUI coördinates
   WinMove($MainForm, "", $GuiPosition[0], $GuiPosition[1], $GuiPosition[2], $GuiPosition[3] + 30)
EndFunc

Func AddField()

      $Button[$ButtonCount] = GUICtrlCreateButton("Browse", 8, $Location[$ButtonCount], 65, 17)
         GUICtrlSetResizing( $Button[$ButtonCount],$GUI_DOCKALL)
      $BrowseFields[$ButtonCount] =  GUICtrlCreateEdit("", 80, $Location[$ButtonCount], 329, 17, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
         GUICtrlSetResizing($BrowseFields[$ButtonCount],$GUI_DOCKALL)

EndFunc

I cant just include the $Button[0-3] in the Switch bec. it wont be created yet on the first run

1.png

2.png

3.png

Edited by BlackSnoww
Link to comment
Share on other sites

Here is a clue.

Declare the creation of your 'Backup' button (and any subsequent controls you hard code) before your second 'Browse' button (ensuring all additional 'Browse' buttons automatically get created last), then refer to their $nMsg number like so.

Case $nMsg > $BrowseButton2

You then need to reference each $nMsg that will refer to. See if you can work that out yourself or ask for further help.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Check my edits which has hopefully made things clearer.

$nMsg will always be the next available incremented number when created.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Try something like:

#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>

Global $g_iButtonCount = 0

;~ First Browse Button Top Location
    Global $g_iTop = 112

;~ Column 1 = Browse Button
;~ Column 2 = Browse Field
    Global $g_aBrowse[0][2], $g_sBrowseFolder, $g_sSelectFolder, $g_sBrowseFields

Global $g_hMainForm = GUICreate("Auto Backup", 453, 180, 900, 247)

Global $g_sBackupLocation = GUICtrlCreateLabel("Location of the Backup Folder:", 8, 8, 169, 19)
    GUICtrlSetFont($g_sBackupLocation, 10, 400, 0, "Calibri")
    GUICtrlSetResizing($g_sBackupLocation,$GUI_DOCKALL)
Global $g_idBrowseButton = GUICtrlCreateButton("Browse", 8, 32, 65, 17)
    GUICtrlSetResizing($g_idBrowseButton,$GUI_DOCKALL)
Global $g_idBrowseField = GUICtrlCreateEdit("", 80, 32, 329, 17, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
    GUICtrlSetResizing($g_idBrowseField,$GUI_DOCKAlL)
Global $g_idFolderBackup = GUICtrlCreateLabel("Locations of the Folder to be Backup:", 8, 80, 205, 19)
    GUICtrlSetFont($g_idFolderBackup, 10, 400, 0, "Calibri")
    GUICtrlSetResizing($g_idFolderBackup,$GUI_DOCKALL)
Global $g_idBackupButton = GUICtrlCreateButton("Backup", 200, 144, 73, 25)
Global $g_idExpandButton = GUICtrlCreateButton("+", 416, 112, 17, 17)
        GUICtrlSetResizing($g_idExpandButton,$GUI_DOCKALL)

;~ Add the first Browse/Field Controls
    AddField()

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $g_idExpandButton
            If $g_iButtonCount <= 3 Then
               ExpandGUI()
               AddField()
               $g_iButtonCount += 1
            Else
               MsgBox($MB_SYSTEMMODAL, "Notice", "Maximum Number of Locations Reached")
            EndIf
        Case $g_idBackupButton
            For $i = 0 To UBound($g_aBrowse) - 1
                $g_sBrowseFields = GUICtrlRead($g_aBrowse[$i][1])
                    If $g_sBrowseFields = "" Then ContinueLoop
                MsgBox(4096, "$g_aBrowse[" & $i & "]", "$g_aBrowse[" & $i & "] = " & $g_sBrowseFields)
            Next
        Case Else
            ;~ 9 = First Browse/Field Control Id
            If $nMsg < 9 Then ContinueLoop
            ;~ Search $if $nMsg = Browse Control Id
            $g_sBrowseFolder = _ArraySearch($g_aBrowse, $nMsg, 0, 0, 0, 0, 1, 0)
            $g_sSelectFolder = FileSelectFolder("Select Folder", "")
                If @error Then ContinueLoop
            GUICtrlSetData($g_aBrowse[$g_sBrowseFolder][1], $g_sSelectFolder)
    EndSwitch
WEnd

Func ExpandGUI()
   Local $GuiPosition = WinGetPos($g_hMainForm) ; Get the GUI coördinates
   WinMove($g_hMainForm, "", $GuiPosition[0], $GuiPosition[1], $GuiPosition[2], $GuiPosition[3] + 30)
EndFunc

Func AddField()
    Local $iArrayAdd = _ArrayAdd($g_aBrowse, GUICtrlCreateButton("Browse", 8, $g_iTop, 65, 17) & "|" & GUICtrlCreateEdit("", 80, $g_iTop, 329, 17, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN)))
    GUICtrlSetResizing($g_aBrowse[$iArrayAdd][0],$GUI_DOCKALL)
    GUICtrlSetResizing($g_aBrowse[$iArrayAdd][1],$GUI_DOCKAlL)
    $g_iTop += 28
EndFunc

 

Link to comment
Share on other sites

I meant you have to change the way your script would work if you were to go with that Opt("GUIOnEventMode", 1).  I'll show you :

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars",1)

Global Const $LocationY = 112, $SpaceY = 28, $ButtonArrayIndex = 5
Global $Button[$ButtonArrayIndex]
Global $BrowseFields[$ButtonArrayIndex]
Global $ButtonCount = 1

Global $MainForm = GUICreate("Auto Backup", 453, 180, 900, 247)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton")

Global $BackupLocation = GUICtrlCreateLabel("Location of the Backup Folder:", 8, 8, 169, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
GUICtrlSetResizing(-1,$GUI_DOCKALL)

Global $BrowseButton = GUICtrlCreateButton("Browse", 8, 32, 65, 17)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
GUICtrlSetOnEvent(-1, "Browse")
Global $BrowseField = GUICtrlCreateEdit("", 80, 32, 329, 17, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetResizing(-1,$GUI_DOCKAlL)
Global $FolderBackup = GUICtrlCreateLabel("Locations of the Folder to be Backup:", 8, 80, 205, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
GUICtrlSetResizing($FolderBackup,$GUI_DOCKALL)

For $i = 0 to $ButtonArrayIndex-1
  $Button[$i] = GUICtrlCreateButton("Browse", 8, $LocationY, 65, 17)
  GUICtrlSetResizing(-1,$GUI_DOCKALL)
  If $i Then GUICtrlSetState (-1, $GUI_HIDE+$GUI_DISABLE)
  GUICtrlSetOnEvent(-1, "Browse")
  $BrowseFields[$i] = GUICtrlCreateEdit("", 80, $LocationY, 329, 17, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
  GUICtrlSetResizing(-1,$GUI_DOCKALL)
  If $i Then GUICtrlSetState (-1, $GUI_HIDE+$GUI_DISABLE)
Next

Global $BackupButton = GUICtrlCreateButton("Backup", 200, 144, 73, 25)
GUICtrlSetOnEvent(-1, "StartBackup")
Global $ExpandButton = GUICtrlCreateButton("+", 416, 112, 17, 17)
GUICtrlSetResizing($ExpandButton,$GUI_DOCKALL)
GUICtrlSetOnEvent(-1, "ExpandGUI")

GUISetState(@SW_SHOW)

While 1
  Sleep (100)
WEnd

Func Browse ()
  Local $sDir = FileSelectFolder ("Select folder","C:\")
  If @error Then Return
  ; Do some checks maybe ?
  GUICtrlSetData (@GUI_CtrlId+1,$sDir)
EndFunc

Func ExpandGUI()
  If $ButtonCount = $ButtonArrayIndex Then Return MsgBox($MB_SYSTEMMODAL, "Notice", "Maximum Number of Locations Reached")
  Local $GuiPosition = WinGetPos($MainForm) ; Get the GUI coördinates
  WinMove($MainForm, "", $GuiPosition[0], $GuiPosition[1], $GuiPosition[2], $GuiPosition[3] + 30)
  GUICtrlSetPos ($Button[$ButtonCount], 8, $LocationY+($ButtonCount*$SpaceY))
  GUICtrlSetState ($Button[$ButtonCount], $GUI_SHOW+$GUI_ENABLE)
  GUICtrlSetPos ($BrowseFields[$ButtonCount], 80, $LocationY+($ButtonCount*$SpaceY))
  GUICtrlSetState ($BrowseFields[$ButtonCount], $GUI_SHOW+$GUI_ENABLE)
  $ButtonCount += 1
EndFunc

Func CLOSEButton()
    Exit MsgBox($MB_OK, "GUI Event", "You selected CLOSE! Exiting...")
EndFunc   ;==>CLOSEButton

Func StartBackup ()
  ;Perform the backup here
EndFunc

 

Link to comment
Share on other sites

Oh nice two different approach to the problem.

@Subz mind me asking about this

Case Else
            ;~ 9 = First Browse/Field Control Id
            If $nMsg < 9 Then ContinueLoop
            ;~ Search $if $nMsg = Browse Control Id
            $g_sBrowseFolder = _ArraySearch($g_aBrowse, $nMsg, 0, 0, 0, 0, 1, 0)
            $g_sSelectFolder = FileSelectFolder("Select Folder", "")
                If @error Then ContinueLoop
            GUICtrlSetData($g_aBrowse[$g_sBrowseFolder][1], $g_sSelectFolder)

How does the browse control ID get produced by the $nMsg?

@Nine Nice one buddy so that's how u make use of the GUICtrlSetOnEvent. This is really a nice example for me to understand how that works.

Thanks guys.

Link to comment
Share on other sites

also @Nine a question in this too

If $i Then
     GUICtrlSetState (-1, $GUI_HIDE+$GUI_DISABLE)
     GUICtrlSetOnEvent(-1, "Browse")
  $BrowseFields[$i] = GUICtrlCreateEdit("", 80, $LocationY, 329, 17, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
      GUICtrlSetResizing(-1,$GUI_DOCKALL)
  If $i Then
     GUICtrlSetState (-1, $GUI_HIDE+$GUI_DISABLE)

How does the IF statement works here without a condition ?

isnt it normally If <condition> then ?

 

Link to comment
Share on other sites

The _ArrayAdd() function adds the browse button and field control ids to the $g_aBrowse array.

Below 

Case $g_idBackupButton

Add _ArrayDisplay($g_aBrowse), you should see all the control id's starting from the first button (which is control id 9)

Link to comment
Share on other sites

9 hours ago, BlackSnoww said:

How does the IF statement works here without a condition ?

There is an implicit condition in there.  All variables not equal to 0 numeric are considered True, only 0 is considered False.  So in my case it is like :

If $i <> 0 Then GUICtrlSetState (-1, $GUI_HIDE+$GUI_DISABLE)

 

Link to comment
Share on other sites

Hello Guys. I have finally finished it thank to your help. thank you so much for your help. I went it in tried both of ur approach but ended up using Subz approach as im still not familiar on how do events work but any ways thanks for all the help and support.

Here is the finished code that u guys helped me finish

#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
#include <Misc.au3>
#include <WinAPIFiles.au3>

Global $g_iButtonCount = 0
Global $FieldCount = 1
Global $Dir = @ScriptDir&"\"&"Settings.ini"
;~ First Browse Button Top Location
Global $g_iTop = 112

Global $g_aBrowse[0][2], $g_sBrowseFolder, $g_sSelectFolder, $g_sBrowseFields

Global $g_hMainForm = GUICreate("Auto Backup", 453, 180, 900, 247)

Global $g_sBackupLocation = GUICtrlCreateLabel("Location of the Backup Folder:", 8, 8, 169, 19)
    GUICtrlSetFont($g_sBackupLocation, 10, 400, 0, "Calibri")
    GUICtrlSetResizing($g_sBackupLocation,$GUI_DOCKALL)
Global $g_idBrowseButton = GUICtrlCreateButton("Browse", 8, 32, 65, 17)
    GUICtrlSetResizing($g_idBrowseButton,$GUI_DOCKALL)
Global $g_idBrowseField = GUICtrlCreateEdit("", 80, 32, 329, 17, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
    GUICtrlSetResizing($g_idBrowseField,$GUI_DOCKAlL)

   Local $BackupFolderRead = IniRead ($Dir, "Direct", "BackUpDirectory", "" )
   GUICtrlSetData($g_idBrowseField,$BackupFolderRead)


Global $g_idFolderBackup = GUICtrlCreateLabel("Locations of the Folder to be Backup:", 8, 80, 205, 19)
    GUICtrlSetFont($g_idFolderBackup, 10, 400, 0, "Calibri")
    GUICtrlSetResizing($g_idFolderBackup,$GUI_DOCKALL)
Global $g_idBackupButton = GUICtrlCreateButton("OK", 200, 144, 73, 25)
Global $g_idExpandButton = GUICtrlCreateButton("+", 416, 112, 17, 17)
        GUICtrlSetResizing($g_idExpandButton,$GUI_DOCKALL)

;~ Add the first Browse/Field Controls
    AddField()

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $g_idExpandButton
            If $g_iButtonCount <= 3 Then
               ExpandGUI()
               AddField()
               $g_iButtonCount += 1
            Else
               MsgBox($MB_SYSTEMMODAL, "Notice", "Maximum Number of Locations Reached")
            EndIf


        Case $g_idBrowseButton
           Local $BackupFolder = DirectoryBrowse()
           GUICtrlSetData($g_idBrowseField,$BackupFolder)


        Case $g_idBackupButton
            DataToIni()
            IniWrite($Dir,"Direct","IterationNumber",$FieldCount - 1)
            GUIDelete($g_hMainForm)
            Exit

        Case Else

            If $nMsg == 9 Then
               $g_sSelectFolder = DirectoryBrowse()
               GUICtrlSetData($g_aBrowse[0][1], $g_sSelectFolder)

            ElseIf $nMsg == 11 Then
               $g_sSelectFolder = DirectoryBrowse()
               GUICtrlSetData($g_aBrowse[1][1], $g_sSelectFolder)

            ElseIf $nMsg == 13 Then
               $g_sSelectFolder = DirectoryBrowse()
               GUICtrlSetData($g_aBrowse[2][1], $g_sSelectFolder)

            ElseIf $nMsg == 15 Then
               $g_sSelectFolder = DirectoryBrowse()
               GUICtrlSetData($g_aBrowse[3][1], $g_sSelectFolder)

            ElseIf $nMsg == 17 Then
               $g_sSelectFolder = DirectoryBrowse()
               GUICtrlSetData($g_aBrowse[4][1], $g_sSelectFolder)


            EndIf

    EndSwitch
WEnd

Func ExpandGUI()
   Local $GuiPosition = WinGetPos($g_hMainForm) ; Get the GUI coördinates
   WinMove($g_hMainForm, "", $GuiPosition[0], $GuiPosition[1], $GuiPosition[2], $GuiPosition[3] + 30)
EndFunc

Func AddField()
    Local $iArrayAdd = _ArrayAdd($g_aBrowse, GUICtrlCreateButton("Browse", 8, $g_iTop, 65, 17) & "|" & GUICtrlCreateEdit("", 80, $g_iTop, 329, 17, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN)))
    GUICtrlSetResizing($g_aBrowse[$iArrayAdd][0],$GUI_DOCKALL)
    GUICtrlSetResizing($g_aBrowse[$iArrayAdd][1],$GUI_DOCKAlL)
    $g_iTop += 28

    Local $BackupLocationRead = IniRead ($Dir, "Direct", "Location" &$FieldCount, "" )
    GUICtrlSetData(-1,$BackupLocationRead)
    $FieldCount = $FieldCount + 1

EndFunc


Func DirectoryBrowse()
   Local $num = 1
    ; Create a constant variable in Local scope of the message to display in FileSelectFolder.
    Local Const $sMessage = "Select a folder"

    ; Display an open dialog to select a file.
    Local $sFileSelectFolder = FileSelectFolder($sMessage, "")
    If @error Then
        ; Display the error message.
  ;      MsgBox($MB_SYSTEMMODAL, "", "No folder was selected.")
    Else
        ; Display the selected folder.
   ;     MsgBox($MB_SYSTEMMODAL, "", "You chose the following folder:" & @CRLF & $sFileSelectFolder)
     EndIf
     Return $sFileSelectFolder

EndFunc

Func DataToIni()

   Local $Location,$BackupDirectory,$Counter


   For $Counter = 1 To $FieldCount-1 Step + 1
      $Location = GUICtrlRead($g_aBrowse[$Counter -1][1])
      IniWrite($Dir,"Direct","Location" &$Counter,$Location)
   Next

   $BackupFolder = GUICtrlRead($g_idBrowseField)
   IniWrite($Dir,"Direct","BackUpDirectory",$BackupFolder)

EndFunc

and this one is for the actual backing up of the files which is runned by the Task Scheduler

#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
#include <Misc.au3>
#include <Date.au3>
#include "Notify.au3"

Opt("TrayAutoPause", 0)


Local $return
Local $Dir = @ScriptDir&"\"&"Settings.ini"

Local $Location[5]
Local $Loc

Local $IterationCount = IniRead($Dir,"Direct","IterationNumber","")
Local $Counter = 0
Local $FileName



For $Counter = 0 To $IterationCount-1 Step +1
   $Location[$Counter] = IniRead($Dir,"Direct","Location" &$Counter+1,"")
Next


For $Counter = 0 To $IterationCount-1 Step +1
   $Loc = $Location[$Counter]
   $FileName = StringSplit($Loc,'\', $STR_ENTIRESPLIT)

   Local $iFileExists = FileExists($Loc)

   If $iFileExists Then
      Backup($Loc,$FileName[$FileName[0]])
   Else

   EndIf

Next


   _Notify_Show(@AutoItExe, "Backup Succesfull", "Retracts after 5 secs", 5, 0)
   Sleep(5000)
   Exit


Func Backup($loc,$Name)
   Local $time = _NowTime(5)
   Local $date = _NowDate()
   $date = StringReplace($date, "/", "-")
   $time = StringReplace($time, ":", "-")

   Local $DateTime = $date &" "& $time &" "&$Name
   Local $FileName = String ($DateTime)


   Local $to = IniRead ($Dir, "Direct", "BackUpDirectory", "" ) ;asa i save


   $loc = $loc & "\"
   $to = $to & "\"

   $BackUpLocation = $to &""& $FileName   ;asa i save plus filename


   RunWait (@ComSpec & ' /c  ""%ProgramFiles%\WinRaR\Rar.exe" a -ep1 -r -y "' &$BackUpLocation& '" "' & $loc& '"',"",@SW_HIDE)
   if @error then
      Exit
   EndIf


  Sleep(3000)

EndFunc

Sorry if code is messy im just getting the hang out of this. anyway thanks all for ur help :)

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...