Jump to content

Gui For An Easy Software Installation


 Share

Recommended Posts

Hi

I have several Autoit Skripts installing umpteen Software automatically.

Now i try to get a GUI, so i can choose whitch software i want to install,

by clicking a checkbox.

In the Forum i found a GUI, but it doesnt work !!??!!!

#include "GUIConstants.au3"

;Create Window

GUICreate("ESS Software", 400, 200)

GUICtrlCreateLabel("What software would you like to install?", 30, 10)

$okbutton = GUICtrlCreateButton("OK", 100, 100, 60, 30)

;Create CheckBoxes

$check1 = GUICtrlCreateCheckbox ("CMD", 30, 30, 90, 30)

$check2 = GUICtrlCreateCheckbox ("MEdia Player", 30, 60, 80, 20)

$check3 = GUICtrlCreateCheckbox ("Calculator", 30, 90, 80, 20)

; Show GUI, and wait for OK to be pressed

GUISetState ()

While GuiGetMsg() <> $okbutton

Wend

GuiDelete();get rid of GUI right away; this is optional

If GUIRead($check1) = $GUI_CHECKED THEN Runwait("cmd.exe", "", @SW_MAXIMIZE)

If GUIRead($check2) = $GUI_CHECKED THEN RunWait("mplay32.exe", "", @SW_MAXIMIZE)

If GUIRead($check3) = $GUI_CHECKED THEN RunWait("calc.exe", "", @SW_MAXIMIZE)

Exit

Can somebody tell me why it won't work. The Problem seems to be the last three Lines...

Because Autoit has a problem with "GUIRead".

When i change to "GUICTRLREAD" it starts the GUI, but it doesn't run any software .

Link to comment
Share on other sites

  • Moderators

Can somebody tell me why it won't work. The Problem seems to be the last three Lines...

Because Autoit has a problem with "GUIRead".

When i change to "GUICTRLREAD" it starts the GUI, but it doesn't run any software .

GUIRead is not a function... GUICtrlRead() is... And your trying to read the GUI after you've deleted it.
#include "GUIConstants.au3"

;Create Window
GUICreate("ESS Software", 400, 200)
GUICtrlCreateLabel("What software would you like to install?", 30, 10)
$okbutton = GUICtrlCreateButton("OK", 100, 100, 60, 30)

;Create CheckBoxes
$check1 = GUICtrlCreateCheckbox ("CMD", 30, 30, 90, 30)
$check2 = GUICtrlCreateCheckbox ("MEdia Player", 30, 60, 80, 20)
$check3 = GUICtrlCreateCheckbox ("Calculator", 30, 90, 80, 20)

; Show GUI, and wait for OK to be pressed
GUISetState ()
While GuiGetMsg() <> $okbutton
    Sleep(10)
Wend
$ReadCheck1 = GUICtrlRead($check1)
$ReadCheck2 = GUICtrlRead($check2)
$ReadCheck3 = GUICtrlRead($check3)
GuiDelete();get rid of GUI right away; this is optional

If $ReadCheck1 = $GUI_CHECKED THEN MsgBox(0,'test1', 'works');Runwait("cmd.exe", "", @SW_MAXIMIZE)
If $ReadCheck2 = $GUI_CHECKED THEN MsgBox(0,'test2', 'works');RunWait("mplay32.exe", "", @SW_MAXIMIZE)
If $ReadCheck3 = $GUI_CHECKED THEN MsgBox(0,'test3', 'works');RunWait("calc.exe", "", @SW_MAXIMIZE)
Exit

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

GUIRead is not a function... GUICtrlRead() is... And your trying to read the GUI after you've deleted it.

#include "GUIConstants.au3"

;Create Window
GUICreate("ESS Software", 400, 200)
GUICtrlCreateLabel("What software would you like to install?", 30, 10)
$okbutton = GUICtrlCreateButton("OK", 100, 100, 60, 30)

