Jump to content
Sign in to follow this  
Dethredic

msn monetering function

Recommended Posts

Why don't you just get him his own laptop? That way, he doesn't mess with yours? Not expensive, just a few hundred for one (used) and you could lock him out completely from yours. If $$$ is an issue, have him work for it by doing odd jobs in the neighborhood, save his allowance, and maybe the parents also help out. For example, you could go here to get a decent used rig for $400 that will run XP and isn't a bad deal.

Share this post


Link to post
Share on other sites

the problem is not him hoging the computer its him not doing his homework because he is on msn all the time and gets distracted


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

Hey Dethredic, why don't you just do what I told you to do originally? Have a pause function with an inputbox pass. When certain hotkey (ctrl+shift+x) or sumtin like that, is pressed, an inputbox comes up. If the correct password is input the script will pause. when it's his turn unpause the script.

EDIT: Personally I prefer the garlic-timer.

http://www.kitchensimple.com/garlic/garlic_smgarlictimer.jpg

Edited by dandymcgee

Share this post


Link to post
Share on other sites

Do you ever post what you do or have done to try and do what you want to do? I mean all I ever see from you is a Koda made GUI that my 5 yr olds could do.

I just made what you wanted (I believe), and I've verified that it works, but I'll be damned if I'm going to post it until I've see what you've accomplished on your own over the last few days + the days/weeks on the other topic which is identical while this topic is kept alive.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Lol, I hate Koda. I use GuiBuilder every once in a while ( I remeber the days before I knew it existed where I'd trial and error every stupid little control on my GUIs one by one ). I really get annoyed when people purposly post the same questions more than once. I understand if it's been asked before and they simply couldn't find it, but when it's been asked before by them... IMO there's something wrong with that. Anyways I got some scripting to do.

Share this post


Link to post
Share on other sites

