Leaderboard
Popular Content
Showing content with the highest reputation on 10/14/2018 in all areas
-
; NetFirewallPolicy2 COM UDF Library for AutoIt3 ; AutoIt Version : 3.3.14.5 ; Description ...: Windows Firewall Policy2 Interface, Provides access to the firewall policy for Windows Vista+ Including Test Script _NetFw_Get_CurrentProfileTypes Retrieves the currently active firewall profile(s) _NetFw_Get_FirewallEnabled Indicates whether a firewall is enabled locally _NetFw_Put_FirewallEnabled Specifies whether a firewall is enabled locally _NetFw_Get_ExcludedInterfaces Indicates a list of interfaces on which firewall settings are excluded _NetFw_Put_ExcludedInterfaces Specifies a list of interfaces on which firewall settings are excluded _NetFw_Get_BlockAllInboundTraffic Indicates whether the firewall should not allow inbound traffic _NetFw_Put_BlockAllInboundTraffic Specifies whether the firewall should not allow inbound traffic _NetFw_Get_NotificationsDisabled Indicates whether interactive firewall notifications are disabled _NetFw_Put_NotificationsDisabled Specifies whether interactive firewall notifications are disabled _NetFw_Get_UnicastResponsesToMulticastBroadcastDisabled Indicates whether the firewall should not allow unicast responses to multicast and broadcast traffic _NetFw_Put_UnicastResponsesToMulticastBroadcastDisabled Specifies whether the firewall should not allow unicast responses to multicast and broadcast traffic _NetFw_Get_Rules Retrieves the interface to collection of firewall rules _NetFw_Get_ServiceRestriction Retrieves the interface used to access the Windows Service Hardening store _NetFw_EnableRuleGroup Enables or disables a specified group of firewall rules _NetFw_IsRuleGroupEnabled Determines whether a specified group of firewall rules are enabled or disabled for the current profile _NetFw_RestoreLocalFirewallDefaults Restores the local firewall configuration to its default state _NetFw_Get_DefaultInboundAction Indicates the default action for inbound traffic _NetFw_Put_DefaultInboundAction Specifies the default action for inbound traffic _NetFw_Get_DefaultOutboundAction Indicates the default action for outbound traffic _NetFw_Put_DefaultOutboundAction Specifies the default action for outbound traffic _NetFw_Get_IsRuleGroupCurrentlyEnabled Determines whether a specified group of firewall rules are enabled or disabled for the current profile _NetFw_Get_LocalPolicyModifyState Determines if adding or setting a rule or group of rules will take effect in the current firewall profile UDF: Test Script:1 point
-
System restore UDF
obiwanceleri reacted to FredAI for a topic
Hi. I needed this for one of my apps, and all I could find here was a WMI object function to create a restore point, so I decided to create this UDF and post it here. It has functions to enumerate, delete (one or all) and create restore points. Also enable or disable the system restore, and restore the system to one of the restore points. There are only two functions available through DllCall on msdn, the others are WMI. The UDF is not commented yet, I'll do it tomorrow and update. It's getting late, now. Better call it a night. Sorry for the delay. Here's the commented updated version: (28 downloads before) Note: Some functions were slightly modified. Updated 15/11/2011 (66 total downloads). The $DriveL optional parameter in the _SR_Enable and _SR_Disable functions must be in the format $SystemDrive & '\', or the functions won't work. SystemRestore.au31 point -
Actually, you can. Just add 64 to the result from Random(1,26).1 point
-
1 point
-
There are dozens of examples in the zip of uiautomation. What example are you missing. Use id or title will work best Use index, indexrelative More complex examples with 117 properties you can combine in regular expressions. Simplespy will give you a starting point for descriptions Read and study the examples. There are many descriptions there automating the forum with all major browsers1 point
-
I think this is where i have most trouble, i seem to never find a proper identification string, and i dont know what it looks like, can you paste an example? In the past, it would seem that as many elements for identification of a control i had, the system would always fall back to searching all over.1 point
-
Here is my solution: GUICtrlSetResizing($cBtnNewFolder,$GUI_DOCKHEIGHT+$GUI_DOCKTOP) ; row of fixed-height controls GUICtrlSetResizing($cBtnDelFolder,$GUI_DOCKHEIGHT+$GUI_DOCKTOP) GUICtrlSetResizing($cBtnRenameFolder,$GUI_DOCKHEIGHT+$GUI_DOCKTOP) ; variable-height control whose top is always the same distance from the title bar GUICtrlSetResizing($cTreeView, $GUI_DOCKTOP+$GUI_DOCKBOTTOM) ; row of fixed-height controls below the treeview; distance from bottom of treeview to bottom of window is constant GUICtrlSetResizing($cBtnCancel,$GUI_DOCKHEIGHT+$GUI_DOCKBOTTOM) GUICtrlSetResizing($cBtnSelect,$GUI_DOCKHEIGHT+$GUI_DOCKBOTTOM) GUICtrlSetResizing($cLblInfo, $GUI_DOCKHEIGHT+$GUI_DOCKBOTTOM) I show only the vertical (y) constants. The horizontal (x) constants are unchanged. I am yet to master GuiCtrlSetResizing() !1 point
-
Win 10 Notification click required
JLogan3o13 reacted to Jos for a topic
@careca, what about you leave it to the op to answer in stead of entering a guessing game? (This is rethorical so doesn't require an answer and is an advice!) Jos1 point -
UIAutomation in itself out of the box from Microsoft is in general fast. If you give the proper identification string it will work fast with the wrappers If you do not give a proper identification a "smart" uia wrapper algorithm tries to find your element anyway. So its a choice between slow finding your object of interest or failing directly If you have bad luck it will fully search your full desktop and all (sub)windows which will offcourse be terrible when html elements are around When you see deep find in your log its probably smart to have additional setfocus actions and/or look at your expression for identifying Ideas for smarter fallback algorithm are allways welcome rti.mainwindow and rti.parent are important parts for the algoritm in fallback searching In general the hierarchy of your object you can see with simplespy Desktop Window 1 Window 2 Group element your element A Group element Group element Group element B If you directly try: _UIA_Action("Title:=B","click") If will start searching from desktop and indirectly hit all open windows and its childs so in above when window 1 is a browser its traversing all html elements before it goes to window 2. Below would probably already speedup as you first put focus to mainwindow with a UIA function (mixing with AutoIt standard funtions is in general not a good way to start) #include "UIAWrappers.au3" ShellExecute ("Appwiz.cpl") $Window = WinWaitActive ("Programmes et fonctionnalités") If WinExists ($Window) Then _UIA_setVar("my program.mainwindow","Title:="Programmes et fonctionnalités") _UIA_setVar("oUIElement","Title:=Zone de recherche;controltype:=UIA_EditControlTypeId;class:=SearchEditBox") ;ControlType:=UIA_EditControlTypeId;classname:=SearchEditBox") _UIA_action("my program.mainwindow","highlight") _UIA_action("my program.mainwindow","setfocus") _UIA_action("oUIElement","highlight") _UIA_action("oUIElement","settextvalue" , "test settextvalue") _UIA_action("oUIElement","setvalue" , "test setvalue")1 point
-
I wrote this very simple functions to parse command line arguments. It can get: Simple key/value Example. The following code: #include "cmdline.au3" MsgBox(0, _CmdLine_Get('color')) Will return "white" if you run the script in one of these ways (quotes are optional but mandatory if you're going to use spaces): script.exe -color "white" script.exe --color white script.exe /color white Existence Example. The following code: #include "cmdline.au3" If _CmdLine_KeyExists('givemecoffee') Then ConsoleWrite('You want coffee.') Else ConsoleWrite('You do not want coffee.') EndIf Will return "You want coffee." if you run one of these: script.exe -givemecoffee script.exe --givemecoffee script.exe /givemecoffee And the following code: #include "cmdline.au3" If _CmdLine_ValueExists('givemecoffee') Then ConsoleWrite('You want coffee.') Else ConsoleWrite('You do not want coffee.') EndIf Will return "You want coffee." if you run one of these: script.exe givemecoffee script.exe "givemecoffee" Flags Example. This script: #include "cmdline.au3" ConsoleWrite("You want: ") If _CmdLine_FlagEnabled('C') Then ConsoleWrite("coffee ") EndIf If _CmdLine_FlagEnabled('B') Then ConsoleWrite("beer ") EndIf ConsoleWrite(" and you do not want: ") If _CmdLine_FlagDisabled('V') Then ConsoleWrite("vodka ") EndIf If _CmdLine_FlagDisabled('W') Then ConsoleWrite("wine ") EndIf ConsoleWrite(" but you did not tell me if you want: ") If Not _CmdLine_FlagExists('S') Then ConsoleWrite("soda ") EndIf If Not _CmdLine_FlagExists('J') Then ConsoleWrite("juice ") EndIf Will return "You want: coffee beer and you do not want: vodka wine but you did not tell me if you want: soda juice" if you run: script.exe +CB -VW Getting argument by its index You can also read the $CmdLine (1-based index) through this function. The advantage is that if the index does not exist (the user did not specify the argument), it won't break your script. It will just return the value you specify in the second function parameter. #include "cmdline.au3" $first_argument = _CmdLine_GetValByIndex(1, False) If Not $first_argument Then ConsoleWrite("You did not specify any argument.") Else ConsoleWrite("First argument is: " & $first_argument) EndIf Just a note: The second value of _CmdLine_GetValByIndex function can be an integer value, a string, a boolean value, an array or anything you want it to return if the index does not exist in $CmdLine array. This parameter is also available in _CmdLine_Get() function, also as a second function parameter. In this case, it will return this value if the key was not found. Example: #include "cmdline.au3" $user_wants = _CmdLine_Get("iwant", "nothing") ConsoleWrite("You want " & $user_wants) So, if you run: script.exe /iwant water It will return "You want water". But if you run just: script.exe It will return "You want nothing". Please note that, as these two are the only functions in this library meant to return strings, the second parameter is not available for the other functions. By default, if you do not specify any fallback value, it returns null if the wanted value could not be found. Also, please note that this UDF can NOT parse arguments in the format (key=value). Example: script.exe key=value IT WILL NOT WORK Here is the code: #include-once #comments-start CmdLine small UDF coder: Jefrey (jefrey[at]jefrey.ml) #comments-end Func _CmdLine_Get($sKey, $mDefault = Null) For $i = 1 To $CmdLine[0] If $CmdLine[$i] = "/" & $sKey OR $CmdLine[$i] = "-" & $sKey OR $CmdLine[$i] = "--" & $sKey Then If $CmdLine[0] >= $i+1 Then Return $CmdLine[$i+1] EndIf EndIf Next Return $mDefault EndFunc Func _CmdLine_KeyExists($sKey) For $i = 1 To $CmdLine[0] If $CmdLine[$i] = "/" & $sKey OR $CmdLine[$i] = "-" & $sKey OR $CmdLine[$i] = "--" & $sKey Then Return True EndIf Next Return False EndFunc Func _CmdLine_ValueExists($sValue) For $i = 1 To $CmdLine[0] If $CmdLine[$i] = $sValue Then Return True EndIf Next Return False EndFunc Func _CmdLine_FlagEnabled($sKey) For $i = 1 To $CmdLine[0] If StringRegExp($CmdLine[$i], "\+([a-zA-Z]*)" & $sKey & "([a-zA-Z]*)") Then Return True EndIf Next Return False EndFunc Func _CmdLine_FlagDisabled($sKey) For $i = 1 To $CmdLine[0] If StringRegExp($CmdLine[$i], "\-([a-zA-Z]*)" & $sKey & "([a-zA-Z]*)") Then Return True EndIf Next Return False EndFunc Func _CmdLine_FlagExists($sKey) For $i = 1 To $CmdLine[0] If StringRegExp($CmdLine[$i], "(\+|\-)([a-zA-Z]*)" & $sKey & "([a-zA-Z]*)") Then Return True EndIf Next Return False EndFunc Func _CmdLine_GetValByIndex($iIndex, $mDefault = Null) If $CmdLine[0] >= $iIndex Then Return $CmdLine[$iIndex] Else Return $mDefault EndIf EndFunc1 point
-
mLipok, It is not difficult to do - this gets the text from all of the systray icons : #include <Array.au3> #Include <GuiToolBar.au3> Get_SysTray_IconText() Func Get_SysTray_IconText() ; Find systray handle Local $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 Local $aSysTray_ButtonText[$iSysTray_ButCount] ; Look for wanted tooltip For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1 $aSysTray_ButtonText[$iSysTray_ButtonNumber] = _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSysTray_ButtonNumber) Next _ArrayDisplay($aSysTray_ButtonText, "SysTray Icon Text", Default, 8) EndFunc All you need to do is search the text from each button for some permanent text associated with the button you want to interrogate ("Skype" in your case) and just return the text from that button. M231 point
-
Upsa, adjustments made on my heavily customized version ... Add this to the top of the Systray.au3 Global $__hWnd_Shell_TrayWnd = DllCall("user32.dll", "hwnd", "FindWindow", "str", "Shell_TrayWnd", "ptr", 0) $__hWnd_Shell_TrayWnd = $__hWnd_Shell_TrayWnd[0] and this DllCall("user32.dll", "int", "SendMessageW", "hwnd", $__hWnd_Shell_TrayWnd, "uint", 0x001A, "wparam", 0, "lparam", 0) ; $WM_SETTINGCHANGE = 0x001A directly after this call in Func _SysTrayIconRemove( DLLCall("user32.dll","int","SendMessage", "hwnd", $hWnd, "int", $TB_DELETEBUTTON, "int", $index, "int", 0)1 point