qknet Posted February 21, 2006 Posted February 21, 2006 (edited) I'm new at Autoit and have no background on programming. Can any one help me with a code (autoit 3) that would build up a dialog on which there are a number of check-boxes and an OK button. clicking the OK button will run the selected programs, say, "pro1.exe", "pro2.exe"). I can draw up the dialog with GuiBuilder but I don't know how to set the action. Pls help Edited February 21, 2006 by qknet
NegativeNrG Posted February 21, 2006 Posted February 21, 2006 (edited) but i don't know how to set the action.What do you mean by "action", is it the function that will occur when the button is pressed?. if so, you should have got a while 1/wend loop, and everything in the body of the script, right?. Then. ;;Put this under ExitLoop. Case $msg = $YourButtonname;;Replace $YourButtonname with Your Button. if GUIctrlread($Checkbox) = $GUI_CHECKED Then Run("Pathtofile") Elseif GUIctrlread($Checkbox) = $GUI_CHECKED Then Run("PathtosecondFile") Endif i Havent Tested the code, so, hoping some other person will help you. EDIT: Code. Edited February 21, 2006 by NegativeNrG [size=20]My File Upload[/size]Register at my site and upload.
qknet Posted February 21, 2006 Author Posted February 21, 2006 This is what I got from the code generated by GuiBuilder#region --- GuiBuilder code Start ---; Script generated by AutoBuilder 0.6 Prototype#include <GuiConstants.au3>GuiCreate("MyGUI", 150, 193,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))$Checkbox_1 = GuiCtrlCreateCheckbox("Notepad", 20, 30, 90, 20)$Checkbox_2 = GuiCtrlCreateCheckbox("Calculator", 20, 60, 90, 30)$Checkbox_3 = GuiCtrlCreateCheckbox("Charmap", 20, 100, 80, 30)$Button_4 = GuiCtrlCreateButton("OK", 20, 140, 60, 30)GuiSetState()While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelectWEndExit#endregion --- GuiBuilder generated code End ---So where should i insert your code?
NegativeNrG Posted February 21, 2006 Posted February 21, 2006 (edited) #region --- GuiBuilder code Start --- ; Script generated by AutoBuilder 0.6 Prototype #include <GuiConstants.au3> GuiCreate("MyGUI", 150, 193,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Checkbox_1 = GuiCtrlCreateCheckbox("Notepad", 20, 30, 90, 20) $Checkbox_2 = GuiCtrlCreateCheckbox("Calculator", 20, 60, 90, 30) $Checkbox_3 = GuiCtrlCreateCheckbox("Charmap", 20, 100, 80, 30) $Button_4 = GuiCtrlCreateButton("OK", 20, 140, 60, 30) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $YourButtonname;;Replace $YourButtonname with Your Button. if GUIctrlread($Checkbox) = $GUI_CHECKED Then Run("Pathtofile") Elseif GUIctrlread($Checkbox) = $GUI_CHECKED Then Run("PathtosecondFile") Endif Case Else ;;; EndSelect WEnd Exit #endregion --- GuiBuilder generated code End --- Replace Pathtofile and Pathtosecondfile with your exe path's name. so it could be. Run("C:\Program files\file\myfile.exe") Edited February 21, 2006 by NegativeNrG [size=20]My File Upload[/size]Register at my site and upload.
NegativeNrG Posted February 21, 2006 Posted February 21, 2006 No Problem. Welcome to the Forums. [size=20]My File Upload[/size]Register at my site and upload.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now