;Create CheckBoxes
$check1 = GUICtrlCreateCheckbox ("CMD", 30, 30, 90, 30)
$check2 = GUICtrlCreateCheckbox ("MEdia Player", 30, 60, 80, 20)
$check3 = GUICtrlCreateCheckbox ("Calculator", 30, 90, 80, 20)

; Show GUI, and wait for OK to be pressed
GUISetState ()
While GuiGetMsg() <> $okbutton
    Sleep(10)
Wend
$ReadCheck1 = GUICtrlRead($check1)
$ReadCheck2 = GUICtrlRead($check2)
$ReadCheck3 = GUICtrlRead($check3)
GuiDelete();get rid of GUI right away; this is optional

If $ReadCheck1 = $GUI_CHECKED THEN MsgBox(0,'test1', 'works');Runwait("cmd.exe", "", @SW_MAXIMIZE)
If $ReadCheck2 = $GUI_CHECKED THEN MsgBox(0,'test2', 'works');RunWait("mplay32.exe", "", @SW_MAXIMIZE)
If $ReadCheck3 = $GUI_CHECKED THEN MsgBox(0,'test3', 'works');RunWait("calc.exe", "", @SW_MAXIMIZE)
Exit

Thank you, works fine...

Now i try to accommodate it to my needs

Link to comment
Share on other sites

There are two problems i have now...

first:

the "red X" (close) button in the upper right corner doesn't work.

second:

i want to start the programms from another Folder.

the GUI is in Folder "Installer" and the Programms are in in the Folder "Installer\Programms"

but the skript cant find the Programms.

If $ReadCheck2 = $GUI_CHECKED THEN RunWait("Skype2.0.exe", "\Installer\Programms\", @SW_MAXIMIZE)

If $ReadCheck3 = $GUI_CHECKED THEN RunWait("cdex.exe", "\Installer\Programms\", @SW_MAXIMIZE)

i don't want to give a Path like "C:\Test\Installer\Programms" because if i copy the whole "Installer" Folder to another Path it wont work any more.

Thank you for now...

Brick

Link to comment
Share on other sites

There are two problems i have now...

first:

the "red X" (close) button in the upper right corner doesn't work.

second:

i want to start the programms from another Folder.

the GUI is in Folder "Installer" and the Programms are in in the Folder "Installer\Programms"

but the skript cant find the Programms.

i don't want to give a Path like "C:\Test\Installer\Programms" because if i copy the whole "Installer" Folder to another Path it wont work any more.

Thank you for now...

Brick

For your first problem with the red x... Try changing this part of your gui script

While GuiGetMsg() <> $okbutton
    Sleep(10)
Wend

To This:

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $okbutton
        ExitLoop
    EndSelect
Wend

For your second problem,

Instead of using

If $ReadCheck2 = $GUI_CHECKED THEN RunWait("Skype2.0.exe", "\Installer\Programms\", @SW_MAXIMIZE)
If $ReadCheck3 = $GUI_CHECKED THEN RunWait("cdex.exe", "\Installer\Programms\", @SW_MAXIMIZE)

Try using

If $ReadCheck2 = $GUI_CHECKED THEN RunWait("Installer\Programms\Skype2.0.exe", "", @SW_MAXIMIZE)
If $ReadCheck3 = $GUI_CHECKED THEN RunWait("Installer\Programms\cdex.exe", "", @SW_MAXIMIZE)
Link to comment
Share on other sites

@exodius ....

Thanks a lot... works fine...

i thought i tryed the second problem by myself.... and it didn't work... seems i had one "\" to much.

now it works...

The Problem with the "red X" is also solved...

Thanks...

Link to comment
Share on other sites

@exodius ....

Thanks a lot... works fine...

i thought i tryed the second problem by myself.... and it didn't work... seems i had one "\" to much.

now it works...

The Problem with the "red X" is also solved...

Thanks...

and another happy customer :think:

i have fixed my own gui to with the info here :-) thnx u 2 from my side :(:)

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