[quote Do you ever post what you do or have done to try and do what you want to do? I mean all I ever see from you is a Koda made GUI that my 5 yr olds could do.

I just made what you wanted (I believe), and I've verified that it works, but I'll be damned if I'm going to post it until I've see what you've accomplished on your own over the last few days + the days/weeks on the other topic which is identical while this topic is kept alive.


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

Ok, my point...

1. This is the same code over and over, nothing ever changes, which means there are no other attempts from you on fixing the issue yourself.

2. You've been given information on how to obtain the information you want (current active user), but I see no where that you've even tried to impliment it.

Here is an uncommented version:

Global $TimeStarted, $TimeAllowed = 1, $TimeDiff = 0, $test = _MSNUserActive()
Global $CheckDateTime, $UserNameMonitor = ''

AdlibEnable('_AdlibManager', 30000)
While 1
    Sleep(100000)
WEnd

Func _VerifyDayTime($nAllowed)
    Local $ActiveUser = _MSNUserActive()
    If @error Then Return 0
    If Not ProcessExists('msnmsgr.exe') Or $ActiveUser <> $UserNameMonitor Then
        Return 0
    EndIf
    If Not FileExists(@HomeDrive & '\MSNManager.ini') Then 
        IniWrite(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'Month', @MON)
        IniWrite(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'Day', @MDAY)
        IniWrite(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'Year', @YEAR)
        IniWrite(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'OkToOpen', $TimeAllowed)
    EndIf
    Local $nMonth = IniRead(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'Month', @MON)
    Local $nDay = IniRead(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'Day', @MDAY)
    Local $nYear = IniRead(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'Year', @YEAR)
    Local $nTimeLeft = Int(IniRead(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'OkToOpen', 0))
    If $nMonth <> @MON Or $nDay <> @MDAY Or $nYear <> @YEAR Then
        IniWrite(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'Month', @MON)
        IniWrite(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'Day', @MDAY)
        IniWrite(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'Year', @YEAR)
        IniWrite(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'OkToOpen', $TimeAllowed)
        $TimeStarted = TimerInit()
        Return $nAllowed
    ElseIf $nTimeLeft <= 0 Then
        ProcessClose('msnmsgr.exe')
        Return 0
    Else
        $TimeStarted = TimerInit()
        Return $nTimeLeft
    EndIf
EndFunc
    
Func _AdlibManager()
    If Not $CheckDateTime And _VerifyDayTime($TimeAllowed) Then
        AdlibDisable()
        AdlibEnable('_AdlibManager', 1000)
        $CheckDateTime = True
    EndIf
    If $CheckDateTime Then
        $TimeDiff = (TimerDiff($TimeStarted) / 1000) / 60
        If $TimeAllowed - $TimeDiff <= 0 Then
            IniWrite(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'OkToOpen', 0)
            ProcessClose('msnmsgr.exe')
            AdlibDisable()
            AdlibEnable('_AdlibManager', 30000)
            $CheckDateTime = False
        ElseIf Not ProcessExists('msnmsgr.exe') Then
            IniWrite(@HomeDrive & '\MSNManager.ini', 'MSNInfo', 'OkToOpen', $TimeAllowed - $TimeDiff)
            AdlibDisable()
            AdlibEnable('_AdlibManager', 30000)
            $CheckDateTime = False
        EndIf
    EndIf
    Return
EndFunc

Func _MSNUserActive()
    If Not ProcessExists('msnmsgr.exe') Then Return SetError(1, 0, 0);MSN is not on
    Local $hMain = @UserProfileDir & '\Local Settings\Application Data\Microsoft\Messenger\'
    Local $hFileToRead = '\SharingMetadata\Logs\Dfsr.log'
    Local $sSearch = FileFindFirstFile($hMain & '*.*')
    Local $hDirectory, $sUserName, $hFoundDir, $aSplit
    While 1
        $hDirectory = FileFindNextFile($sSearch)
        If @error Then ExitLoop
        If StringInStr(FileGetAttrib($hMain & $hDirectory), 'd') And StringInStr($hDirectory, '@') Then
            $aSplit = StringSplit($hDirectory, '@');Find the username by splitting email address found as a directory
            $sUserName &= $aSplit[1] & Chr(1)
            $hFoundDir &= $hMain & $hDirectory & $hFileToRead & Chr(1)
        EndIf
        Sleep(10)
    WEnd
   
    If Not $sUserName Then Return SetError(2, 0, 0);No users found
   
    $sUserName = StringSplit(StringTrimRight($sUserName, 1), Chr(1))
    $hFoundDir = StringSplit(StringTrimRight($hFoundDir, 1), Chr(1))
    If $sUserName[0] < 2 Then
        If $sUserName[1] = '' Then Return SetError(3, 0, 0);If by chance a directory was found, but the username is blank
        Return $sUserName[1];Only 1 username registered, return username
    EndIf
   
    Local $hRead, $aNSplit, $aSRE, $iHour = 0, $iMin = 0, $iSec = 0, $nUser
    For $iCC = 1 To $hFoundDir[0]
        $hRead = FileRead($hFoundDir[$iCC])
        $aSRE = StringRegExp($hRead, '(?i:' & @YEAR & @MON & @MDAY & ' )(.*?)(?i:\.)', 3)
        If Not @extended Or Not IsArray($aSRE) Then ContinueLoop
        $aNSplit = StringSplit($aSRE[0], ':')
        If $aNSplit[0] < 3 Then ContinueLoop
        If Int($aNSplit[1]) > Int($iHour) Then
            $iHour = $aNSplit[1]
            $iMin = $aNSplit[2]
            $iSec = $aNSplit[3]
            $nUser = $iCC
        ElseIf Int($aNSplit[1]) = Int($iHour) And Int($aNSplit[2]) > Int($iMin) Then
            $iHour = $aNSplit[1]
            $iMin = $aNSplit[2]
            $iSec = $aNSplit[3]
            $nUser = $iCC
        ElseIf Int($aNSplit[1]) = Int($iHour) And Int($aNSplit[2]) = Int($iMin) And Int($aNSplit[3]) > Int($iSec) Then
            $iHour = $aNSplit[1]
            $iMin = $aNSplit[2]
            $iSec = $aNSplit[3]
            $nUser = $iCC
        EndIf
    Next
    If $nUser Then Return $sUserName[$nUser]
    Return SetError(4, 0, 0)
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...