Jump to content

RunWait


SWB
 Share

Recommended Posts

I did this small GUI for my own use for WinRAR, When I go to run it, the script errors out, no matter what I try, what am I doing wrong? Script is attached. This is uses a command line in the script.

Thanks,

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Global $Program = 'C:Program FilesWinRAR'

Dim $msg, $fsf

Dim $guiHandle = GUICreate("RAR", 200, 135)

GUICtrlCreateLabel('Name of RAR:' , 5, 5, 190)

Dim $Name = GUICtrlCreateInput("", 5, 20, 165)

GUICtrlCreateLabel('Archive File:' , 5, 50, 190)

Dim $Arc = GUICtrlCreateInput("", 5, 65, 165)

Dim $Folder = GUICtrlCreateButton( '...', 170, 65, 25, 22)

Dim $rarbutton = GUICtrlCreateButton("Run RAR", 5, 108, 75)

Dim $exitbutton = GUICtrlCreateButton("Exit", 120, 108, 75)

GUISetState(@SW_SHOW, $guiHandle )

While 1

$msg = GUIGetMsg($guiHandle )

Select

Case $msg == $GUI_EVENT_CLOSE Or $msg = $exitbutton

Exit

Case $msg == $Folder

$fsf = FileSelectFolder('Choose Folder to Archive','')

If Not @error Then GUICtrlSetData($Arc, $fsf)

Case $msg == $rarbutton

RunWait($Program & 'Rar.exe a -av -m5 -o+ -r -sfx' & GUICtrlRead($Name) & '.rar' & '' & GUICtrlRead($Arc)

Case Default

EndSelect

WEnd

RAR.au3

Edited by SWB
Link to comment
Share on other sites

@SWB

You are missing the right terminater for the RunWait function.

RunWait($Program & 'Rar.exe a -av -m5 -o+ -r -sfx' & GUICtrlRead($Name) & '.rar ' & '' & GUICtrlRead($Arc))

In Scite if you are missing the terminator character the brace just after the function name will be green when the text caret is either side of it, when you have wrapped the function parameters properly both braces will be blue when the text caret is either side of them.

(Colors used are the default)

Also since this is Rar.exe's commandline you might benefit from wrapping any of the file name or file paths (yes including rar.exe) with double quotes to compensate for file paths that contain spaces.

Vlad

Edited by Mobius

wtfpl-badge-1.png

Link to comment
Share on other sites

@SWB

You are missing the right terminater for the RunWait function.

RunWait($Program & 'Rar.exe a -av -m5 -o+ -r -sfx' & GUICtrlRead($Name) & '.rar ' & '' & GUICtrlRead($Arc))

In Scite if you are missing the terminator character the brace just after the function name will be green when the text caret is either side of it, when you have wrapped the function parameters properly both braces will be blue when the text caret is either side of them.

(Colors used are the default)

Also since this is Rar.exe's commandline you might benefit from wrapping any of the file name or file paths (yes including rar.exe) with double quotes to compensate for file paths that contain spaces.

Vlad

The GUI opens the RAR CMD window but it just sits there and does nothing, blinking cursor.

Thanks

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