+ Post New Thread
Results 1 to 9 of 9
Scripts Thread, autoit help please in Coding and Web Development; Ive made an autoit script that has 2 columns of radio buttons, say for example A -> D and 1 ...
  1. #1

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,527
    Thank Post
    1,339
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200

    autoit help please

    Ive made an autoit script that has 2 columns of radio buttons, say for example A -> D and 1 - > 2 , and a GO button, and I want each different compbination of rado buttons (A and 1) (A and 2) etc to run a different thing.

    Can anyone whose skilled with Auto it knock us up a quick template I could use please that just pops up say a msgbox saying "You chose A and 1" etc please? I cant seem to find any examples of scripts with radio buttons ilke that..

    Cheers in advance!

  2. #2

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740
    Quote Originally Posted by rreynolds24 View Post
    Ive made an autoit script that has 2 columns of radio buttons, say for example A -> D and 1 - > 2 , and a GO button, and I want each different compbination of rado buttons (A and 1) (A and 2) etc to run a different thing.

    Can anyone whose skilled with Auto it knock us up a quick template I could use please that just pops up say a msgbox saying "You chose A and 1" etc please? I cant seem to find any examples of scripts with radio buttons ilke that..

    Cheers in advance!
    Code:
    MsgBox(64,"Oi you !!","You chose A and 1")

    Use Codewizard or Koda. Should be part of the SciTE package....

    http://www.autoitscript.com/autoit3/scite/

  3. #3

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,527
    Thank Post
    1,339
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    I can make the textboxes fine its passing which radio buttons have been selected I cant do, sorry, didnt explain myself well again.

    Ill check out that link thanks.

  4. #4

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740
    Quote Originally Posted by rreynolds24 View Post
    I can make the textboxes fine its passing which radio buttons have been selected I cant do, sorry, didnt explain myself well again.

    Ill check out that link thanks.
    You will need to create a loop and make each radio button a variable which will then have a value when its been selected:

    Dirty code.

    While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = $Button1
    Do something
    Case $nMsg = $Button2
    Do something
    Endselect
    Wend
    etc....

  5. #5

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,527
    Thank Post
    1,339
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    Ok thanks for the advice but I really cant get my head round it.

    Hope its ok to post this code

    Code:
    #include <GDIPlus.au3>
    #include <GuiConstantsEx.au3>
    #include <GUIConstants.au3>
    
    ;Opt("MustDeclareVars", 1)
    ;
    ; Program to simplify the printing and archiving of School Reports
    ;
    ; Written by R. Reynolds, 2008
    ; 
    
    ; Declare all the variables
    
    Global $hGUI, $msg, $hImage, $hGraphic, $button1, $button2, $label_1, $label_2, $label_3, $optJunior, $optTransitus, $optS1, $optS2, $optS3, $optS4, $optS56, $optrep, $optatt, $iMsgBoxAnswer2, $iMsgBoxAnswer 
    
    ; Create GUI
    $hGUI = GUICreate("School Reporting System - Version 0.1a", 550, 215)
    GUISetState()
    
    $filemenu = GuiCtrlCreateMenu ("File")
    $exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu)
    $helpmenu = GuiCtrlCreateMenu ("?")
    $helpitem = GuiCtrlCreateMenuitem ("Help",$helpmenu)
    $aboutitem = GuiCtrlCreateMenuitem ("About",$helpmenu)
    
    
    ; Load PNG image
    _GDIPlus_StartUp()
    $hImage   = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\badge.png")
    
    ; Draw PNG image
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)
    
    ; Loop until user exits
    
    ; Draw the Print and Save Icons
    
    $button1 = GUICtrlCreateButton ("1", 170,100,75,75,$BS_ICON)
    GUICtrlSetImage (-1, "shell32.dll",7)
    
    $button2 = GUICtrlCreateButton ("2", 170,10,75,75,$BS_ICON)
    GUICtrlSetImage (-1, "shell32.dll",17)
    
    GUISetState()
    
    $Label_1 = GuiCtrlCreateLabel("Created by Robert Reynolds", 390, 180, 150, 21, 0x1000)
    
    GUICtrlCreateGroup("Year", 280, 5, 150, 170)
    $optJunior = GUICtrlCreateRadio("Junior", 290, 20, 100, 20)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $optTransitus = GUICtrlCreateRadio("Transitus", 290, 40, 100, 20)
    $optS1 = GUICtrlCreateRadio("S1", 290, 60, 100, 20)
    $optS2 = GUICtrlCreateRadio("S2", 290, 80, 100, 20)
    $optS3 = GUICtrlCreateRadio("S3", 290, 100, 120, 20)
    $optS4 = GUICtrlCreateRadio("S4", 290, 120, 100, 20)
    $optS56 = GUICtrlCreateRadio("S5 and S6", 290, 140, 130, 20)
    GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group
    
    
    GUICtrlCreateGroup("Option", 420, 5, 120, 170)
    $optrep = GUICtrlCreateRadio("Reports", 440, 60, 100, 10)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $optatt=  GUICtrlCreateRadio("Attitudinals", 440, 80, 100, 10)
    GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group
    
    
    While 1
        $msg = GUIGetMsg()
    		Select
    			Case $msg = $exititem
    				ExitLoop
    			
    			Case $msg = $aboutitem
    				MsgBox(64,"School Reporting System","School Reporting System Windows Utility." & @CRLF & "" & @CRLF & "This program is designed to simplify the Printing of completed reports." & @CRLF & "" & @CRLF & "Designed By R Reynolds. May 2008")
    	
    			Case $msg = $helpitem
    				MsgBox(32,"School Reporting System","This button will display some brief help about the program")
    	   ; The Save Button
    			Case $msg = $button1
    				$iMsgBoxAnswer2 = MsgBox(36,"Archiving reports....","Are you sure you want to archive the complete set of <insert year> Reports?")
    
    		;	Case $msg = 
    		
    			Select
    				Case $iMsgBoxAnswer2 = 6 ;Yes
    					MsgBox(64,"School Reporting System","Reports archived.")
    				Case $iMsgBoxAnswer2 = 7 ;No
    		
    			EndSelect
           
    				Case $msg = $button2
    					$iMsgBoxAnswer = MsgBox(36,"Printing reports....","Are you sure you want to print the complete set of <insert year> Reports?")
    			Select
    			
    				Case $iMsgBoxAnswer = 6 ;Yes
    					MsgBox(64,"School Reporting System","Reports sent to the printer")
    					; run("cscript print_test.vbs")
    				Case $iMsgBoxAnswer = 7 ;No
    			
    			EndSelect       
    			 
    		EndSelect
       If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    
        
    Wend
      
    ; Display the exit dialog
    
    Dim $iMsgBoxAnswer
    $iMsgBoxAnswer = MsgBox(52,"Close Program","Are you sure you want to exit this program?")
    Select
       Case $iMsgBoxAnswer = 6 ;Yes
       
    
       Case $iMsgBoxAnswer = 7 ;No
    
    	;	What do I put in here to keep the program running?
    
    EndSelect
    
    ; Clean up and exit
    
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_ShutDown()
    
    GUIDelete()
    
    Exit
    Any chance someone could add in a bit of the missing stuff to get me going please?
    Last edited by RabbieBurns; 22nd May 2008 at 03:37 PM.

  6. #6

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,527
    Thank Post
    1,339
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    ok, scrap the last post... Can anyone post me an example of an autoit script with just simply 2 radio options, and a button, which when the button is pressed displays a different message box dependant on which radio button is selected.

    Thats basically the bit im stuck at in my big script so if anyone could offer a wee example script please I think I should be able to take it from there

    Cheers

  7. #7

    Join Date
    Jun 2008
    Location
    OKLAHOMA
    Posts
    2
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Here is your request

    Quote Originally Posted by RabbieBurns View Post
    ok, scrap the last post... Can anyone post me an example of an autoit script with just simply 2 radio options, and a button, which when the button is pressed displays a different message box dependant on which radio button is selected.

    Thats basically the bit im stuck at in my big script so if anyone could offer a wee example script please I think I should be able to take it from there

    Cheers
    Here is straight out of the help file, hope it helps..
    Code:
    #include <GUIConstantsEx.au3>
    
    Opt('MustDeclareVars', 1)
    
    Example()
    
    ;-------------------------------------------------------------------------------------
    ; Example - Press the button to see the value of the radio boxes
    ; The script also detects state changes (closed/minimized/timeouts, etc).
    Func Example()
    	Local $button_1, $group_1, $radio_1, $radio_2, $radio_3
    	Local $radioval1, $radioval2, $msg
    
    	Opt("GUICoordMode", 1)
    	GUICreate("Radio Box Demo", 400, 280)
    
    	; Create the controls
    	$button_1 = GUICtrlCreateButton("B&utton 1", 30, 20, 120, 40)
    	$group_1 = GUICtrlCreateGroup("Group 1", 30, 90, 165, 160)
    	GUIStartGroup()
    	$radio_1 = GUICtrlCreateRadio("Radio &0", 50, 120, 70, 20)
    	$radio_2 = GUICtrlCreateRadio("Radio &1", 50, 150, 60, 20)
    	$radio_3 = GUICtrlCreateRadio("Radio &2", 50, 180, 60, 20)
    
    	; Init our vars that we will use to keep track of GUI events
    	$radioval1 = 0    ; We will assume 0 = first radio button selected, 2 = last button
    	$radioval2 = 2
    
    	; Show the GUI
    	GUISetState()
    
    	; In this message loop we use variables to keep track of changes to the radios, another
    	; way would be to use GUICtrlRead() at the end to read in the state of each control
    	While 1
    		$msg = GUIGetMsg()
    		Select
    			Case $msg = $GUI_EVENT_CLOSE
    				MsgBox(0, "", "Dialog was closed")
    				Exit
    			Case $msg = $GUI_EVENT_MINIMIZE
    				MsgBox(0, "", "Dialog minimized", 2)
    			Case $msg = $GUI_EVENT_MAXIMIZE
    				MsgBox(0, "", "Dialog restored", 2)
    
    			Case $msg = $button_1
    				MsgBox(0, "Default button clicked", "Radio " & $radioval1)
    
    			Case $msg >= $radio_1 And $msg <= $radio_3
    				$radioval1 = $msg - $radio_1
    
    		EndSelect
    	WEnd
    EndFunc   ;==>Example

  8. Thanks to gseller from:

    RabbieBurns (16th June 2008)

  9. #8

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,527
    Thank Post
    1,339
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200


    Thanks. Must have missed that

  10. #9

    Join Date
    Jun 2008
    Location
    OKLAHOMA
    Posts
    2
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Easy To miss..

    Not a problem, Lots of info in there, easy to miss...

SHARE:
+ Post New Thread

Similar Threads

  1. AutoIT help.
    By K.C.Leblanc in forum Scripts
    Replies: 7
    Last Post: 28th November 2007, 03:27 PM
  2. software via autoit in AD
    By chrbb in forum Windows
    Replies: 6
    Last Post: 14th November 2007, 08:15 AM
  3. AutoIT help
    By randle in forum Windows
    Replies: 14
    Last Post: 11th July 2007, 09:26 AM
  4. AutoIT
    By Gatt in forum Scripts
    Replies: 3
    Last Post: 3rd July 2007, 01:29 PM
  5. Install software using AutoIT??
    By SpuffMonkey in forum How do you do....it?
    Replies: 3
    Last Post: 21st March 2007, 01:50 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •