Sign in to follow this  
Followers 0
Kreatorul

What's Wrong?

7 posts in this topic

What's wrong in here? I am trying to make a simple program to show a little popup window with the name of the current song when the winamp song changes...but i donno what's wrong :">

#include <GUIConstants.au3>

Opt('WinTitleMatchMode', 4)
$cur=StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', '')
RegWrite("HKEY_LOCAL_MACHINE\Software\WinampCurSong", "CurSong", "REG_SZ", $cur)
$reg=RegRead("HKEY_LOCAL_MACHINE\Software\WinampCurSong", "CurSong")
$gui=GUICreate("Winamp Current Song", 1300, 35, 0, 0,$WS_POPUP)
$label=GuiCtrlCreateLabel($cur, 2, 2, 1300, 50, $SS_CENTER)
GuiCtrlSetFont($label, 22)
GUISetState()
WinSetTrans($gui ,"", 150)
WinSetOnTop($gui, "", 1)
While 1
    $msg=GuiGetMsg()
    RegWrite("HKEY_LOCAL_MACHINE\Software\WinampCurSong", "CurSong", "REG_SZ", StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', ''))
If StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', '')<>$reg Then 
    GuiSetState()
    GuiCtrlSetData($label, StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', ''))
    RegWrite("HKEY_LOCAL_MACHINE\Software\WinampCurSong", "CurSong", "REG_SZ", StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', ''))
    Sleep(3000)
    GuiSetState(@SW_HIDE)
    Else
    GuiSetState(@SW_HIDE)
    EndIf
    WEnd

Share this post


Link to post
Share on other sites



What's wrong in here? I am trying to make a simple program to show a little popup window with the name of the current song when the winamp song changes...but i donno what's wrong :">

#include <GUIConstants.au3>

Opt('WinTitleMatchMode', 4)
$cur=StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', '')
RegWrite("HKEY_LOCAL_MACHINE\Software\WinampCurSong", "CurSong", "REG_SZ", $cur)
$reg=RegRead("HKEY_LOCAL_MACHINE\Software\WinampCurSong", "CurSong")
$gui=GUICreate("Winamp Current Song", 1300, 35, 0, 0,$WS_POPUP)
$label=GuiCtrlCreateLabel($cur, 2, 2, 1300, 50, $SS_CENTER)
GuiCtrlSetFont($label, 22)
GUISetState()
WinSetTrans($gui ,"", 150)
WinSetOnTop($gui, "", 1)
While 1
    $msg=GuiGetMsg()
    RegWrite("HKEY_LOCAL_MACHINE\Software\WinampCurSong", "CurSong", "REG_SZ", StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', ''))
If StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', '')<>$reg Then 
    GuiSetState()
    GuiCtrlSetData($label, StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', ''))
    RegWrite("HKEY_LOCAL_MACHINE\Software\WinampCurSong", "CurSong", "REG_SZ", StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', ''))
    Sleep(3000)
    GuiSetState(@SW_HIDE)
    Else
    GuiSetState(@SW_HIDE)
    EndIf
    WEnd
Don't use winamp so I can't test your script. However take a look at this topic.

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

Yep, that could be done very easily with my Winamp.au3 library.

Share this post


Link to post
Share on other sites

But I have to install ActiveWinamp and I want to do this without that...what am I doing wrong in there? :lmao:

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Maybe you should show the GUI after you assign data to it.

#include <GUIConstants.au3>

Opt('WinTitleMatchMode', 4)
$cur = StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', '')
RegWrite("HKEY_LOCAL_MACHINE\Software\WinampCurSong", "CurSong", "REG_SZ", $cur)
$reg = RegRead("HKEY_LOCAL_MACHINE\Software\WinampCurSong", "CurSong")
$gui = GUICreate("Winamp Current Song", 1300, 35, 0, 0, $WS_POPUP)
$label = GUICtrlCreateLabel($cur, 2, 2, 1300, 50, $SS_CENTER)
GUICtrlSetFont($label, 22)
GUISetState()
WinSetTrans($gui, "", 150)
WinSetOnTop($gui, "", 1)
While 1
    $msg = GUIGetMsg()
    RegWrite("HKEY_LOCAL_MACHINE\Software\WinampCurSong", "CurSong", "REG_SZ", StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', ''))
    If StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', '') <> $reg Then
        GUISetState()
        GUICtrlSetData($label, StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', ''))
        RegWrite("HKEY_LOCAL_MACHINE\Software\WinampCurSong", "CurSong", "REG_SZ", StringReplace(WinGetTitle('Classname=Winamp v1.x'), '- Winamp', ''))
        Sleep(3000)
        GUISetState(@SW_SHOW)
    Else
        GUISetState(@SW_HIDE)
    EndIf
WEnd

Not sure though as I don't have WinAmp to test the script with.

Edited by SolidSnake

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

But I have to install ActiveWinamp and I want to do this without that...what am I doing wrong in there? :ph34r:

But I have to install AutoIt and I want to run .au3 scripts without it. :lmao:

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Here you go :lmao:

#include <Array.au3>

$WinampTitle = WinampGetTitle()
If not @error Then
    _ArrayDisplay($WinampTitle,"")
Else
    MsgBox(0, "", "No songs are being played or Winamp is not being run")
EndIf

Func WinampGetTitle()
    Local $Return[2]
    Opt("WinTitleMatchMode", 2)
    $Title = WinGetTitle(" - Winamp")
    If $Title Then
        $Split = StringSplit($Title,".-")
        $Return[0] = $Split[2]
        $Return[1] = $Split[3]
        Return $Return
    Else
        SetError(1)
        Return
    EndIf
EndFunc
Edited by Manadar

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  
Followers 0