Jump to content

Two forms


Scampy
 Share

Recommended Posts

Hi!

Please help to finish the script. At this moment it is not working, but I think the meaning is clear

Thanks

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>

$Form = GUICreate("Test", 150, 150)
$Plugins = GUICtrlCreateButton("Push", 20, 20, 70, 25)

GUISetState(@SW_SHOW)
While 1
   Switch GUIGetMsg()
      Case $GUI_EVENT_CLOSE
         Exit
      Case $Plugins
         Plugins()
   EndSwitch
WEnd

Func Plugins()
$Form2 = GUICreate("Test2", 550, 350, -1, -1, $Form)
$Radio1 = GUICtrlCreateRadio("Radio1", 20, 20, 50, 17)
$Radio2 = GUICtrlCreateRadio("Radio2", 80, 20, 50, 17)
$Radio3 = GUICtrlCreateRadio("Radio3", 140, 20, 50, 17)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 20, 40, 150, 25)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 20, 60, 150, 25)

$Button = GUICtrlCreateButton("Start", 20, 230, 100, 25)
$ButtonClose = GUICtrlCreateButton("Close", 20, 280, 60, 25)

GUISetState()

While 1
   Switch GUIGetMsg()
      Case -3, $ButtonClose
         ExitLoop
      Case -3, $Button
         If GUICtrlRead($Radio1) = 1 Then
            abc1()
         EndIf
         If GUICtrlRead($Radio2) = 1 Then
            abc2()
         EndIf
         If GUICtrlRead($Radio3) = 1 Then
            abc3()
         EndIf
  EndSwitch
WEnd
   GUIDelete($Form2)
EndFunc

Func abc1()
   If GUICtrlRead($Checkbox1) = 1 Then
      ShellExecute("calc.exe")
   EndIf
   If GUICtrlRead($Checkbox2) = 1 Then
      ShellExecute("cmd.exe")
   EndIf
EndFunc

Func abc2()
   If GUICtrlRead($Checkbox1) = 1 Then
      ShellExecute("notepad.exe")
   EndIf
   If GUICtrlRead($Checkbox2) = 1 Then
      ShellExecute("regedit.exe")
   EndIf
EndFunc

Func abc3()
   If GUICtrlRead($Checkbox1) = 1 Then
      ShellExecute("wordpad.exe")
   EndIf
   If GUICtrlRead($Checkbox2) = 1 Then
      ShellExecute("dxdiag.exe")
   EndIf
EndFunc

 

Link to comment
Share on other sites

  • Moderators

@Scampy "it's not working" doesn't help anyone help you. How about a detailed description of what is not working as you would like it to, or what errors you are receiving?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

*Google translate*

I am sorry that more did not describe the problem. For example at allocation radio2 it was possible to choose what checkboxes to run. Each checkbox is the team. And the choice what team will be regulates radios. For example, I brought this code. But I understand that function won't work in other function. Therefore I can't understand how to make

Link to comment
Share on other sites

Try this:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>

$Form = GUICreate("Test", 150, 150)
$Plugins = GUICtrlCreateButton("Push", 20, 20, 70, 25)

GUISetState(@SW_SHOW)
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Plugins
            Plugins()
    EndSwitch
WEnd

Func Plugins()
    $Form2 = GUICreate("Test2", 550, 350, -1, -1, $Form)
    $Radio1 = GUICtrlCreateRadio("Radio1", 20, 20, 50, 17)
    $Radio2 = GUICtrlCreateRadio("Radio2", 80, 20, 50, 17)
    $Radio3 = GUICtrlCreateRadio("Radio3", 140, 20, 50, 17)
    $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 20, 40, 150, 25)
    $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 20, 60, 150, 25)

    $Button = GUICtrlCreateButton("Start", 20, 230, 100, 25)
    $ButtonClose = GUICtrlCreateButton("Close", 20, 280, 60, 25)

    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $ButtonClose
                ExitLoop
            Case $Button
                If GUICtrlRead($Radio1) = 1 Then
                    If GUICtrlRead($Checkbox1) = 1 Then
                        ShellExecute("calc.exe")
                    EndIf
                    If GUICtrlRead($Checkbox2) = 1 Then
                        ShellExecute("cmd.exe")
                    EndIf
                EndIf
                If GUICtrlRead($Radio2) = 1 Then
                    If GUICtrlRead($Checkbox1) = 1 Then
                        ShellExecute("notepad.exe")
                    EndIf
                    If GUICtrlRead($Checkbox2) = 1 Then
                        ShellExecute("regedit.exe")
                    EndIf
                EndIf
                If GUICtrlRead($Radio3) = 1 Then
                    If GUICtrlRead($Checkbox1) = 1 Then
                        ShellExecute("wordpad.exe")
                    EndIf
                    If GUICtrlRead($Checkbox2) = 1 Then
                        ShellExecute("dxdiag.exe")
                    EndIf
                EndIf
            Case $GUI_EVENT_CLOSE
                Return GUIDelete($Form2)
        EndSwitch
    WEnd
    GUIDelete($Form2)
EndFunc   ;==>Plugins

 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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