Leaderboard
Popular Content
Showing content with the highest reputation on 05/11/2018 in all areas
-
AU3 Any (*) from AIML & Alice
Earthshine and 2 others reacted to mikell for a topic
Funny play - with extreme limitations of course A possible way : detect the "who...is" pattern, check both array and question, return the answer Here is a simple example (with no error checking) Local $who_is[4] = ["Abraham Lincoln: Was a USA president", _ "Barack Obama: Was a USA president", _ "Steve Jobs: Was the founder of Apple", _ "Bill Gates: Is the founder of Microsoft"] ;$question = "Hi, do you know who Abraham Lincoln is?" ;$question = "Hi, do you know who this crazy Steve Jobs really is?" ;$question = "Hi, do you know who in the world is this damn Bill Gates over there ?" $question = "Hi, do you know who czardas is ?" If StringRegExp($question, '(?i)\bwho\b.*?\bis\b') Then Msgbox(0,"", _WhoIs($question)) Func _WhoIs($test) For $i = 0 to UBound($who_is)-1 $name = StringRegExpReplace($who_is[$i], '^[^:]+\K.*', "") If StringInStr($test, $name) Then Return $who_is[$i] Next Return "Sorry, I don't know this one ..." EndFunc3 points -
_AutoItErrorTrap.au3 (UDF) - Error detection in AutoIt scripts!
GoogleDude reacted to JScript for a topic
Function Reference _AutoItErrorTrap.au3 UDF to intercept the error window of AutoIt, showing more details about the error, including ability to save and send by email! (Detection and treatment of errors in the AutoIt scripts!) Sintax: ; Adding the directives below, will cause your program be compiled with the indexing of the original lines shown in SciTE: #AutoIt3Wrapper_Run_Before=ShowOriginalLine.exe %in% #AutoIt3Wrapper_Run_After=ShowOriginalLine.exe %in% ;Or you can use the program "ShowOriginalLine.exe" directly and choose the script you want to add support to show the original lines! #include "_AutoItErrorTrap.au3" ; _AutoItErrorTrap ([sTitle [, sText [, fUseCallBack]]]) _AutoItErrorTrap()Supports: ;Error detection in your AutoIt script and local #Includes! ;According to the AutoIt Help, the definition for "local Includes" is: ;------------------------------------------------------------------------------ ;If "..." is used, the filename is taken to be relative to the current script. ;------------------------------------------------------------------------------ ;This means that for you to have your UDF or other external module with support to show the original lines, one should use as follows: #include "[path] filename" ; See the AutoIt help for more details.Downloads: Version: 0.11 _AutoItErrorTrap_(RedirectLink).html Note: The error detection is performed in the same executable, does not requiring opening two .exes for this action! Works with CUI too. Usage example is included! (You need to compile first, but it also work with non compiled scripts using context menu [Run Script...]) Sample: More sample: Fixes: #ShowLine_Off $hForm = GUICreate("My GUI menu", 480, 360) $iFileMenu = GUICtrlCreateMenu("&File") $iFileItem = GUICtrlCreateMenuItem("Open", $iFileMenu) GUICtrlSetState(-1, $GUI_DEFBUTTON) $iHelpMenu = GUICtrlCreateMenu("?") GUICtrlCreateMenuItem("Save", $iFileMenu) GUICtrlSetState(-1, $GUI_DISABLE) #ShowLine_OnWithout them the rows above would be as follows: $__iLineNumber=1 & " - " & '$hForm = GUICreate("My GUI menu", 480, 360)...' $hForm = GUICreate("My GUI menu", 480, 360) $__iLineNumber=3 & " - " & '$iFileMenu = GUICtrlCreateMenu("&File")' $iFileMenu = GUICtrlCreateMenu("&File") $__iLineNumber=4 & " - " & '$iFileItem = GUICtrlCreateMenuItem("Ope...' $iFileItem = GUICtrlCreateMenuItem("Open", $iFileMenu) $__iLineNumber=5 & " - " & 'GUICtrlSetState(-1, $GUI_DEFBUTTON)' GUICtrlSetState(-1, $GUI_DEFBUTTON) $__iLineNumber=6 & " - " & '$iHelpMenu = GUICtrlCreateMenu("?")' $iHelpMenu = GUICtrlCreateMenu("?") $__iLineNumber=7 & " - " & 'GUICtrlCreateMenuItem("Save", $iFileMenu)' GUICtrlCreateMenuItem("Save", $iFileMenu) $__iLineNumber=8 & " - " & 'GUICtrlSetState(-1, $GUI_DISABLE)' GUICtrlSetState(-1, $GUI_DISABLE) And the directive #ShowOriginalLine_Param with the following options: /SV or /SkipAllVars ; Skip all Variables to show original line numbers. /SG or /SkipGlobalVars ; Skip Global Variables to show original line numbers. /SL or /SkipLocalVars ; Skip Local Variables to show original line numbers.29/10/2012 -> *Adding the directives below, will cause your program be compiled with the indexing of the original lines shown in SciTE: #AutoIt3Wrapper_Run_Before=ShowOriginalLine.exe %in% #AutoIt3Wrapper_Run_After=ShowOriginalLine.exe %in%*Or you can use the program ShowOriginalLine.exe directly and choose the script you want to add support to show the original lines!*It was added #region Translations with the variables available for translation! 0.10.2312.2600b 25/10/2012 -> Added support for viewing the last screen before the error! Now the window can expand and retract again...Change the hook CALLWNDRETPROC to CALLWNDPROC (better...). Added a help button [?] In the main window and minor changes in the code. 0.10.2312.2600b 23/10/2012 -> *Added support to display the original line numbers in the scripts compiled! Thanks to @FireFox for this tip! $hAET_GETERROR = StringRegExpReplace($hAET_GETERROR, "d+[0-9]", Eval("__iLineNumber") & @CRLF)*Additional information suggested by @ricky03, thank you!*Some bugs were fixed and the file ShowOriginalLineNumbers.au3 was added in zip file. 0.10.2112.2600b 21/10/2012 -> Bugs were fixed and a few functions have been rewritten!0.10.1912.2600b 19/10/2012 -> The UDF was almost completely rewritten, now no longer need to include _AdlibEnhance.au3.The detection of error is instant and does not consume more CPU. Interface compatibility with Windows XP 0.10.1812.2600b 18/10/2012 -> Improvements such as icons on the buttons and added a button to save the error information!0.10.1712.2600b 17/10/2012 -> First release!Regards, João Carlos.1 point -
Version 1.15.4
863 downloads
cDebug.au3 includes four main debugging UDFs: _GuiDebug(), _ConsDebug(), _ClipDebug() and _FormatValsForDebug(). They all dump the values of all AutoIt subtypes and expressions, in a structured manner, including nested arrays (up to 3 dimensions) and slices of them, and even DLL structs and maps. It is an alternative to a graphical debugger, offering GUI output. The format for calling the UDFs has been designed to make coding a call as convenient and fast as possible, minimizing coding effort and the chances of errors: the $name argument is often the same as the variables arguments, enclosed in quote marks. For DLL structures, if you specify a tag, cDebug checks for differences between it and what it detects. If you only specify a structure variable, it can report the structure it detects, with the values of elements. It does much more than MsgBox(), ConsoleWrite() and _ArrayDisplay(), in a definitely user-friendly manner, and does its best to avoid hiding your code in SciTE. #include cDebug no maps.au3 or cDebug.au3 at the top of your script. If you #include cDebug.au3 (the version with maps) #include #AutoIt3Wrapper_Version=B before #include cDebug.au3 It is fully documented in . During debugging and development of new features, the current version is used to debug the upcoming version, so there is much testing, even so bugs are always possible, particularly in new features, such as reporting elements of maps whose keys match a regular expression. Bug reports and suggestions are welcome. These UDFs have been in regular use for some years. Because when cDebug was developed, maps were a use at your own risk feature, there are two streams of cDebug: cDebug.au3 reports maps, so to use it you must be running a version of AutoIt that supports maps, e.g. 3.3.15.0, and #include cDebug.au3 cDebug no maps.au3 does not report maps, so you can be running any recent version of AutoIt, e.g. 3.3.14.5, and #include cDebug no maps.au3 The only difference between the two streams is that map-reporting code is commented out in cDebug no maps.au3 . These functions are documented in cDebug.pdf A teaser This script: #AutoIt3Wrapper_Version=B ; beta 3.3.15.0 or greater is mandatory for cDebug.au3 #include "cDebug.au3" Local $seasons[] $seasons.summer = 'May to September' $seasons.spring = 'April' $seasons.fall = 'October to November' $seasons.winter = 'December to March' Local $aCats[3][3] = [['jack','black',3],['suki','grey',4],[$seasons,'','']] Local $i = 1 Local $tStruct = DllStructCreate('uint') DllStructSetData($tStruct,1,2018) _GuiDebug('At line '&@ScriptLineNumber,'$cats,jack is,$cats[..][$i],$i,hex,structure{uint}', _ $aCats,$aCats[0][2],$aCats,$i,Hex(-$i),$tstruct) produces: Acknowledgements Melba23, Kafu, ProgAndy, jchd1 point -
Dbug - another debugger for AutoIt
BlackLumiere reacted to valdemar1977 for a file
Version 2018.05.24
2,925 downloads
Dbug is graphical debugger for AutoIt. Project started by @Heron in 2009 and now supported by @asdf8 and @valdemar1977. Features Debug the complete script or just parts of it Display run status (line number of currently executed function) GUI default always-on-top in the upper right corner for comfortable debugging WM_NOTIFY and WM_COMMAND hook to prevent interference with possible message handlers Display scope, type and value of variables, expressions, macro's and constants (global AND function local) Execute commands in an immediate window. Can be expressions, functions and assignments Detailed display of array, struct and object variables Dynamic display of variable value in the source code (under cursor) Array table viewer with ability to view the sub-arrays, the correct handling of macro @Error, @Extended and other changes OEM and ANSI console output Conditional breakpoints Saving settings and debugging state and much more... How to use Extract from downloaded archive _Dbug.au3 to your Autoit include dir Add #include <_Dbug.au3> in to your code and run code Before compile or buid comment or remove #include <_Dbug.au3> from your code1 point -
IGroupPolicyObject interface ;;IGroupPolicyObject #RequireAdmin #include-once #include <WinAPIConstants.au3> ; $S_OK #include <WinAPIReg.au3> ;_WinAPI_GetRegKeyNameByHandle Global Enum $GPO_SECTION_ROOT = 0x0, $GPO_SECTION_USER, $GPO_SECTION_MACHINE Global Enum $GPO_OPEN_LOAD_REGISTRY = 0x1, $GPO_OPEN_READ_ONLY Global Enum $GPO_OPTION_DISABLE_USER = 0x1, $GPO_OPTION_DISABLE_MACHINE Global Enum $GPOTypeLocal = 0x0, $GPOTypeRemote, $GPOTypeDS, $GPOTypeLocalUser, $GPOTypeLocalGroup Global Const $sCLSID_GroupPolicyObject = "{EA502722-A23D-11D1-A7D3-0000F87571E3}" Global Const $sIID_IGroupPolicyObject = "{EA502723-A23D-11D1-A7D3-0000F87571E3}" Global Const $dtag_IGroupPolicyObject = _ "New hresult(wstr;wstr;dword);" & _ ; Creates a new GPO in the Active Directory with the specified display name. "OpenDSGPO hresult(wstr;dword);" & _ ; Opens the specified GPO and optionally loads the registry information. "OpenLocalMachineGPO hresult(dword);" & _ ; Opens the default GPO for the computer and optionally loads the registry information. "OpenRemoteMachineGPO hresult(wstr;dword);" & _ ; Opens the default GPO for the specified remote computer and optionally loads the registry information. "Save hResult(bool;bool;ptr;ptr);" & _ ; Saves the specified registry policy settings to disk and updates the revision number of the GPO. "Delete hresult();" & _ ; Deletes the GPO. "GetName hResult(wstr;int);" & _ ; Retrieves the unique name for the GPO. "GetDisplayName hResult(wstr;int);" & _ ; Retrieves the display name for the GPO. "SetDisplayName hresult(wstr);" & _ ; Sets the display name for the GPO. "GetPath hResult(wstr;int);" & _ ; Retrieves the path to the GPO. "GetDSPath hresult(dword;wstr;int);" & _ ; Retrieves the Active Directory path to the root of the specified GPO section. "GetFileSysPath hresult(dword;wstr;int);" & _ ; Retrieves the file system path (UNC format) to the root of the specified GPO section. "GetRegistryKey hresult(dword;handle);" & _ ; Retrieves a handle to the root of the registry key for the specified GPO section. "GetOptions hResult(dword*);" & _ ; Retrieves the options for the GPO. "SetOptions hresult(dword;dword);" & _ ; Sets the options for the GPO. "GetType hResult(dword*);" & _ ; Retrieves type information for the GPO being edited. "GetMachineName hResult(wstr;int);" & _ ; Retrieves the computer name of the remote GPO. "GetPropertySheetPages hresult(ptr;uint*);" ; Retrieves the property sheet pages associated with the GPO. Test() Func Test() Local $iResult Local $oIGroupPolicy Local $aGpoType[5] = ["Local", "Remote", "Active Directory", "LocalUser", "LocalGroup"] $oIGroupPolicy = ObjCreateInterface($sCLSID_GroupPolicyObject, $sIID_IGroupPolicyObject, $dtag_IGroupPolicyObject) While True If Not IsObj($oIGroupPolicy) Then ConsoleWrite("Failed To Retrieve Interface") $iResult = $E_NOINTERFACE ExitLoop Else ConsoleWrite("Success: " & ObjName($oIGroupPolicy, 1) & @CRLF) EndIf Local $sLoc, $sPath, $sName, $iType $tKey = DllStructCreate("handle hKey") $iResult = $oIGroupPolicy.OpenLocalMachineGPO(BitOR($GPO_OPEN_LOAD_REGISTRY, $GPO_OPEN_READ_ONLY)) If $iResult <> $S_OK Then ExitLoop $iResult = $oIGroupPolicy.GetDisplayName($sLoc, 65535) If $iResult <> $S_OK Then ExitLoop $iResult = $oIGroupPolicy.GetName($sName, 65535) If $iResult <> $S_OK Then ExitLoop ConsoleWrite($sLoc & " : " & $sName & @CRLF) $iResult = $oIGroupPolicy.GetPath($sPath, 65535) If $iResult <> $S_OK Then ExitLoop $iResult = $oIGroupPolicy.GetType($iType) If $iResult <> $S_OK Then ExitLoop ConsoleWrite($sPath & @CRLF) $iResult = $oIGroupPolicy.GetType($iType) If $iResult <> $S_OK Then ExitLoop ConsoleWrite("Type: " & $aGpoType[$iType] & @CRLF) $iResult = $oIGroupPolicy.GetRegistryKey($GPO_SECTION_USER, DllStructGetPtr($tKey)) If $iResult <> $S_OK Then ExitLoop ConsoleWrite(_WinAPI_GetRegKeyNameByHandle(DllStructGetData($tKey, "hKey")) & @CRLF) ExitLoop WEnd Return SetError($iResult, 0, ($iResult = $S_OK)) EndFunc ;==>Test Note: Not well tested..1 point
-
No worries, you didn't do anything wrong and hope things are fixed now for you, else just ask!1 point
-
Using AutoIT with our registering the DLL
Earthshine reacted to IgImAx for a topic
Hi SilentSnake I know this it old topic, but I was searching for same question in last week and I found my answer in some stackoverflow posts and one old topic on here. So for others that seeking for the same question, I hope this will help you: You do not need to register AutoItX3.DLL or AutoitX3_64.DLL files in the target computers. In this old topic show how to use methods inside those two dll's directly: C# use of the dll, some idears for you. and I use same way in my simple app in C# and test it on other computers without registering any dll. using System; using System.Runtime.InteropServices; using AutoIt; namespace SendKeyCommand { internal static class Program { [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] private static extern int AU3_WinMenuSelectItemByHandle(IntPtr intPtr , string item1 , string item2 = "" , string item3 = "" , string item4 = "" , string item5 = "" , string item6 = "" , string item7 = "" , string item8 = ""); [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)] private static extern int AU3_WinMenuSelectItem(string title , string text , string item1 , string item2 = "" , string item3 = "" , string item4 = "" , string item5 = "" , string item6 = "" , string item7 = "" , string item8 = ""); private static void Main() { var intPtr = AutoItX.WinGetHandle("μTorrent"); if (intPtr != IntPtr.Zero) { AU3_WinMenuSelectItemByHandle(intPtr, "&File", "E&xit"); // Or: // AU3_WinMenuSelectItem("μTorrent", "", "&File", "E&xit"); } } } } All methods in these two libraries "AutoItX3.DLL or AutoitX3_64.DLL" listed inside of AutoItX3_DLL.h file under Autoit\AutoitX3 folder. Note this: There are some methods with postfix "...ByHandle" they are overloaded methods that we do not use them with that name in Autoit but you have to specify them in C# just like I did in above sample on "AU3_WinMenuSelectItemByHandle" method. Still, you can add a reference to this "AutoItX3.Assembly.dll" file without any problem. This file does not need any registration on target computers. [I think] You can do the same thing for any *.dll by using DllImportAttribute [DllImport("DllFilename")]. For more info :MSDN DllImportAttribute. For more info please check my solved problem: "[SOLVED] WinMenuSelectItem method cannot find in C#" Happy Coding! IgImAx1 point -
click on Document List in SAP Businessobject Infoview
Danp2 reacted to Earthshine for a topic
I would copy the whole site using this, copy local and look at all that code... https://www.httrack.com/1 point -
AU3 Any (*) from AIML & Alice
DynamicRookie reacted to czardas for a topic
You need to play around with this method. If StringRegExp("Hi, do you know who Abraham Lincoln is?", $sPattern) Then ; detected pattern ; Get name, search records, return response EndIf1 point -
Mbee, The fact you are having problems getting a reproducer script to demonstrate the effect makes me pretty sure that you are removing these events from the message queue in a section of your code somewhere in the original larger script. AutoIt does not eat events - or else we would have many such complaints, which we do not. Unless you can provide some code which does show the same effect - or let us see the whole script (and pray we can spot something) - I am afraid that we cannot really help you any further. M231 point
-
AutoIt ConsoleWrite (using "builtin" Autoit Hidden window)
bowain reacted to boomingranny for a topic
Use this UDF to add a console gui to your script (with log file): It uses the Hidden Autoit window (that you probably didn't even know existed) Closing Console window will terminate script. example of console: #include-once #include <GuiEdit.au3> EnableConsoleGui("example.log") ;example: ;------------------------ ConsoleWrite ("Hello World") For $i = 1 To 10 ConsoleWrite (".") Sleep(200) Next ConsoleWrite ("done") ConsoleWrite(@CRLF) ConsoleWrite ("close me to exit"&@CRLF) While 1 Sleep(1000) WEnd ;------------------------ ;end of example code Func EnableConsoleGui($Logfile="") ;EnableConsoleGUI ;by Daniel Barnes 20/04/2018 ;Uses AutoIt's Hidden window as a console (output only) Global $pidChild ;if we don't have a parent (as the parent window would have our script name) If Not WinExists(StringTrimRight(@ScriptName,4)) Then Opt("TrayIconHide",1) ;get Autoit's hidden window handle local $hWnd = WinGetHandle(AutoItWinGetTitle()) ;move the autoit hidden window to the middle of the screen WinMove($hWnd, "", (@DesktopWidth / 2) - 250, (@DesktopHeight / 2) - 250, 500, 500) ;get the Handle of the edit box in Autoit's hidden window $hEditBox = ControlGetHandle($hWnd,"","[CLASS:Edit; INSTANCE:1]") ;show it WinSetState($hWnd, "", @SW_SHOW) ;set its title = our script name WinSetTitle($hWnd,"",StringTrimRight(@ScriptName,4)) ;Spawn a child "copy" of the script, enabling reading of its console... If @Compiled Then ;2 = $STDOUT_CHILD. This avoids requiring the AutoItConstants.au3 in this sample code $pidChild= Run( FileGetShortName(@ScriptFullPath),@ScriptDir,"",2) Else ;2 = $STDOUT_CHILD. This avoids requiring the AutoItConstants.au3 in this sample code $pidChild= Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath),@ScriptDir,"",2) EndIf OnAutoItExitRegister("EnableConsoleGui_CloseChildPID") ;read the console, while the child window exists (and the console window is visible) While ProcessExists($pidChild) $ConsoleRead = StdoutRead($pidChild) If $ConsoleRead then $text = StringLeft(ControlGetText($hWnd,"",$hEditBox),65535) If $Logfile Then FileWrite($Logfile,$ConsoleRead) $text &= $ConsoleRead ControlSetText($hWnd,"",$hEditBox,$text) ConsoleWrite($ConsoleRead) ;scroll to bottom of console edit window _GUICtrlEdit_SetSel($hEditBox, 65535, 65535) endif Sleep(250) WEnd exit endif EndFunc Func EnableConsoleGui_CloseChildPID() ;if this func isn't used ;when you close the console gui ;the child "clone" of your script will keep running ProcessClose($pidChild) EndFunc1 point -
How to exit this script
Earthshine reacted to benched42 for a topic
Zelda ..... Really? The code ExtMsgBox.au3 is available on the AutoIt Wiki. It's an excellent UDF posted by Melba23 . Helmar, are you using the latest version? I recently had to update the version I have been using for years. The latest version is 22 Mar 2018.0 points