Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. Today
  3. I know, I know.... Sorry for the "cloak and dagger." Thank you for verifying that my array comes no where NEAR limitations. I wish I could just post the whole script and let you have at it but right now that is not an option. I promise in the future if I have a question, I will endeavor to provide all questionable code and current insights but for right now I will just have to break this down to smaller chunks and process it 50 elements at a time in 3 separate scripts. IF I ever work out a reason I will be sure to post. Again, to all of you, thank you for this form and the insights that bridge the gap in education between beginner, intermediate and expert autoit scriptors...
  4. Then why bothering asking for help with it? We can't help you fix something if we don't know what that something includes. Are you by any chance deleting elements of the array in a loop? We don't know because there's nothing to go on. Is the script silently crashing? No idea, no code. See where we're coming from?
  5. it's in the commandline property of the running process #include "_ProcessListProperties.au3" #include <Array.au3> ShellExecute('Notepad.exe') $avRET = _ProcessListProperties("notepad.exe") _ArrayDisplay($avRET) $cmdline = $avRet[1][9] MsgBox($MB_SYSTEMMODAL, 'Cmdline or where is my process called from? ', $cmdline) #include <Array.au3>; Only for _ArrayDisplay() ; Install a custom error handler Global $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"), $f_COMError = False ; Globals Global $avRET, $iPID ; This is my custom error handler Func MyErrFunc() Local $HexNumber=hex($oMyError.number,8) Msgbox(0,"","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 I got that processlist file from here it's in that array at row 1, column 9, the string shows where the file being executed is. that sample works with notepad, obviously you can look for any process by name, or leave that parameter blank to get all processes. So, I will need gluten Free donuts as payment thanks... kidding.
  6. To extract the source code from an exe file with stored source code. A small script for easy use: ; To extract the source code from a EXE file with saved source code. #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_Res_SaveSource=y #include <ResourcesEx.au3> #include <WinAPISysWin.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> Global $InputEXE = FileOpenDialog("Select file to extract source from", @ScriptDir, "EXE (*.EXE)", $FD_FILEMUSTEXIST, StringTrimRight(@ScriptName, 3) & "exe") Global $sFilePath = $InputEXE & ".extracted_source.au3" Global $rc = _Resource_SaveToFile($sFilePath, 999, $RT_RCDATA, Default, Default, $InputEXE) MsgBox($MB_ICONINFORMATION, Default, ($rc <> 0 ? $sFilePath & @lf&@lf& " created." : $InputEXE &@lf&@lf& " has NO included source"), 0)
  7. Limits on arrays and string lengths far exceed your examples. You need to provide us an example script the reproduces your issue or we can't help. Providing us a script that functions won't help us to help you
  8. Thanks to everyone for chiming in. I am developing with a friend who doesn't want the "CODE" public BUT!!. with the array posted below, imagine instead of just splashing a text message, I was doing some excel copying and pasting looping thru the same code for 148 elements. why does it loop thru perfectly as posted below, but dies every time on ogen, the last element in the 4th line of tickers when I am doing more complex processing between the <for next>? Am I hitting some limitation I don't know about? ;Setup the ticker array $sTkr = 'ABIL,ABIO,ACHV,ADIL,ADMA,AETI,AEZS,AKER,AKTX,ALDX,ALQA,AMRS,AMTX,ANY,APHA,ARCI,ASNA,ASNS,ATAI,ATOS,AVCO,AVEO,AWSM,AXGT,AXSM,' ;25 count $sTkr &= 'BIOC,BKS,BLIN,BMMJ,BOXL,BPTH,BURG,CAPR,CCCL,CEI,CIFS,CLDC,CLDX,CLRO,CODX,COTY,CPRX,CUI,DARE,DBD,DCIX,DFFN,DSS,EARS,EGAN,' ;25 count $sTkr &= 'ELTK,ENSV,EPZM,FBIO,FCSC,FET,FFHL,FIT,FLXN,FTFT,FTK,FTR,GENE,GEVO,GLBS,GME,GOGO,GSM,GTXI,HMNY,HSGX,IDRA,IGC,INNT,INPX,' ;25 count $sTkr &= 'JAGX,JMU,JNUG,KNDI,KTOV,LPCN,MARA,MAXR,MBIO,MBOT,MBRX,MDWD,MLNT,MRIN,MTFB,MTP,MTSL,MXC,NBEV,NK,NOV,NVAX,NVLN,OCX,OGEN,' ;25 count $sTkr &= 'OPTT,OVID,OXY,PDSB,PHUN,PLAG,PRPO,PTI,PULM,RBZ,RENN,REPH,RHE,RIOT,RKDA,RNN,SAEX,SCYX,SEEL,SFET,SGYP,SKYS,SLNO,SNOA,SOLO,' ;25 count $sTkr &= 'SPEX,SPI,SRNE,STAF,SUNW,SXTC,TBBK,TBLT,TMSR,TNXP,TTNP,UXIN,VTL,VTVT,VVPR,VXRT,WATT,WKHS,WORX,YRIV,ZKIN,ZSAN,ZYNE' ;23 count Global $Tkr = StringSplit($sTkr, ",", 2) for $x = 0 to 147 splashtexton("TICKER",$Tkr[$x]&" "&$x,400,400,1000,200) sleep(200) next
  9. You must have the world's worst AV then. Does your AV delete other exes that use FileInstall? If not, then you're doing something different with this one. I've never had any AV flag a file because I FileInstalled the source script in it.
  10. Added #requireadmin and looks a lot better now. Still some process I am not able to get the path
  11. Thank you Adam, seems like I am not able to get all the path. Would you have any idea why?
  12. Do you have access to the process ? Have you tried running it with #requireadmin ? Jos
  13. Show me the total SciTE output when compiling the script as that should give information about including the source in the PE header. Also show me the used directive. Jos
  14. Well good solutions here. Not one working well for me, and it's not the solutions fault so much as the environment. if I try the FileInstall() method AV immediately deletes the .exe and the file that would have been extracted. If I try the ResSaveSource wrapper and the ResExtractSource function I found to use with it, the file is not as expected, I also do not see a RCDATA 999. I must imagine this is due to how its being compiled and maybe I need to change some of the compile directives. I'll probably just use the FileInstall() method and if we ever really need it, extract it on a machine that does not have the enterprise AV software on it.
  15. You are using the wrong include and function. You need to use SecurityEx.au3 include (in first post) and the _SetPrivilege function. Adam
  16. I am not able to run the command properly, something got update and I am not sure what I am missing
  17. Trying to find the path location of each process that is running in the systems and path locations is returning blank #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\..\..\Program Files (x86)\Common Files\Microsoft Shared\TextTemplating\10.0\TextTemplate.ico #AutoIt3Wrapper_Outfile=GetCert (x86).exe #AutoIt3Wrapper_Outfile_x64=GetCert (x64).exe #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <WinAPIProc.au3> MsgBox (0, "Cert Collector", "Bla Bla Bla") $sigcheck_question = MsgBox (4+32, "Cert Collector", "Do you want to use SigCheck?") If $sigcheck_question == 6 Then $sigcheck_location = FileOpenDialog ("SigCheck Location", @DesktopDir, "Executables (*.exe)", 1, "SigCheck.exe") EndIf $aProcList = ProcessList() ;_ArrayDisplay($aProcList) For $i = 1 To $aProcList[0][0] ;MsgBox($MB_SYSTEMMODAL, "", $aProcessList[$i][0] & @CRLF & "PID: " & $aProcessList[$i][1]) MsgBox(0, '', "Process Name: " & $aProcList[$i][0] & @CRLF & "Location: " & _WinAPI_GetProcessFileName($aProclist[$i][1])) Next
  18. Then you did not run the posted code through au3check... so please do that now first. Also: That posted error doesn't mean anything to me as that is from the compiled script. Try running it from the SciTE editor as that will directly point you to the line in error.
  19. Guys, why are you ruining my "chess" game? my next move ... @HTRN, I am pretty sure Line 103 is coded wrong don't you think? Jos
  20. @Jos thanks for poining out this post that's exactly what I was looking for!
  21. yes Now, I say all of that to say this, when I use excel.au3 and run my script, when it hits the 100th item in the array, it exits. The script ends. No error, no hung spreadsheets, it just exits like its finished. It did it 4 times straight when tested. Why did it exit at the 100th item?
  22. Hi There is no syntax error I get. And the error detail is there in the title of this thread
  23. Nice long story, but is there a question in there? Jos
  1. Load more activity
  • Create New...