Jump to content

Yahoo status changer


Tzackel
 Share

Recommended Posts

I often get pissed off while playing or working with programs...that i suddenly hear buzzes and yahoo windows pop-up just cause i forgot to set a status message to Busy or something like that. :whistle:

Here's my saviour lol

#include <GUIConstants.au3>
#Include <GuiCombo.au3>
#include <String.au3>
Opt("WinTitleMatchMode", 2)
$user=RegRead("HKEY_CURRENT_USER\SOFTWARE\Yahoo\pager","Yahoo! User ID")
Dim $var[100][4]
Dim $maxi
Dim $noval
Dim $mainswitch=True
$main=GUICreate("Status changer by tzackel",280,170)
GUICtrlCreateLabel("Application Window Name: ",10,14)
GUICtrlCreateLabel("Status Message: ",10,34)
GUICtrlCreateLabel("Busy value: ",180,34)
$combo=GUICtrlCreateCombo ("", 150,10,120,20,$CBS_DROPDOWNLIST)
$input=GUICtrlCreateInput ("", 10,  50, 150, 20)
$yes = GUICtrlCreateRadio ("Yes", 180, 50, 40, 20)
$no = GUICtrlCreateRadio ("No", 230, 50, 40, 20)
$change = GUICtrlCreateButton ("Modify",  10, 80, 130)
$delete = GUICtrlCreateButton ("Delete",  140, 80, 130)
$addstatus = GUICtrlCreateButton ("Add New Application",  10, 105, 130)
$deleteall = GUICtrlCreateButton ("Delete All Values",  140, 105, 130)
$go=GUICtrlCreateButton ("Turn ON",  10, 130, 130)
$exit=GUICtrlCreateButton ("Exit",  140, 130, 130)
GUISetState ()
RefreshStatuses()
Repopulate()
While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE OR $msg = $exit
            ProcessClose("statuser.exe")
            ExitLoop
        Case $msg = $combo
            $sel = _GUICtrlComboGetCurSel($combo)
            $sel= $sel+1
            GUICtrlSetData ( $input, $var[$sel][2] )
            if $var[$sel][3]=="1" Then
                GUICtrlSetState ($yes, $GUI_CHECKED)
            Else
                GUICtrlSetState ($no, $GUI_CHECKED)
            EndIf
        Case $msg = $change And Not $noval
            $sel = _GUICtrlComboGetCurSel($combo)
            $sel = $sel+1
            if GUICtrlRead($yes) == $GUI_CHECKED Then
                $busy="1"
            Else
                $busy="0"
            EndIf
            $inputval=GUICtrlRead($input)
            if $inputval <> $var[$sel][2] Then
                RegWrite("HKEY_CURRENT_USER\SOFTWARE\Statuses",$var[$sel][1],"REG_SZ",$inputval)
                $switch=1
            ElseIf $busy<>$var[$sel][3] Then
                RegWrite("HKEY_CURRENT_USER\SOFTWARE\Statuses\" & $var[$sel][1],$var[$sel][1],"REG_DWORD",$busy )
                $switch=1
            Else
                $switch=0
            EndIf
            if $switch==1  Then
                RefreshStatuses()
            EndIf
        Case $msg = $delete AND NOT $noval
            $sel = _GUICtrlComboGetCurSel($combo)
            RegDelete("HKEY_CURRENT_USER\SOFTWARE\Statuses",GUICtrlRead($combo))
            RegDelete("HKEY_CURRENT_USER\SOFTWARE\Statuses\" & GUICtrlRead($combo))
            RefreshStatuses()
            Repopulate()
        Case $msg = $deleteall AND NOT $noval
            $decision=Msgbox(4,"Delete All Values","Are you sure u want to delete all status messages?")
            if $decision==6 Then
                RegDelete("HKEY_CURRENT_USER\SOFTWARE\Statuses")
                _GUICtrlComboResetContent($combo)
                GUICtrlSetData($input, "")
                AddApp()
            EndIf
        Case $msg = $addstatus 
            AddAPP()    
        Case $msg = $go AND Not $noval
            If $mainswitch Then
                AdlibEnable("TurnON",10000)
                $mainswitch=False
                GUICtrlSetData($go,"Turn OFF")
            Else 
                AdlibDisable()
                $mainswitch=True
                GUICtrlSetData($go,"Turn ON")
            EndIf
    EndSelect
Wend
Func RefreshStatuses()
    Dim $maxi
    Dim $var[100][4]
    Dim $noval
    For $i = 1 to 100
        $val=RegEnumVal("HKEY_CURRENT_USER\SOFTWARE\Statuses", $i)
        $val1=RegRead("HKEY_CURRENT_USER\SOFTWARE\Statuses",$val)
        $val2=RegRead("HKEY_CURRENT_USER\SOFTWARE\Statuses\" & $val,$val)
        $var[$i][1] = $val
        $var[$i][2] = $val1
        $var[$i][3] = $val2
        if @error <> 0 Then 
            ReDim $var[$i][4]
            $maxi=$i-1
            $noval=False
            if $i==1 Then 
                _GUICtrlComboResetContent($combo)
                GUICtrlSetData($input, "")
                $noval=True
                MsgBox(4096,"No Applications","Status Changer has detected that no values have been saved")
                AddAPP()
            EndIf
            ExitLoop
        EndIf
    next
EndFunc
Func Repopulate()
    If NOT $noval Then
    _GUICtrlComboResetContent($combo)
    for $i =1 to $maxi
    GUICtrlSetData($combo,$var[$i][1],$var[$i][1])
    Next
    _GUICtrlComboSetCurSel($combo,0)
    if $var[1][3]=="1" Then
    GUICtrlSetState ($yes, $GUI_CHECKED)
    Else
    GUICtrlSetState ($no, $GUI_CHECKED)
    EndIf
    GUICtrlSetData ($input, $var[1][2])
    EndIf
EndFunc
Func AddAPP()
    $add=GUICreate("Add Application",200,200,"-1","-1","-1","-1",$main)
    GUISetState (@SW_SHOW)
    GUICtrlCreateLabel("Application Window Name: ",10,10,150)
    $input1=GUICtrlCreateInput ("", 10,  30, 180, 20)
    GUICtrlCreateLabel("Status message: ",10,60,150)
    $input2=GUICtrlCreateInput ("", 10,  80, 180, 20)
    GUICtrlCreateLabel("Busy Value: ",10,110,70)
    $yes1 = GUICtrlCreateRadio ("Yes", 80, 107, 40, 20)
    $no1 = GUICtrlCreateRadio ("No", 140, 107, 40, 20)
    $addvalue = GUICtrlCreateButton ("Add Value",  10, 130, 180)
    $cancel = GUICtrlCreateButton ("Cancel",  10, 160, 180)
    GUICtrlSetState ($no1, $GUI_CHECKED)
    While 1
    $msg1 = GUIGetMsg()
        Select
        Case $msg1 = $GUI_EVENT_CLOSE Or $msg1 = $cancel 
                GUIDelete()
                ExitLoop
            Case $msg1 = $addvalue
                if GUICtrlRead($input1)=="" Then
                    MsgBox(4096,"Input missing","Please input new application window name.")
                    ContinueCase
                ElseIf GUICtrlRead($input2)="" Then
                    GUICtrlSetData($input2,GUICtrlRead($input1))
                EndIf
                if GUICtrlRead($yes1) == $GUI_CHECKED Then
                    $busy1="1"
                Else
                    $busy1="0"
                EndIf
                RegWrite("HKEY_CURRENT_USER\SOFTWARE\Statuses",GUICtrlRead($input1),"REG_SZ",GUICtrlRead($input2))
                RegWrite("HKEY_CURRENT_USER\SOFTWARE\Statuses\" & GUICtrlRead($input1),GUICtrlRead($input1),"REG_DWORD",$busy1)
                GUIDelete()
                RefreshStatuses()
                Repopulate()
                ExitLoop
        EndSelect
    Wend
EndFunc
Func TurnON()
    if(Not ProcessExists("YahooMessenger.exe")) Then
        MsgBox(4096,"Yahoo Messenger is closed","Please open yahoo messenger and login")
        Return
    Elseif WinExists("Yahoo! Messenger","YLoginWnd") Then
        MsgBox(4096,"Yahoo Messenger is logged out","Please login to yahoo messenger")
        Return
    EndIf
    for $i =1 to $maxi
        if WinActive($var[$i][1],"") Then
            $status=$var[$i][2]
            $busy=$var[$i][3]
            ExitLoop
        Else
            $status="Busy"
            $busy="1"
        EndIf
    Next
    $read=RegRead("HKEY_CURRENT_USER\SOFTWARE\Yahoo\pager\profiles\" & $user & "\Custom Msgs","1")
    if($status<>$read) Then
        $hex=_StringToHex($status)
        RegWrite("HKEY_CURRENT_USER\SOFTWARE\Yahoo\pager\profiles\" & $user & "\Custom Msgs", "5_bin", "REG_BINARY", $hex & "00")
        RegWrite("HKEY_CURRENT_USER\SOFTWARE\Yahoo\pager\profiles\" & $user & "\Custom Msgs", "5", "REG_SZ", $status)
        RegWrite("HKEY_CURRENT_USER\SOFTWARE\Yahoo\pager\profiles\" & $user & "\Custom Msgs", "5_DND", "REG_DWORD", $busy)
        $handle = WinGetHandle("Yahoo! Messenger","")
        PostMessage($handle, "0x111", "0x188", "0");
    EndIf
EndFunc
Func PostMessage($hWnd, $msg, $wParm, $lParm)
    Return DllCall("user32.dll", "int", "PostMessage","hwnd", $hWnd, "int", $msg, "int", $wParm, "int", $lParm)
EndFunc

Worked on yahoo messenger v 8.1

Obviously needs many tweaks and fixes.

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...