Jump to content

exe log or app mon


Go to solution Solved by mesale0077,

Recommended Posts

hi

exe start time and stop time

 ı want to keep  log

log file

in app.log  file

info               appname              date                   time
-----------     -----------------    ----------------      -----------
started           msnmsgr.exe          06,08.2013            20.03
started           ccleaner.exe         06.08.2013            21.12
stopped           ccleaner.exe         06.08.2013            21.18
started           firefox.exe          06.08.2013            21.12
stopped           firefox.exe          06.08.2013            22.16

like this

or different ways how to

thank you now

Link to comment
Share on other sites

FileOpen, FileWrite, @MSEC, @HOUR, @MIN, @TAB, FileClose. You should know the basics at least by now.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

  • Moderators

As always, the help file is your friend before posting. You can do this with _FileWriteLog.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

ı know

As always, the help file is your friend before posting. You can do this with _FileWriteLog.

 

FileOpen, FileWrite, @MSEC, @HOUR, @MIN, @TAB, FileClose. You should know the basics at least by now.

 

but info exe look

vbs source  like it

exe event run FileOpen, FileWrite, @MSEC, @HOUR, @MIN, @TAB, FileClose

exe stop FileOpen, FileWrite, @MSEC, @HOUR, @MIN, @TAB, FileClose

look ,control apps

like usb ejec control

like app start end stop time keep log

ı want to know exes started and stopped  ,when ?

Edited by mesale0077
Link to comment
Share on other sites

  • Moderators

mesale. your answers are making very little sense. If English is not your native language, I would suggest using Google Translate as well as writing it in your native tongue. Something like this:

 

 

Я понятия не имею, какого черта вы собираетесь в о

 

Google Translate:

 

I have no idea what the heck you're going on about

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

ProcessList will tell  you what apps are already running, keep an updated list going and look for any changes, if a new app is started, processlist will be different from the last time you checked, log the difference in your file. When it closes, the list will change again, log that.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

He wants to know which exe has been started on which time and log this to a file - not the exe started by AutoIt script.

Something like in Process Explorer image tab.

You can list all processes but afaik there is no additional information about start date/time.

Maybe in WinAPIEx.au3 is a solution...

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

This might be helpful:

 

#Include <Date.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

Global $aFT, $tFT, $tST, $ID = ProcessExists('SciTE.exe')

If $ID Then
$aFT = _WinAPI_GetProcessTimes($ID)
$tFT = _Date_Time_FileTimeToLocalFileTime(DllStructGetPtr($aFT[0]))
$tST = _Date_Time_FileTimeToSystemTime(DllStructGetPtr($tFT))
ConsoleWrite('SciTE was run at: ' & _WinAPI_GetTimeFormat(0, $tST) & @CR)
EndIf
You can get all processes you want, convert it with function and write it to a log file. The "stopped" time you can add when the PID doesn't exist anymore.

Slm,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

hi mesale0077

>this udf might interest you

among other things you can find functions like this:

; _ProcessGetTimes (); Returns Process Creation, Exit, Kernel / User-mode Times [<_WinTimeFunctions.au3> is helpful here)

and other assortments...

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

  • Solution

thank you

this links

'?do=embed' frameborder='0' data-embedContent>>

and

appmon

like this

worked

#include <date.au3>
#include <misc.au3>

HotKeySet("{ESC}","ESC")
filedelete("app.log")
local $oerror = ObjEvent("AutoIt.Error", "_DeBug")

Local $Obj  = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @ComputerName & "\root\cimv2")
Local $hObj = ObjCreate("WbemScripting.SWbemSink")

If IsObj($Obj) And IsObj($hObj) Then
    ObjEvent($hObj, "SINK_")
    $Obj.ExecNotificationQueryAsync($hObj, "SELECT * FROM __InstanceCreationEvent WITHIN 0.1 WHERE TargetInstance ISA 'Win32_Process'")
    $Obj.ExecNotificationQueryAsync($hObj, "SELECT * FROM __InstanceDeletionEvent WITHIN 0.1 WHERE TargetInstance ISA 'Win32_Process'")
EndIf

Sleep(9999999999)

Func SINK_OnObjectReady($OB)
    local $str,$owner,$ret
    Switch $OB.Path_.Class
        Case "__InstanceCreationEvent"
           $str &= $OB.TargetInstance.ProcessID & " - "
            $str &= $ob.targetinstance.name & " - "
            $str &= _now() & "`"
            $str &= "- "&$ob.targetinstance.executablepath & @cr
            filewrite("app.log","!->> Started  " & $str& @CRLF)
            $str = ""
                
        Case "__InstanceDeletionEvent"
            $str &= $OB.TargetInstance.ProcessID & " - "
            $str &= $ob.targetinstance.name & " - "
            $str &= _now() & "`"
             filewrite("app.log","+->> Ended  " & $str& @CRLF)
            $str = ""
                    
    EndSwitch
    Return 1
EndFunc

Func _Debug($oError)
    ConsoleWrite( _
            "! ##################### AUTOIT OBJECT ERROR ######################################" & @CRLF & _
            "!                err.number is        : " & @TAB & hex($oError.number,8) & @CRLF & _
            "!                err.scriptline is    : " & @TAB & $oError.scriptline & @CRLF & _
            "!                err.windesc is       : " & @TAB & $oError.windescription & @CRLF & _
            "!                err.desc is          : " & @TAB & $oError.description & @CRLF & _
            "!                err.source is        : " & @TAB & $oError.source & @CRLF & _
            "!                err.retcode is       : " & @TAB & hex($oError.retcode,8) & @CRLF & _
            "! ################################################################################" & @CRLF _
            )
    Return 0
EndFunc

Func ESC()
    Exit(0)
EndFunc
Edited by mesale0077
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...