Leaderboard
Popular Content
Showing content with the highest reputation on 08/24/2013 in all areas
-
File Name: AutoIt v3.3.9.19 Beta File Submitter: Jon File Submitted: 24 Aug 2013 File Category: Beta 3.3.9.19 (24th August, 2013) (Beta) AutoIt: - Changed: Default newline character for PCRE regexes changed from LF to CRLF. - Changed: PCRE_UCP option is no longer used by default in regexes. UDFs: - Changed: _EventLog__ @error values in the respective documentation. AutoItX: - Added: AutoItX3_PS.dll - A PowerShell Cmdlet wrapper for AutoItX. - Added: Visual Studio 2010 C++ Project files (easy to use in 2010 or later). - Changed: Renamed AutoIt3.h to AutoItX3_DLL.h. - Removed: Removed DevC files and Visual Studio 6 files. - Removed: ANSI versions of Send/WinWait functions from the native DLL. - Fixed: AutoItX3.lib files weren't correctly being copied to the install file. Others: - Added: Direct links to functions, keywords and macros in the help file. - Changed: Merged both the AutoIt and UDF help files into a single chm file. I'll create some topics in the AutoItX forum for the DLL stuff. It's only got a few functions enabled as a preview. Click here to download this file2 points
-
_ProcessListProperties()
mistersquirrle reacted to PsaltyDS for a topic
The _ProcessListProperties() function has been floating around General Help and Support long enough. This is it's new home. This function lists several properties of all processes (default), selected processes by name, or a single process by PID. ===> Important bug note: The SwbemRefresher object has a Microsoft bug that causes a memory leak when called repeatedly. Until a fix is found from Microsoft, don't use _ProcessListProperties() in a tight loop. <=== Change Log: 05/05/2008 -- v1.0.0 -- First version placed in Example Scripts 05/07/2008 -- v1.0.1 -- Added the calling command line at [n][9] 06/10/2008 -- v2.0.0 -- Removed use of ProcessList() so remote access could work 06/12/2008 -- v2.0.1 -- Added geeky RegExp for WMI date conversion by weaponx 07/02/2008 -- v2.0.2 -- Fixed find by PID or Name, which was broken by removing ProcessList() usage 09/17/2008 -- v2.0.3 -- Added Debug (SeDebugPrivilege) to WMI call to retrieve fuller results 12/15/2008 -- v2.0.3 -- No change to function, cleaned up demo and added COM error handler to it12/01/2009 -- v2.0.4 -- Fixed check for null $Process so '0' could be used (System Idle Process) Information is returned in a 2D array similar to the native ProcessList(), in fact the UDF uses ProcessList() internally. This is the structure of the array: [0][0] - Number of processes listed (can be 0 if no matches found) [1][0] - 1st process name [1][1] - 1st process PID [1][2] - 1st process Parent PID [1][3] - 1st process owner [1][4] - 1st process priority (0 = low, 31 = high) [1][5] - 1st process executable path [1][6] - 1st process CPU usage [1][7] - 1st process memory usage [1][8] - 1st process creation date/time = "MM/DD/YYY hh:mm:ss" [1][9] - 1st process command line string ... [n][0] thru [n][9] - last process properties Here is the function, with a running demo script: #include <Array.au3>; Only for _ArrayDisplay() ; Install a custom error handler Global $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"), $f_COMError = False ; Globals Global $avRET, $iPID ; Demonstrate listing all processes $avRET = _ProcessListProperties() _ArrayDisplay($avRET, "All Processes") ; Demonstrate listing by name $avRET = _ProcessListProperties("svchost.exe") _ArrayDisplay($avRET, "By name: 'svchost.exe'") ; Demonstrate listing by PID (integer) $iPID = ProcessExists("svchost.exe") $avRET = _ProcessListProperties($iPID) _ArrayDisplay($avRET, "By int PID: " & $iPID) ; Demonstrate listing by PID (numeric string) $iPID = String($iPID) $avRET = _ProcessListProperties($iPID) _ArrayDisplay($avRET, "By string PID: " & $iPID) ; Demonstrate not found $avRET = _ProcessListProperties("NoSuchProcess.exe") _ArrayDisplay($avRET, "Not found: 'NoSuchProcess.exe'") ; This is my custom error handler Func MyErrFunc() Local $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "WinDescription is: " & $oMyError.windescription & @CRLF & _ "Source is: " & $oMyError.source & @CRLF & _ "ScriptLine is: " & $oMyError.scriptline) $f_COMError = True; something to check for when this function returns Endfunc ;=============================================================================== ; Function Name: _ProcessListProperties() ; Description: Get various properties of a process, or all processes ; Call With: _ProcessListProperties( [$Process [, $sComputer]] ) ; Parameter(s): (optional) $Process - PID or name of a process, default is "" (all) ; (optional) $sComputer - remote computer to get list from, default is local ; Requirement(s): AutoIt v3.2.4.9+ ; Return Value(s): On Success - Returns a 2D array of processes, as in ProcessList() ; with additional columns added: ; [0][0] - Number of processes listed (can be 0 if no matches found) ; [1][0] - 1st process name ; [1][1] - 1st process PID ; [1][2] - 1st process Parent PID ; [1][3] - 1st process owner ; [1][4] - 1st process priority (0 = low, 31 = high) ; [1][5] - 1st process executable path ; [1][6] - 1st process CPU usage ; [1][7] - 1st process memory usage ; [1][8] - 1st process creation date/time = "MM/DD/YYY hh:mm:ss" (hh = 00 to 23) ; [1][9] - 1st process command line string ; ... ; [n][0] thru [n][9] - last process properties ; On Failure: Returns array with [0][0] = 0 and sets @Error to non-zero (see code below) ; Author(s): PsaltyDS at http://www.autoitscript.com/forum ; Date/Version: 12/01/2009 -- v2.0.4 ; Notes: If an integer PID or string process name is provided and no match is found, ; then [0][0] = 0 and @error = 0 (not treated as an error, same as ProcessList) ; This function requires admin permissions to the target computer. ; All properties come from the Win32_Process class in WMI. ; To get time-base properties (CPU and Memory usage), a 100ms SWbemRefresher is used. ;=============================================================================== Func _ProcessListProperties($Process = "", $sComputer = ".") Local $sUserName, $sMsg, $sUserDomain, $avProcs, $dtmDate Local $avProcs[1][2] = [[0, ""]], $n = 1 ; Convert PID if passed as string If StringIsInt($Process) Then $Process = Int($Process) ; Connect to WMI and get process objects $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy, (Debug)}!\\" & $sComputer & "\root\cimv2") If IsObj($oWMI) Then ; Get collection processes from Win32_Process If $Process == "" Then ; Get all $colProcs = $oWMI.ExecQuery("select * from win32_process") ElseIf IsInt($Process) Then ; Get by PID $colProcs = $oWMI.ExecQuery("select * from win32_process where ProcessId = " & $Process) Else ; Get by Name $colProcs = $oWMI.ExecQuery("select * from win32_process where Name = '" & $Process & "'") EndIf If IsObj($colProcs) Then ; Return for no matches If $colProcs.count = 0 Then Return $avProcs ; Size the array ReDim $avProcs[$colProcs.count + 1][10] $avProcs[0][0] = UBound($avProcs) - 1 ; For each process... For $oProc In $colProcs ; [n][0] = Process name $avProcs[$n][0] = $oProc.name ; [n][1] = Process PID $avProcs[$n][1] = $oProc.ProcessId ; [n][2] = Parent PID $avProcs[$n][2] = $oProc.ParentProcessId ; [n][3] = Owner If $oProc.GetOwner($sUserName, $sUserDomain) = 0 Then $avProcs[$n][3] = $sUserDomain & "\" & $sUserName ; [n][4] = Priority $avProcs[$n][4] = $oProc.Priority ; [n][5] = Executable path $avProcs[$n][5] = $oProc.ExecutablePath ; [n][8] = Creation date/time $dtmDate = $oProc.CreationDate If $dtmDate <> "" Then ; Back referencing RegExp pattern from weaponx Local $sRegExpPatt = "\A(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(?:.*)" $dtmDate = StringRegExpReplace($dtmDate, $sRegExpPatt, "$2/$3/$1 $4:$5:$6") EndIf $avProcs[$n][8] = $dtmDate ; [n][9] = Command line string $avProcs[$n][9] = $oProc.CommandLine ; increment index $n += 1 Next Else SetError(2); Error getting process collection from WMI EndIf ; release the collection object $colProcs = 0 ; Get collection of all processes from Win32_PerfFormattedData_PerfProc_Process ; Have to use an SWbemRefresher to pull the collection, or all Perf data will be zeros Local $oRefresher = ObjCreate("WbemScripting.SWbemRefresher") $colProcs = $oRefresher.AddEnum($oWMI, "Win32_PerfFormattedData_PerfProc_Process" ).objectSet $oRefresher.Refresh ; Time delay before calling refresher Local $iTime = TimerInit() Do Sleep(20) Until TimerDiff($iTime) >= 100 $oRefresher.Refresh ; Get PerfProc data For $oProc In $colProcs ; Find it in the array For $n = 1 To $avProcs[0][0] If $avProcs[$n][1] = $oProc.IDProcess Then ; [n][6] = CPU usage $avProcs[$n][6] = $oProc.PercentProcessorTime ; [n][7] = memory usage $avProcs[$n][7] = $oProc.WorkingSet ExitLoop EndIf Next Next Else SetError(1); Error connecting to WMI EndIf ; Return array Return $avProcs EndFunc ;==>_ProcessListProperties Constructive criticism welcome.1 point -
In layman's terms... NTFS file system allows for file to be associated with more than one file stream. Streams other than the main are called Alternate Data Streams. Normally the users on Windows systems aren't aware of them because windows explorer can't show them. They aren't meant to be seen and have purpose of carrying additional information about the file they are "attached" to. For example if you download something from internet and try to run it, by default you should have shell window popping-up informing you about the risks of running downloaded material. That information is attached to the file right after it's been downloaded and it's saved as :Zone.Identifier ADS. Also some malware creators use ADS to hide and perform different actions from there. For example it's nothing unusual to find malignant executable module in ADS of seemingly benign executable. NTFS implementation for Compound Files also uses ADS, even exclusively. Anyway, the script I'm posting here allows you to list and view all streams of the file that you load. Three methods are used to enumerate streams depending on your wishes. You can choose to use NtQuery, BackupRead or FindStream method and maybe compare speed and availability of each method depending on your system specifications. NtQuery method is used by KaFu in his SMF, so that's not new, but other two methods are new to AutoIt AFAIK, unless used privately of course. There is a GUI around the three functions to show what they do, that part isn't really that important. You will notice that I'm displaying up to 1024 bytes of the selected stream. The script: ADS_Viewer.au3 edit: New script.1 point
-
I've added AutoItX3_DLL.cs to the beta. It contains the DLLImports and some easier to use wrappers. The DLLImports are set as private with only the wrappers being visible as I intend for all use/intellisense to be done through the wrappers - I just have to code them all up... The wrappers currently implemented match the speed of development of the PowerShell Cmdlets because I'm doing them at the same time.1 point
-
I would suggest that you contact the coder of RDG Packer Detector. Br, UEZ1 point
-
Belgium, Quite lot, unfortunately! You need to set a master value for the volume which you then change when you press the HotKeys and you need to keep the script alive by adding a loop. Take a look at this example and see if you can work out why I have changed it as I have: HotKeySet("a","volumedown") HotKeySet("b","volumeup") HotKeySet("{ESC}", "On_Exit") Global $vol = 100 ; Here is the initial setting which is used everywhere While 1 Sleep(10) WEnd Func volumedown() If $vol > 0 Then $vol -= 5 ; Decrease if we are not already at 0 EndIf SoundSetWaveVolume($vol) EndFunc Func volumeup() If $vol < 100 Then $vol += 5 ; Increase if we are not already at 100 EndIf SoundSetWaveVolume($vol) EndFunc Func On_Exit() Exit EndFunc I also changed the HotKeys so they so not conflict with SciTE and added a way of exiting. Please ask if you have any questions. And finally, if you run Vista+ than you only affect the volume of this process and not the overall volume - open the volume applet and you will see that is what is happening. M231 point
-
Many people see word bot and assume the worst, when in a lot of cases it's just a term for automation which is what AutoIt was designed to do. Kylomas is just asking you to read the rules so you can be sure you're not breaking them. Post what code you have, and try to better explain what you are trying.1 point
-
You never deselect the first one before moving down to the next selection. You have a MultiSelect Listbox, so you can have multiple items selected. Try this. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <array.au3> $Form1 = GUICreate("Form1", 254, 233, 516, 270) $List1 = GUICtrlCreateList("", 16, 8, 217, 149, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL)) ; BitOR style taken from help file $sItems = "1|2|3|4|5" ; To simplify, no txt list. Just this one for testing purposes. GUICtrlSetData($List1, $sItems) _GUICtrlListBox_SetSel($List1, 0) ; Set position 1 (which is the 2nd in list) as default $Button1 = GUICtrlCreateButton("Button1", 80, 176, 75, 25) GUISetState(@SW_SHOW) Local $aaa, $Selected Local $sss = 0 While 1 $aaa = GUIGetMsg() Select Case $aaa = $GUI_EVENT_CLOSE ExitLoop Case $aaa = $Button1 $selItems = _GUICtrlListBox_GetSelItemsText($List1) $Selected = _GUICtrlListBox_GetSelItems($List1) _GUICtrlListBox_SetSel($List1, $Selected[1], False) $sss = $sss + 1 If $sss = _GUICtrlListBox_GetCount($List1) Then $sss = 0 _GUICtrlListBox_SetSel($List1, $sss); Read the selected item characteristics to an array MsgBox(4160, "Information", "Item Selected: " & $selItems[1]) ; $selItems[1] cooresponds to the the selected text value in this array EndSelect WEnd You'll see that I also fixed an issue you would have had even if this had worked as intended, you counted up and selected the next item in the list, but you never took into account that eventually you'd end up at the bottom of the list and your script would have crashed when you ran out of items. I made it so that it wraps back to the first item in the list instead of crashing. If you wanted it to stay at the last item in the list after you've scrolled down to it, change this line. ; From this If $sss = _GUICtrlListBox_GetCount($List1) Then $sss = 0 ; To this If $sss = _GUICtrlListBox_GetCount($List1) Then $sss = _GUICtrlListBox_GetCount($List1) - 11 point
-
Get Select item text in listbox
LastSoul reacted to abberration for a topic
I have played with your code until I have it working how you want. At least this is what I think you want. Look at the comments and they should help you. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <array.au3> $Form1 = GUICreate("Form1", 254, 233, 516, 270) $List1 = GUICtrlCreateList("", 16, 8, 217, 149, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL)) ; BitOR style taken from help file $sItems = "1|2|3|4|5" ; To simplify, no txt list. Just this one for testing purposes. GUICtrlSetData($List1, $sItems) _GUICtrlListBox_SetSel($List1, 1) ; Set position 1 (which is the 2nd in list) as default $Button1 = GUICtrlCreateButton("Button1", 80, 176, 75, 25) GUISetState(@SW_SHOW) Local $aaa While 1 $aaa = GUIGetMsg() Select Case $aaa = $GUI_EVENT_CLOSE ExitLoop Case $aaa = $Button1 $selItems = _GUICtrlListBox_GetSelItemsText($List1) ; Read the selected item characteristics to an array MsgBox(4160, "Information", "Item Selected: " & $selItems[1]) ; $selItems[1] cooresponds to the the selected text value in this array EndSelect WEnd1 point -
legna, Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. Please read them now (there is also a link at bottom right of each page) - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. M231 point
-
Another way you can access the help file, which I always use, is by pressing the F1 key on your keyboard while your scite4autoit editor is active. Furthermore, if you left (Primary) click your mouse on a native autoit function name or keyword while in the editor and then press F1 the help file will open just where you need it (on the page of the function/keyword/macro etc.. you clicked) And another thing that is sometimes overlooked here on the forums is the online help, and how easily it can be accessed. Heres an example, click on any of the native function names which appear between these autoit tags If FileExists("setup.exe") Then FileDelete("setup.exe") Else FileWrite("setup.txt") EndIf FileOpen(("setup.txt") FileOpenDialog() ;etc...1 point