Search the Community
Showing results for tags 'disable'.
-
hello autoit team please i need your help today am trying to make the list of features in list view and control it am using the dism command line to read output i've made the code but i found some problems what i need is the list of features in 2d array $array[$n][0]= name $array[$i][1] = state when i tested the code it give me some results that i don't need to it e.g ------ ------ | -------- or name | state i need just the list of features and there state please help me to do that here is my example #RequireAdmin #NoTrayIcon #include <AutoItConstants.au3> Wow64EnableWow64FsRedirection(false) _Windows_Get_Features() func _Windows_Get_Features() local $a_FeaturesArray[1][2] $a_FeaturesArray[0][0] local $i_Dism_Run = Run("DISM /online /english /get-features /format:table", "", @sw_hide, BitOR($STDERR_CHILD, $STDOUT_CHILD)) local $s_OutputDism = "", $a_OutPutDism While 1 $s_OutputDism = StdoutRead($i_Dism_Run) If @error Then exitLoop if ($s_OutputDism = "") or (StringRegExp($s_OutputDism, "^((\-){1,})?(?:\s)\|?(?:\s)((\-){1,})$", 0) = 1) then ContinueLoop if (StringRegExp($s_OutputDism, "((([\s\d\-\+\_\,]{1})\|([\s\d\-\+\_\,]{1})){1,})", 0) = 1) then $a_OutPutDism = StringSplit($s_OutputDism, @lf) for $i = 1 to $a_OutPutDism[0] if msgBox(1, $i, $a_OutPutDism[$i]) = 1 then exitLoop next endIf Wend endFunc func Wow64EnableWow64FsRedirection($b_Enabled) local $h_OpenFS = DLLOpen("kernel32.dll") local $Return = DllCall($h_OpenFS, "boolean", "Wow64EnableWow64FsRedirection", "boolean", $b_Enabled) if @error then DLLClose($h_OpenFS) Return SetError(@error, @extended, -1) else DLLClose($h_OpenFS) Return $Return[0] endIf endFunc
-
Hello. For a project of a tool, I have to launch a program. This one: Display Properties control (run desk.cpl) I have to resize it, so we can see what's necessary. I'm getting there. The problem is that there is a drop-down menu: so I want to disable it. How to do this? I already did a test with the notepad. By deactivating the "close" button. Here is the code: Run("Notepad.exe") WinWait("[CLASS:Notepad]") $Hwnd = WinGetHandle("[CLASS:Notepad]") $menu = DllCall("user32.dll","hwnd","GetSystemMenu","hwnd", $Hwnd, "int",0) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", 0xF060, "int", 0x0);SC_CLOSE MsgBox(0,'',1) $menu = DllCall("user32.dll","hwnd","GetSystemMenu","hwnd", $Hwnd, "int",1) DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", 0xF060, "int", 0x0);SC_CLOSE I would like to do the same, but with the drop-down menu (with DllCall). Is it possible to disable / block (or other) the drop-down menu of a program? Thank you for your answers. Sincerely, Thomas.
- 4 replies
-
- dropdown
- external window
-
(and 1 more)
Tagged with:
-
Hello Forum, As said in the title, I'm searching a way to disable all tabstops in a GUI. My GUI includes 15 buttons and 3 edit controls. My questions: - is there a way to disable all tabstops at a time - is there a way to list all controls of a GUI and then disable tabstops one by one - or should I use the following line after each button creation: _WinAPI_SetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE, BitAND(_WinAPI_GetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE), BitNOT($WS_TABSTOP))) Thanks in advance for your valuable help! Thoms Edit: or maybe disable TAB key? I don't remember how to do!
-
Hi, I'm trying to automate the process of configuring the three McAfee settings seen in the image I've attached (Host IPS, Network IPS and Firewall). Clicking one of them toggles the setting and closes the menu. I want them all OFF. This script will be used on different computers so the settings might be have different initial setups. This is my first time using AutoIt and I have very limited coding experience--mostly MATLAB. Please excuse any lack of knowledge or terminology. So far my code is able to 1. Find the visible McAfee icon in the system tray. 2. Click the icon. 3. Send "Q" to open up the Quick Settings menu. 4. Toggle settings blindly using keystrokes. The problem I'm having is I don't know how to "read" the status of the setting before toggling it. This means I might be switching it from Off to On by mistake, when I should really just leave it alone. I'm wondering a couple of things. 1. Is there an easy way to "read" the status of the setting? This would solve the problem. Part of the challenge with this overall assignment is that there doesn't seem to be any sort of "control" built into these menus. In other words, the only thing that changes in Au3Info when you hover over different options is the coordinates of the mouse--there aren't any unique control IDs or texts to my knowledge that differentiate between different settings or menus. I don't know how to search for text in a menu and get an index or anything like that. I've attached my code at the bottom and commented-out two ideas I had for reading the status and acting accordingly after "Send (Q)". Neither of which were fruitful. 2. Is there an alternative to the overall method I've chosen that is simpler and more robust? It seems like there must be an alternative path to these settings besides the system tray, but I don't know of any such paths. The final script is going to be used on a number of computers which may have the McAfee icon either hidden or visible in the system tray, but currently my script only works if it is visible. I haven't figured out how to access hidden icons with mouse clicks yet. I should also mention that most of my code for step 1 (find the McAfee icon) comes from something I found online. I've stared at it for a while, and I think I know how it works, but I wouldn't have known those GUI commands existed and wouldn't have been able to write that bit of code on my own. I don't want you to overestimate my understanding of AutoIt. Sorry for the long post, just wanted to provide all the relevant info. Any advice you can offer would be greatly appreciated! Thanks in advance. -Cody #cs AutoIt McAfee disable #ce #Include <GuiToolBar.au3> #Include <GUIConstants.au3> Local $Array[3] For $Element In $Array Global $hSysTray_Handle, $iSystray_ButtonNumber Global $sToolTipTitle = "McAfee status: OK" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle) If $iSystray_ButtonNumber = 0 Then MsgBox(16, "Error", "Icon not found in system tray") Exit Else Sleep(500) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") EndIf Send( "Q" ) ;$DropDownHandle = Controlgethandle( "", "Host IPS - on", "") ;$text = ControlGetText( "", "Host IPS - on", "") ;If "Host IPS - on" = 1 Then ; Send( $Element ) ;EndIf Next Exit ;........ Func Get_Systray_Index($sToolTipTitle) ; Find systray handle $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then MsgBox(16, "Error", "System tray not found") Exit EndIf ; Get systray item count Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSystray_ButCount = 0 Then MsgBox(16, "Error", "No items found in system tray") Exit EndIf ; Look for wanted tooltip For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) = 1 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc
-
Screensaver, Sleep, Lock and Power-Save Disabling
Ascend4nt posted a topic in AutoIt Example Scripts
Screensaver, Sleep, Workstation Lock, and Power-Save Disabling Since I see this question asked again and again, and the simple answer isn't always given (or at least, only half of it is), I'm posting this for reference. To disable Power-saving, Workstation Locking, Screensavers, etc., all that's needed is a call to SetThreadExecutionState. No need for timers, nor for emulating mouse or keyboard input. Just make a call to that API once to disable any locking/sleeping/screensaverin'. When you're done, make another call to it with the proper parameters (this part is important), and everything will be restored. NOTE: The 'execution state' should really only matter while the program that made the call is running (its supposed to be per-application). Once it is terminated, the execution state should be restored. However, there have been some unusual reports regarding this, especially when it is called by more than one process. The main functions in my module are _PowerKeepAlive() and _PowerResetState(). One keeps everything 'awake', the other reenables the default state of Windows power settings (including screensavers and workstation locking). The primary reason I've used this myself is for games that forget to call that API function, and after playing with the joystick for a while, a screensaver or lock-screen will pop up. Using these functions will workaround that problem. Also!: If you want to save and restore the current power-savings 'execution state', just pass the return value from _PowerKeepAlive() as the first argument to 'SetThreadExecutionState'. Anyway, here's the main module I use (example use is below): #include-once ; =============================================================================================================================== ; <_PowerKeepAlive.au3> ; ; Functions to prevent/disable sleep/power-savings modes (AND screensaver) ; ; Functions: ; _PowerKeepAlive() ; _PowerResetState() ; ; See also: ; <_ScreenSaverFunctions.au3> ; query, change, enable & disable screensaver. ; ; Author: Ascend4nt ; =============================================================================================================================== ; ========================================================================================================================== ; Func _PowerKeepAlive() ; ; Function to Prevent the Screensaver and Sleep/Power-savings modes from kicking in. ; NOTE: Be sure to reset this state on exit! ; ; Returns: ; Success: @error=0 & previous state as # (typically 0x80000000 [-2147483648]) ; Failure: @error set (returns 0x80000000, but thats just the normal state) ; @error = 2 = DLLCall error. @extended = DLLCall error code (see AutoIt Help) ; ; Author: Ascend4nt ; ========================================================================================================================== Func _PowerKeepAlive() #cs ; Flags: ; ES_SYSTEM_REQUIRED (0x01) -> Resets system Idle timer ; ES_DISPLAY_REQUIRED (0x02) -> Resets display Idle timer ; ES_CONTINUOUS (0x80000000) -> Forces 'continuous mode' -> the above 2 will not need to continuously be reset #ce Local $aRet=DllCall('kernel32.dll','long','SetThreadExecutionState','long',0x80000003) If @error Then Return SetError(2,@error,0x80000000) Return $aRet[0] ; Previous state (typically 0x80000000 [-2147483648]) EndFunc ; ========================================================================================================================== ; Func _PowerResetState() ; ; Function to Reset the Screensaver and Sleep/Power-savings modes to defaults. ; NOTE: The timer is reset on each call to this! ; ; Returns: ; Success: @error=0 & previous state as # ; Failure: @error set (returns 0x80000000, but thats just the normal state) ; @error = 2 = DLLCall error. @extended = DLLCall error code (see AutoIt Help) ; ; Author: Ascend4nt ; ========================================================================================================================== Func _PowerResetState() ; Flag: ES_CONTINUOUS (0x80000000) -> (default) -> used alone, it resets timers & allows regular sleep/power-savings mode Local $aRet=DllCall('kernel32.dll','long','SetThreadExecutionState','long',0x80000000) If @error Then Return SetError(2,@error,0x80000000) Return $aRet[0] ; Previous state EndFunc Example usage: #NoTrayIcon #include "_PowerKeepAlive.au3" ; Singleton code: If WinExists("SA_0bc53fe0-59c2-11e2-bcfd-0800200c9a66_SA") Then Exit AutoItWinSetTitle("SA_0bc53fe0-59c2-11e2-bcfd-0800200c9a66_SA") Opt("TrayOnEventMode", 0) Opt("TrayMenuMode", 1+2) TraySetClick(8+1) Local $iTrayExit = TrayCreateItem("Exit + Reenable Sleep") ; Disable screensaver, power-save, etc _PowerKeepAlive() ; Be sure to register this to reenable power-saving, screensaver, etc OnAutoItExitRegister("_PowerResetState") ; Now we're ready to accept messages TraySetState() While TrayGetMsg() <> $iTrayExit ; No need for sleep WEnd _PowerKeepAlive.au3- 7 replies
-
- screensaver
- workstation lock
-
(and 3 more)
Tagged with:
-
Hi, I remember a script where i had seen an user inverse state of a button ( $GUI_ENABLE (64) / $GUI_DISABLE (128) ) in one line only I remember it use Bit operation but i cannot reproduce it, can someone help ? In fact if the button is enable i want to disable it and if he is disable , want to enable it, something like that : GuiCtrlSetState ( $button , BitOr ( GuiCtrlGetSate ( $button ) ) ; i know this is NOT working, for explanation only Thanks !
-
Hello! I think the thread title is obvious enough , Here is my code: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 290, 139, 192, 124) $Edit1 = GUICtrlCreateEdit("Test", 8, 8, 273, 121, $ES_READONLY) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Thanks in advance, TD
-
Hi guys I've been looking around to enable/disable network cards using WMI but so far the only way i could get it to work was with this : RunWait(@ComSpec & " /c " & "WMIC PATH Win32_NetworkAdapter WHERE Index=" & $NetAdp_CurrID & " CALL " & $action, "", @SW_HIDE)The $NetAdp_CurrID var would be the index of the network card and the $action var would be enable or disable in my line of code. I know it's possible to do this with wmi without using cmd but i can't figure out how. Anyone who has the answer to my problem? I've tried with using the wmi query and adding .enable() and .disable() at the end but that doesn't work (or at least not for me)
-
Hi, would there a way to disable enable the CUI after the exe was compiled If a certain Action is being used?
-
Hey there, Probably you know about the many questions on this forum, how to disable Ctrl-Alt-Del. I searched the whole forum bot there was not only one answer that worked. But now i found a way on my own hot to prevent that. And btw I have to say that this if f*cking easy, so shame on you You can try it, it works sure on windows 7 and vista. I also included a hotkey function to exit, but it takes up to 10 seconds until you can access the ctrl alt del screen again. Please tell me if you found out a better way and tell me what is your meaning about my script. Thank you -snip- Edit: This is the hard way, and i just wanted to show how it could be done. I am confused, no one before me mentioned this script
-
Hi...I was trying to mute flash player sound so, when I couldnt I find an alternate way to mute sound. here is my code:- RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Play_Background_Sounds", "REG_SZ", "no") #include <IE.au3> Local $oIE = _IECreate("www.mywebsite.us") sleep(10000) _IEQuit($oIE) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Play_Background_Sounds", "REG_SZ", "yes") so, basically, first regedit is disabling IE sound. But it only works with HTML5 player not Flash player. So, I find a regedit key which can disable Flash in IE. (After disabling Flash in IE, videos are playing in HTML5 player which is already muted, and my object is fulfilled.) i.e.:- [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\{D27CDB6E-AE6D-11CF-96B8-444553540000}] "Compatibility Flags"=dword:00000400 I want to put it in 2nd line of my code but I cant figure out how I set this regkey using RegWrite function. Can anyone please help me? --- oK..I did it RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\ActiveX Compatibility\{D27CDB6E-AE6D-11CF-96B8-444553540000}") Regwrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\ActiveX Compatibility\{D27CDB6E-AE6D-11CF-96B8-444553540000}", "Compatibility Flags", "REG_DWORD", "1024")