Jump to content

Recommended Posts

Posted (edited)

I'm trying to make the code below with variables.

Run(rar a -v15000000b -m0 -ed -ep1 -df Variable1.rar "c:\Variable 2\*")

It is in rar.exe but it doesn't do what I want it to do because, if there is a space at varaible 2 it has to be between "" but then the intire code doesn't work. Somebody got the solution.

Rar.exe is provided with the post

Edited by eekhoorn12
Posted (edited)

Run(rar a -v15000000b -m0 -ed -ep1 -df Variable1.rar "c:\Variable 2\*")

Try this:

RUN(rar & chr(34) & " a -v15000000b -m0 -ed -ep1 -df " & chr(34) & "Variable1.rar" & chr(34) & " " & chr(34) & "c:\Variable 2\*" & chr(34))

chr(34) = ASCII double-quote

Here's a function I wrote a while back that I use quite often:

_RunRar("D:\sourcedir\Somefile.rar","D:\sourcedir","C:\destinationdir")

Func _RunRAR($sFile,$sSourceDir,$sDestDir)
 
     $iPIDRAR = Run(Chr(34) & @ProgramFilesDir & "\Winrar\rar.exe" & Chr(34) & " x -y -o- " & Chr(34) & $sFile & Chr(34) & " " & Chr(34) & "*.*" & Chr(34) & " " & Chr(34) & $sDestDir & "\" & Chr(34), $sSourceDir & "\", @SW_HIDE)
 
         if ProcessExists($iPIDRAR) then
 
             ProcessWaitClose($iPIDRAR)
 
         Else
             SetError(1)
         EndIf
 
 EndFunc
Edited by TrystianSky
Posted (edited)

I now have the following code:

#include <GUIConstants.au3>
 Global $Folder
 GUICreate ( "title" , 800 , 600 ); will create a dialog box that when displayed is centered
 
 GUICtrlCreateLabel ( "Invoer directory:", 10, 17 )
 $TITLE1 = GUICtrlCreateEdit($Folder, 110,  15, 325, 16, $ES_READONLY, $WS_EX_STATICEDGE)
 GUICtrlCreateLabel ( "Archief naam:", 10, 42 )
 $TITLE2 = GUICtrlCreateInput("", 110, 40, 100, 20)
;Creeer de bladeren knop
 $Bladeren = GUICtrlCreateButton ("Bladeren..",  440, 10, 70)
 $Start = GUICtrlCreateButton ("Start",  60, 120, 50)
 
 $ArchiefNaam = GUICtrlRead($TITLE2)
 
 GUISetState (@SW_SHOW)
 While 1
     $msg = GUIGetMsg()
        Select
         Case $MSG = $GUI_EVENT_CLOSE
             Exit
         Case  $msg = $Bladeren
             $Folder = FileSelectFolder("Kies de map.", "")
             If @error Then ContinueLoop 
             GUICtrlSetData($TITLE1, $Folder)
         Case $msg = $Start
             $a = Run("rar a -v15000000b -m0 -ed -ep1 -df " & chr(34) & $Folder & "\" & $ArchiefNaam & ".rar" & chr(34) & " " & chr(34) & $Folder & "\*" & chr(34)) 
             msgbox(0, "test", $ArchiefNaam)
     EndSelect
 Wend

But when I press the start button, the msgbox doestn't show $Archiefnaam, But when I replace $archiefnaam with GUICtrlRead($TITLE2) at the msgbox it does show what is typed at the input

Edited by eekhoorn12
  • Developers
Posted

I now have the following code:

But when I press the start button, the msgbox doestn't show $Archiefnaam, But when I replace $archiefnaam with GUICtrlRead($TITLE2) at the msgbox it does show what is typed at the input

That is correct, because the "$ArchiefNaam = GUICtrlRead($TITLE2)" line is at the wrong place.

You read the value of the $TITLE2 control before the GUI is displayed and anything is typed.

Move this line inside the While...Wend loop after "Case $msg = $Start" ..

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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
×
×
  • Create New...