Sign in to follow this  
Followers 0
Bio

File execution ( One after other )

8 posts in this topic

#1 ·  Posted (edited)

I have 3 checkboxes in my User Inteface.

3 checkboxes represent an application.( Application 1, Application 2 and Application 3)

I have 3 executable files(unattended installation files .exe ).

The user will launch the GUI, he will choose the applications by checking the checkboxes and will press the "Submit Button".. The first application will start, once it will finish the other will start till the end.

Scenerio: User opens the console, selects Application 1 and Application 3 and will press Submit button.

First Application 1 will start, after it will finish, the third one will start.

How can I do this? I tried RunWait but could not manage to make it work.

Here is the code below:

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 622, 441, 192, 125)
$Checkbox1 = GUICtrlCreateCheckbox("Application 1", 88, 24, 217, 33)
$Checkbox2 = GUICtrlCreateCheckbox("Application 2", 88, 72, 225, 33)
$Checkbox3 = GUICtrlCreateCheckbox("Application 3", 88, 120, 225, 41)
$Button1 = GUICtrlCreateButton("Submit", 224, 200, 105, 49)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
;;;;;;;
    EndSelect
WEnd
Exit
Edited by Bio

Share this post


Link to post
Share on other sites



That's not exactly progress.. that's just the GUI. But, because I know I can make this a simple explanation, I'll explain.

You need a case $Button1 inside your while loop, and inside that case you will check each of the checkboxes to see if they are checked or not. Do the checking first, and set variables such as $Application1Run to 1 (true). Then after all three are checked, do your if statements. If $Application1Run = 1 then RunWait ("application1.whatever"). RunWait really is what you want though.

Share this post


Link to post
Share on other sites

Thank you for your reply, I still could not figure it out.

$Application1Run = 1 then RunWait ("application1.whatever")

what do you mean with "whatever" here?

If I look at the decription of RunWait from Help file and if I try to integrate it in my GUI code above, it does not function.

Could you please give me a small sample code so it is clear for me?

Thank you in advance

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 622, 441, 192, 125)
$Checkbox1 = GUICtrlCreateCheckbox("Application 1", 88, 24, 217, 33)
$Checkbox2 = GUICtrlCreateCheckbox("Application 2", 88, 72, 225, 33)
$Checkbox3 = GUICtrlCreateCheckbox("Application 3", 88, 120, 225, 41)
$Button1 = GUICtrlCreateButton("Submit", 224, 200, 105, 49)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1
            If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
                RunWait(@ComSpec)
            EndIf
            If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED Then
                RunWait(@ComSpec & ' /k dir')
            EndIf
            If BitAND(GUICtrlRead($Checkbox3), $GUI_CHECKED) = $GUI_CHECKED Then
                RunWait(@ComSpec & ' /k dir | more')
            EndIf
        Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Thank you for it, seems like I did not get something. I replaced ComSpec with my executable files. I run the script and it gives me an error saying that " Please go to the control panel to install and configure system components".

Could someone please help me with this?

Thanks

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 622, 441, 192, 125)
$Checkbox1 = GUICtrlCreateCheckbox("Application 1", 88, 24, 217, 33)
$Checkbox2 = GUICtrlCreateCheckbox("Application 2", 88, 72, 225, 33)
$Checkbox3 = GUICtrlCreateCheckbox("Application 3", 88, 120, 225, 41)
$Button1 = GUICtrlCreateButton("Submit", 224, 200, 105, 49)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1
            If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
                RunWait("auto_app1.exe")
            EndIf
            If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED Then
                RunWait("auto_app2.exe" & ' /k dir')
            EndIf
            If BitAND(GUICtrlRead($Checkbox3), $GUI_CHECKED) = $GUI_CHECKED Then
                RunWait("auto_app3.exe" & ' /k dir | more')
            EndIf
        Case Else
       ;;;;;;;
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thank you for it, seems like I did not get something. I replaced ComSpec with my executable files. I run the script and it gives me an error saying that " Please go to the control panel to install and configure system components".

Could someone please help me with this?

Thanks

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 622, 441, 192, 125)
$Checkbox1 = GUICtrlCreateCheckbox("Application 1", 88, 24, 217, 33)
$Checkbox2 = GUICtrlCreateCheckbox("Application 2", 88, 72, 225, 33)
$Checkbox3 = GUICtrlCreateCheckbox("Application 3", 88, 120, 225, 41)
$Button1 = GUICtrlCreateButton("Submit", 224, 200, 105, 49)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1
            If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
                RunWait("auto_app1.exe")
            EndIf
            If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED Then
                RunWait("auto_app2.exe" & ' /k dir')
            EndIf
            If BitAND(GUICtrlRead($Checkbox3), $GUI_CHECKED) = $GUI_CHECKED Then
                RunWait("auto_app3.exe" & ' /k dir | more')
            EndIf
        Case Else
     ;;;;;;;
    EndSelect
WEnd
Exit

2 should be

RunWait("auto_app2.exe")

3 should be

RunWait("auto_app3.exe")

also you might want the path in there for example if the exe resides in the same folder as the script then

RunWait(@ScriptDir & "\auto_app2.exe")

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

2 should be

RunWait("auto_app2.exe")

3 should be

RunWait("auto_app3.exe")

also you might want the path in there for example if the exe resides in the same folder as the script then

RunWait(@ScriptDir & "\auto_app2.exe")

That is how it is.

2 is RunWait("auto_app2.exe")

3 is RunWait("auto_app3.exe")

This is how I added in my code, but I get the error message.

Do you think something is wrong?

Share this post


Link to post
Share on other sites

That is how it is.

2 is RunWait("auto_app2.exe")

3 is RunWait("auto_app3.exe")

This is how I added in my code, but I get the error message.

Do you think something is wrong?

Do your programs accept the " /k dir | more" switches? If not, you have to delete them. Also, like gafrost said, you should include the directory that the apps are found - the run does not know exactly where to find everything, and if you scripts are outside your local script dir, excluding the location will cause an error.

Share this post


Link to post
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
Sign in to follow this  
Followers 0