jf_EwfInfo_v0.06 - Tool to monitor EWF memory usage

Discussion in 'Windows' started by jfitie, Sep 29, 2008.

  1. jfitie

    bitflusher

    Joined:
    Nov 27, 2008
    Messages:
    7
    Likes Received:
    0
    what do you use to compile it?
     
    bitflusher, Nov 27, 2008
    #21
  2. jfitie

    raffaele

    Joined:
    Oct 19, 2008
    Messages:
    13
    Likes Received:
    0
    Location:
    Taranto
    raffaele, Nov 27, 2008
    #22
  3. jfitie

    bitflusher

    Joined:
    Nov 27, 2008
    Messages:
    7
    Likes Received:
    0
    i did a little editing

    http://www.2shared.com/file/4364189/e9d653f6/jf_EwfInfo_v006__-_bitflusher_edit.html


    changelog:

    removed: popup when started
    added: stop sighn when 200mb is used

    here is the source:
    Code:
    #Persistent
    #SingleInstance ignore
    
    
    ; Config
    scriptName := "AutoHotkey script v0.06 - bitflusher edit"
    trayDefault := 13
    trayWait := 21
    trayActive := 9
    trayInactive := 33
    trayWarning := 199
    
    ; Default tray icon settings
    Menu, Tray, Icon, Shell32.dll, %trayDefault%
    Menu, Tray, Tip, %scriptName%
    
    
    ; Initial volume
    currentVolume := 10
    SoundSet currentVolume
    
    
    ; Set timers
    SetTimer, myTimer, 30000
    
    
    ; Create menu, show info
    Gosub, GetEWFParameters
    Menu, tray, NoStandard
    if (ewfstate = "ENABLED") {
    Gosub, SetEWFnocmd
    Menu, tray, add, Commit EWF data on shutdown (commit), SetEWFcommit
    Menu, tray, add, Discard EWF data on shutdown (nocmd), SetEWFnocmd
    Menu, tray, add
    Menu, tray, add, Reboot with EWF disabled (commitanddisable), SetEWFcommitanddisable
    Menu, tray, add
    Menu, tray, add, Lock menu, LockMenu
    } else {
    Menu, tray, add, Reboot with EWF enabled (enable), SetEWFenable
    }
    
    
    ; End of script
    Return
    
    
    ; ------------ ROUTINES ------------
    
    
    SetEWFcommit:
    RunWait %comspec% /C ""C:\WINDOWS\system32\ewfmgr.exe" "C:" "-commit"", , Hide
    Gosub, GetEWFInfo
    Return
    
    
    SetEWFnocmd:
    RunWait %comspec% /C ""C:\WINDOWS\system32\ewfmgr.exe" "C:" "-nocmd"", , Hide
    Gosub, GetEWFInfo
    Return
    
    
    SetEWFcommitanddisable:
    RunWait %comspec% /C ""C:\WINDOWS\system32\ewfmgr.exe" "C:" "-commitanddisable"", , Hide
    RunWait %comspec% /C ""C:\WINDOWS\system32\shutdown.exe" "-r" "-t" "01"", , Hide
    Return
    
    
    SetEWFenable:
    RunWait %comspec% /C ""C:\WINDOWS\system32\ewfmgr.exe" "C:" "-enable"", , Hide
    RunWait %comspec% /C ""C:\WINDOWS\system32\shutdown.exe" "-r" "-t" "01"", , Hide
    Return
    
    
    LockMenu:
    Menu, tray, NoStandard
    Menu, tray, DeleteAll
    Menu, tray, add, Menu locked, DoNothing
    Return
    
    
    DoNothing:
    Return
    
    
    GetEWFParameters:
    Menu, Tray, Icon, Shell32.dll, %trayWait%
    RunWait %comspec% /C ""C:\WINDOWS\system32\ewfmgr.exe" "C:" > "%temp%ewf.tmp"", , Hide
    FileReadLine, ewfstate, %temp%ewf.tmp, 3
    ewfstate := SubStr(ewfstate, 19)
    FileReadLine, ewfcommand, %temp%ewf.tmp, 4
    ewfcommand := SubStr(ewfcommand, 19)
    FileReadLine, ewfdata, %temp%ewf.tmp, 13
    ewfdata := SubStr(ewfdata, 24)
    ewfdata := SubStr(ewfdata, 1, InStr(ewfdata, " ")-1)
    FileReadLine, ewfmapping, %temp%ewf.tmp, 14
    ewfmapping := SubStr(ewfmapping, 27)
    ewfmapping := SubStr(ewfmapping, 1, InStr(ewfmapping, " ")-1)
    Menu, Tray, Icon, Shell32.dll, %trayDefault%
    Return
    
    
    ; Volume control Up
    SC130::
    currentVolume *= 1.035
    currentVolume += 0.25
    If (currentVolume > 100) {
    currentVolume := 100
    }
    Gosub, SetVolume
    Return
    
    
    ; Volume control Down
    SC12E::
    currentVolume -= 0.25
    currentVolume /= 1.035
    If (currentVolume < 0) {
    currentVolume := 0
    }
    Gosub, SetVolume
    Return
    
    
    SetVolume:
    SoundSet currentVolume
    showVolume := Round(currentVolume, 2)
    TrayTip, Volume, %showVolume%`%, , 17
    Return
    
    
    GetEWFInfo:
    Gosub, GetEWFParameters
    if (ewfstate = "ENABLED") {
      if (ewfcommand = "COMMIT") {
       Menu, Tray, Icon, Shell32.dll, %trayActive%
      } else {
       Menu, Tray, Icon, Shell32.dll, %trayInactive%
      }
      ewfsize := Round((ewfdata + ewfmapping)/1024/1024, 1)
      Menu, Tray, Tip, Memory in use for EWF: %ewfsize% MB
    }
      if  ((ewfdata + ewfmapping) > 209715200 ) {
       Menu, Tray, Icon, Shell32.dll, %trayWarning%
    }
    Return
    
    
    myTimer:
    ; if ( A_TimeIdle > 10*60*1000 ) {
    ;  Run, rundll32.exe user32.dll`, LockWorkStation
    ; }
    Gosub, GetEWFInfo
    Return
    
    thank you johan for releasing the source.
     
    bitflusher, Nov 28, 2008
    #23
  4. jfitie

    sin_of_nature

    Joined:
    Dec 3, 2008
    Messages:
    6
    Likes Received:
    0
    Nice one Johan, fantastic little tool. Was going to make my own, but this is perfect.

    Nice little update too bitflusher. Why did you select 200MB as the warning level? EWF can use 512MB from my understanding. Dont know much about EWF, but if I have 1.5GB on my Acer One so I'm assuming I can increase this to 450MB without any side effects?

    Any help appreciated.

    SIn
     
    sin_of_nature, Dec 3, 2008
    #24
  5. jfitie

    bitflusher

    Joined:
    Nov 27, 2008
    Messages:
    7
    Likes Received:
    0
    for people just having 512 mb 200 mb is a nice warning level, setting it to 450 should be no problem at all, can you do this yourself or do you need help?

    oh i noticed i used the wrong icon but it changes at the warning level.
     
    bitflusher, Dec 3, 2008
    #25
  6. jfitie

    sin_of_nature

    Joined:
    Dec 3, 2008
    Messages:
    6
    Likes Received:
    0
    Hi,

    I should manage to change it myself, the script language looks very similar to Auto-it (which I know). Might change the script so that you can pass the value in as a parameter.


    Which icon should it be and I'll change that at the same time. :D

    Cheers

    Sin
     
    sin_of_nature, Dec 4, 2008
    #26
  7. jfitie

    bitflusher

    Joined:
    Nov 27, 2008
    Messages:
    7
    Likes Received:
    0
    bitflusher, Dec 5, 2008
    #27
  8. jfitie

    sin_of_nature

    Joined:
    Dec 3, 2008
    Messages:
    6
    Likes Received:
    0
    Why on earth are you modifying the volume in this script? I noticed when I run it, my volume drops to near 0?

    Sin
     
    sin_of_nature, Dec 5, 2008
    #28
  9. jfitie

    hafiz

    Joined:
    Dec 2, 2008
    Messages:
    14
    Likes Received:
    0
    is there a way for a metering utility like *samurize* to call up the parameter - reading of the ewf and display them in a meter/graphical manner?
     
    hafiz, Dec 6, 2008
    #29
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.