Ok I've worked out how to do this for columnsui now from the "foosq -
final" file. Admittedly I've never used autoit before and it has been
a lot of years since I last programmed but I thought I'd put my edited
code here for anyone who is looking for it. If anyone can spot any
problems in my code please, please tell me. Obviously I should add a
thankyou to stuffedspacedog for the original code and everyone who
helped in this thread well before I'd even considered getting a
squeezebox. You've all just made my hifi a infinitely better!
Code:
--------------------
$m_amip = "e:\nextsong.txt"
$m_ip = "127.0.0.1"
$m_port = 9090
$m_fooh = "[CLASS:{E7076D1C-A7BF-4f39-B771-BCBE88F2A2A8}]"
$m_fooexe = "C:\Program Files (x86)\foobar2000\foobar2000.exe"
$m_f = ""
$m_r = "0"
$m_s = "0"
$m_p = "?"
$m_t = ""
$m_n = ""
$m_ne = ""
$m_fn = ""
$m_sq = ""
$m_title = ""
$m_idle = 0
$m_ro = "0"
$m_seek = 0
$m_elt = ""
$m_seekt = 8
$m_0gap = 0
$m_0seek = 0
Run($m_fooexe, "", @SW_MAXIMIZE)
WinWait($m_fooh, "", 20)
TCPStartup()
$m_tcp = TCPConnect($m_ip, $m_port)
If @error Then
MsgBox(48, "FooSQ Warning", "Squeezebox Server not responding.")
Exit
EndIf
HotKeySet("{NUMPADADD}", "f_vol")
HotKeySet("{NUMPADSUB}", "f_vol")
HotKeySet("{NUMPADMULT}", "f_vol")
While 1
If Not WinExists($m_fooh) Then
TCPSend($m_tcp, "stop" & @CRLF & "playlist clear" & @CRLF)
Exit
EndIf
$m_title = WinGetTitle($m_fooh)
If $m_title = "0" Then
Sleep(300)
$m_title = WinGetTitle($m_fooh)
If $m_title = "0" Then
Sleep(300)
$m_title = WinGetTitle($m_fooh)
EndIf
EndIf
If StringRegExp($m_title, "foobar2000") Then
$m_idle = 1
Else
$m_idle = 0
EndIf
If $m_idle = 0 And $m_title <> "" Then
$a_tn = StringSplit($m_title, "/")
$m_fn = $a_tn[1]
$m_r = $a_tn[2]
$m_p = $a_tn[3]
$m_elt = $a_tn[4]
if number($m_seekt) > 0 AND $m_0seek = 0 Then
$m_seekv = number($m_r) - number($m_ro)
if abs($m_seekv) > $m_seekt AND $m_ro <> "0" AND $m_f = $m_fn Then
$m_seek = 1
Endif
Endif
$m_ro = $m_r
if $m_0seek > 0 then
$m_0seek = $m_0seek -1
endif
Else
$m_0gap = 1
$m_0seek = 50
EndIf
Select
Case $m_idle = 1 And $m_s <> "0"
$m_s = "0"
TCPSend($m_tcp, "stop" & @CRLF & "playlist clear" & @CRLF)
Case $m_idle = 0 And $m_s = "0"
$m_s = "1"
$m_f = $m_fn
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
TCPSend($m_tcp, "playlist play " & $m_sq & @CRLF)
Case $m_idle = 0 AND $m_s = "1" AND $m_seek = 0
if $m_p = "1" Then
$m_s = "2"
TCPSend($m_tcp,"pause 1" & @CRLF)
Else
if $m_f <> $m_fn Then
if $m_t = "0" Then
if $m_fn <> $m_n Then
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
TCPSend($m_tcp,"playlist play " & $m_sq & @CRLF)
Endif
endif
$m_t = ""
$m_ne = ""
$m_f = $m_fn
Else
if number($m_r) < 12 AND number($m_r) > 1 AND $m_0gap = 0 Then
if $m_ne = "" Then
$m_amips = FileOpen($m_amip, 0)
$m_n = FileReadLine($m_amip)
FileClose($m_amip)
$m_sq = StringReplace(StringReplace($m_n, "\", "/"), " ", "%20")
TCPSend($m_tcp,"playlist insert " & $m_sq & @CRLF)
$m_ne = "1"
Endif
Endif
if Number($m_r) < 2 Then
$m_t = "0"
$m_0gap = 0
Endif
Endif
EndIf
Case $m_idle = 0 And $m_s = "2"
If $m_p = "?" Then
$m_s = "1"
TCPSend($m_tcp, "pause 0" & @CRLF)
EndIf
Case $m_idle = 0 AND $m_s = "1" AND $m_seek = 1
$m_seek = 0
$m_ne = ""
TCPSend($m_tcp,"playlist clear" & @CRLF)
TCPSend($m_tcp,"playlist play " & StringReplace(StringReplace($m_fn, "\",
"/"), " ", "%20") & @CRLF)
TCPSend($m_tcp,"pause 1" & @CRLF)
sleep(50)
TCPSend($m_tcp, "time " & $m_elt & @CRLF)
Sleep(50)
TCPSend($m_tcp,"pause 0" & @CRLF)
EndSelect
Sleep(50)
WEnd
Func f_vol()
Select
Case StringInStr(@HotKeyPressed, "{NUMPADADD}")
TCPSend($m_tcp, "mixer volume +5" & @CRLF)
Case StringInStr(@HotKeyPressed, "{NUMPADSUB}")
TCPSend($m_tcp, "mixer volume -5" & @CRLF)
Case StringInStr(@HotKeyPressed, "{NUMPADMULT}")
TCPSend($m_tcp, "mixer volume 0" & @CRLF)
EndSelect
EndFunc
--------------------
I should note straight away that I changed the path for my foobar
install and amip output in order to overcome problems I was having so
if you want to use it you probably should revert to whatever you
prefer. I think the only other changes I've made were columnsui
related, which were the classid and and the foobar title when no
program is playing.
--
annoyingmouse
------------------------------------------------------------------------
annoyingmouse's Profile: http://forums.slimdevices.com/member.php?userid=49704
View this thread: http://forums.slimdevices.com/showthread.php?t=79575
_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/discuss