First, watch the screenshot I attached:
The background beneath the radios is that a value is subtracted from Player 1, and added to player 2, in the case of the screenshot I made.
You can see that I created 2 radio groups. On the upper part, radio 1 and 2, and on the lower part radio 5 and 6. Now I automated the buttons in such a way ,that when in group 1 player 1 is selected, player 2 in group 2 automatically gets checked for you. Same thing when checking player 2 in the upper part: player 1 gets checked on the lower part. I did this because there is no reason selecting player 1 or 2 twice, because nothing will change. Now that runs smoothly using this script:
If GUICtrlRead($Radio1)=1 And Not BitAND(GUICtrlGetState($Radio6),1) And Not BitAND(GUICtrlGetState($Radio5),1) Then GUICtrlSetState($Radio6,1) If GUICtrlRead($Radio2)=1 And Not BitAND(GUICtrlGetState($Radio5),1) And Not BitAND(GUICtrlGetState($Radio6),1) Then GUICtrlSetState($Radio5,1) If GUICtrlRead($Radio5)=1 And Not BitAND(GUICtrlGetState($Radio2),1) And Not BitAND(GUICtrlGetState($Radio1),1) Then GUICtrlSetState($Radio2,1) If GUICtrlRead($Radio6)=1 And Not BitAND(GUICtrlGetState($Radio1),1) And Not BitAND(GUICtrlGetState($Radio2),1) Then GUICtrlSetState($Radio1,1) But there is a problem when clicking on a radio in group 2, the lower one. It is very hard to check one, because for some reason the radio get's deselected instantly most of the time. I already tried to prevent it by using the second BitAND() in the codes I shared (It doesn't check the radio automatically if the other radio in the other group is selected, meaning that the user want's to switch the radios). But it didn't work.
Does somebody know why you sometimes can't check radio 5 or 6 (the lower part)?
i have searched a lot about how to run external programs with the administrator privileges without the script running with administrator privileges using autoit
But all my attempts failed
Finally, today I found the VBS function doing this task
I immediately transferred it to our beloved language (autoit) and i decided to share it with you
i hope you like it
This is a simple example about how to use the function
runAsAdmin("cmd.exe", "/c @echo off & cls & echo test & pause", "c:\", @sw_show)
this is the function
func runAsAdmin($program, $parameters = "", $workingDir = @workingDir, $show = "") local $oShell = OBJCreate("Shell.Application") if isOBJ($oShell) then local $result = $oShell.ShellExecute($program, $parameters, $workingDir, "runas", $show) else $result = false endIf return $result endFunc
Detect if the focus item is a button or check box
My dears I have a problem
When I try to use
it doesn't recognize the check boxes.
The result is that the selector is a button
Although the specified is a check box
but I want a way to identify the check boxes.
Because I want to make a tool that helps screen readers users
I hope you have the solution.
Thank you in advance.
I created 3 radio buttons and when the script is run, the selected buttons display the text on the right of the actual button. Also, it appears like the radio button occupies space around it, as it obscures part of the other controls when I hover the mouse around it. I would like to group the buttons closer together and put other controls on the right of them. I also wanted to make the button text display on the left side of the button.
Here is my test code:
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 Opt("GUICloseOnESC", 1) ; ESC closes GUI? (0 = no, 1 = yes) Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Opt('MustDeclareVars', 1) OnAutoItExitRegister("ExitStageLeft") Opt("GUIEventOptions", 1) ;0=default, 1=just notification, 2=GuiCtrlRead tab index _Main() Func _Main() GUICreate("test", 300, 300, -1, -1, -1, -1) GUIStartGroup() local $x = 50, $y = 10, $w = 40, $h = 15,$spcY = 15 GUICtrlCreateRadio("", $x, $y, $w, $h) GUICtrlCreateRadio("ABC", $x, $y + ($spcY*1), $w, $h) GUICtrlCreateRadio("", $x, $y + ($spcY*2), $w, $h) GUIStartGroup() GUICtrlCreateInput("An Input Control", 70, 10, 110, 30) GUICtrlCreateInput("Another Input Control", 10, 73, 110, 20) GUISetOnEvent(-3, 'ExitStageLeft') GUISetState(@SW_SHOW) While (1) Sleep(251) WEnd EndFunc Func ExitStageLeft() Exit EndFunc I want "ABC" to display on the left of the 2nd radio button.
I am maybe an intermediate AutoIt script writer, but have no experience creating GUIs.
I have a script with two functions. One for Checkboxes and another with radio buttons. Each function creates it's own window.
I'd like to use one window with both checkboxes and radio buttons.
I pulled samples from AutoIt Help and other places and worked it into this: (RadioCheck still uses the example Case and MsgBoxes. I will clean this up soon)
Func CheckOptions() ; Create a GUI with various controls. Local $hGUI = GUICreate("SGX4CP Options", 275, 250) ; Create a checkbox control. Local $iLoopCheckbox = GUICtrlCreateCheckbox("Loop", 10, 10, 185, 25) Local $iFullScreenCheckbox = GUICtrlCreateCheckbox("Fullscreen", 10, 40, 185, 25) Local $iRestartPlaybackCheckbox = GUICtrlCreateCheckbox("Restart Playback from Sleep", 10, 70, 185, 25) GUICtrlSetState($iRestartPlaybackCheckbox, $GUI_CHECKED) Local $iDisableSleepCheckbox = GUICtrlCreateCheckbox("Disable Sleep", 10, 100, 185, 25) Local $iLogCheckbox = GUICtrlCreateCheckbox("Show Log", 10, 130, 185, 25) GUICtrlSetState($iLogCheckbox, $GUI_CHECKED) Local $idClose = GUICtrlCreateButton("Next", 110, 220, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $iLoopCheckbox If _IsChecked($iLoopCheckbox) Then $bLoopChecked = True Else $bLoopChecked = False EndIf Case $iFullScreenCheckbox if _IsChecked($iFullScreenCheckbox) Then $bFullScreenChecked = True Else $bFullScreenChecked = False EndIf Case $iRestartPlaybackCheckbox if _IsChecked($iRestartPlaybackCheckbox) Then $bRestartPlaybackChecked = True Else $bRestartPlaybackChecked = False EndIf Case $iDisableSleepCheckbox if _IsChecked($iDisableSleepCheckbox) Then $bDisableSleepChecked = True Else $bDisableSleepChecked = False EndIf Case $iLogCheckbox if _IsChecked($iLogCheckbox) Then $bLogChecked = True Else $bLogChecked = False EndIf EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc Func RadioCheck() GUICreate("Select Test",300,180) ; will create a dialog box that when displayed is centered Local $idRadio1 = GUICtrlCreateRadio("Loop Forever", 10, 10) Local $idRadio2 = GUICtrlCreateRadio("Play each video 3 times", 10, 40) Local $idRadio3 = GUICtrlCreateRadio("Play each video separately", 10, 70) GUICtrlSetState($idRadio1, $GUI_CHECKED) Local $idClose = GUICtrlCreateButton("Start Test", 120,100) GUISetState(@SW_SHOW) Local $idMsg ; Loop until the user exits. While 1 $idMsg = GUIGetMsg() Select Case $idMsg = $GUI_EVENT_CLOSE ExitLoop Case $idMsg = $idRadio1 And BitAND(GUICtrlRead($idRadio1), $GUI_CHECKED) = $GUI_CHECKED MsgBox($MB_SYSTEMMODAL, 'Info:', 'The app will run forever, playing each video once, then looping back to the first video.') $bTestSelectForever = True Case $idMsg = $idRadio2 And BitAND(GUICtrlRead($idRadio2), $GUI_CHECKED) = $GUI_CHECKED MsgBox($MB_SYSTEMMODAL, 'Info:', 'Each video will loop 3 times then move to the next video.') $bTestSelect3Times = True Case $idMsg = $idRadio3 And BitAND(GUICtrlRead($idRadio2), $GUI_CHECKED) = $GUI_CHECKED MsgBox($MB_SYSTEMMODAL, 'Info:', 'Player opens, first video plays, player closes. Player opens, second video plays, player closes, etc.') $bTestSelectSingleVideo = True EndSelect WEnd EndFunc I would like to combine the checkbox "Loop" and the radio button $idRadio2. Radio2 requires Loop to be checked.
I planned to remove the Loop checkbox and only enable it if Radio2 is selected.
Can I combine these two functions into one with one window with both Checkboxes and Radio Buttons?