bLisTeRinG
Joined: 15 Nov 2004 Posts: 45 Location: Warrnambool
|
Posted: Sun Nov 28, 2004 10:50 am Post subject: The Winamp Button code... |
|
|
#Persistent
#SingleInstance
FileInstall, WinampB.ini, %A_ScriptDir%\WinampB.ini, 0
iniP = %A_ScriptDir%\WinampB.ini
if %0% <> 0
{
iPath = %1%
}
Else
{
iniRead, iPath, %iniP%, options, iniPath
}
iniRead, db, %iPath%, options, debug
iniRead, mr, %iPath%, options, more
iniRead, wPath, %iPath%, options, winamp
IfNotExist, %wPath% GoSub, wampF
Menu, tray, add, &Winamp, Winamp
Menu, tray, add, « &Back, WinBack
Menu, tray, add, ¤ &Stop, WinStop
Menu, tray, add, » &Next, WinNext
Menu, tray, add, ± &Jump ..., wJmp
DetectHiddenWindows, On
DetectHiddenText, On
IfWinExist, Winamp
{
Menu, tray, Check, &Winamp
SetTitleMatchMode, 2
SendMessage, 1024, 0, 120, , ahk_class Winamp v1.x
If ErrorLevel <> FAIL
{
ErrorLevel++ ; Winamp's count starts at "0", so adjust by 1.
Track = %ErrorLevel%
SendMessage, 1024, 0, 120, ,[Stopped]
If ErrorLevel <> FAIL
{
If db = 1, MsgBox, Winamp is Stopped at`nPlaylist number %Track%.`n
wAmp = v ; assume wAmp has track(s) not playing.
Menu, tray, Rename, ¤ &Stop, ¤ &Play
}
Else
{
If Track = 4294967296
{
If db = 1, MsgBox, Winamp has no Playlist Track(s) or File(s) .
wAmp = x
}
Else
{
If db = 1, MsgBox, Winamp is Playing (or paused) at`nPlaylist number %Track%.`n
wAmp = x
}
}
}
Else
{
If db = 1, MsgBox, Couldn't read Winamp Err=%ErrorLevel%.
wAmp = x
}
}
Else
{
If db = 1, MsgBox, Winamp isn't loaded right now!
wAmp = x
}
Menu, tray, add, P&references, wOps
Menu, tray, add, Sh&ow, WinShow
Menu, tray, add, &Close, WinampX
Menu, tray, add ;separator
;Menu, tray, add, &iExplore, iExp
;Menu, tray, add, &LyBerry, wShout
Menu, tray, add, Audio &Devices, aGetDev
Menu, tray, add, &Volumes, Mixer
Menu, tray, add ;separator
Menu, tray, add, %A_SPACE% &File(s) ..., LocF
Menu, tray, add, %A_SPACE% &Url ..., Loca
iniRead, U1, %iPath%, bName, 1,
iniRead, U2, %iPath%, bName, 2
iniRead, U3, %iPath%, bName, 3
iniRead, U4, %iPath%, bName, 4
iniRead, U5, %iPath%, bName, 5
iniRead, U6, %iPath%, bName, 6
iniRead, U7, %iPath%, bName, 7
iniRead, U8, %iPath%, bName, 8
iniRead, U9, %iPath%, bName, 9
If U1 <> , Menu, tray, add, &1 %U1%, Ur1
If U2 <> , Menu, tray, add, &2 %U2%, Ur2
If U3 <> , Menu, tray, add, &3 %U3%, Ur3
If U4 <> , Menu, tray, add, &4 %U4%, Ur4
If U5 <> , Menu, tray, add, &5 %U5%, Ur5
If U6 <> , Menu, tray, add, &6 %U6%, Ur6
If U7 <> , Menu, tray, add, &7 %U7%, Ur7
If U8 <> , Menu, tray, add, &8 %U8%, Ur8
If U9 <> , Menu, tray, add, &9 %U9%, Ur9
Menu, tray, add ;separator
Menu, tray, add, &More, Morez
Menu, tray, add, E&xit, Exit
Menu, tray, Default, &Winamp
Menu, tray, NoStandard
SetEnv, standard, n
If mr = 1, GoSub mores
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#1::
If U1 <> , Goto, Ur1
Return
#2::
If U2 <> , Goto, Ur2
Return
#3::
If U3 <> , Goto, Ur3
Return
#4::
If U4 <> , Goto, Ur4
Return
#5::
If U5 <> , Goto, Ur5
Return
#6::
If U6 <> , Goto, Ur6
Return
#7::
If U7 <> , Goto, Ur7
Return
#8::
If U8 <> , Goto, Ur8
Return
#9::
If U9 <> , Goto, Ur9
Return
#0::
DetectHiddenWindows, on
SetTitleMatchMode, 2
PostMessage, 0x111, 32800,,,ahk_id 4294594829 ; Winamp apparently!
; #32768
; 752
; ÂÂ-1
; SetTitleMatchMode, 2
; WinMenuSelectItem, ahk_id 4294594829, , 1&,
msgbox, Win + 0
Return
mTray:
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
MouseMove, 640, 1
MouseMove, 796, 1
xx = 700
xy = 4
yx = 796
yy = 30
err =
PixelSearch, x, y, %xx%, %xy%, %yx%, %yy%, %try%
If ErrorLevel <> 0, err = 1
MouseMove, %x%, %y%
Return
; EditPad Button
#Shift::
try = 16777215
GoSub mTray
MouseClick, R
EnvSub, x, 20
EnvAdd, y, 20
MouseMove, %x%, %y%
Return
; bLisTeRinG Menu
#CTRL::
try = 128
GoSub mTray
EnvSub, x, 80
EnvAdd, y, 120
MouseMove, %x%, %y%
Return
; HostUtil
#ALT::
try = 32768
GoSub mTray
If err = 1, Return
If err = 1
{
try = 8421504
GoSub mTray
}
MouseClick, R
EnvSub, x, 80
EnvAdd, y, 20
MouseMove, %x%, %y%
Return
WinampButton:
#Space::
try = 16711680
;;16711680
GoSub mTray
MouseClick, R
EnvSub, x, 80
EnvAdd, y, 80
MouseMove, %x%, %y%
Return
; Some Colours -use AutoIt3 Spy
;autoHotkey Green 8421504 2088784
;bLisTeRinG menu 128 255 32896 12632256
;EditPad 16777215
;Ladybug1 32768 65280 8421376 12571357 65280
;Light Green 32768
;Green 65280
;Grey toolbar 10789024 1097567 12571357 7170409
;wAmp 16711680 8421376
;1263
;51732
;1362432
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Winamp:
DetectHiddenWindows, On
SetTitleMatchMode, 2
IfWinNotExist, - Winamp
IfWinNotExist, Winamp 1. ; Adjust this if your Winamp is not 2.x
{
Run, %wPath%
Return
}
; Otherwise, the above has set the "last found" window for us:
ControlSend, ahk_parent, c ; Pause/Unpause
Menu, tray, Check, &Winamp
Return
WinBack:
DetectHiddenWindows, On
SetTitleMatchMode, 2
IfWinNotExist, - Winamp
IfWinNotExist, Winamp 1.
Return
ControlSend, ahk_parent, z
Return
WinStop:
DetectHiddenWindows, On
DetectHiddenText, On
IfWinExist, Winamp
{
If wAmp = v
{
wAmp = x
Menu, tray, Rename, ¤ &Play, ¤ &Stop
}
Else
{
wAmp = v
Menu, tray, Rename, ¤ &Stop, ¤ &Play
}
SetTitleMatchMode, 2
IfWinNotExist, - Winamp
IfWinNotExist, Winamp 1.
Return
ControlSend, ahk_parent, %wAmp%
}
Return
WinNext:
DetectHiddenWindows, On
IfWinExist, Winamp
{
SetTitleMatchMode, 2
SendMessage, 1024, 0, 120, , ahk_class Winamp v1.x
if ErrorLevel <> FAIL
{
ErrorLevel++
ErrorLevel++
ToolTip, Track %ErrorLevel%
;MsgBox, Tk %ErrorLevel%
}
}
IfWinNotExist, - Winamp
IfWinNotExist, Winamp 1.
Return
ControlSend, ahk_parent, b
ToolTip,
Return
wOps:
DetectHiddenWindows, On
DetectHiddenText, On
IfWinNotExist, - Winamp
IfWinNotExist, Winamp v1.
Return
ControlSend, ahk_parent, {CtrlDown}p{CtrlUp}
Return
wJmp:
DetectHiddenWindows, On
DetectHiddenText, On
IfWinNotExist, - Winamp
IfWinNotExist, Winamp v1.x
Return
ControlSend, ahk_parent, j
Return
WinShow:
Run, %wPath%
Menu, tray, Check, &Winamp
Return
WinampX:
DetectHiddenWindows, On
DetectHiddenText, On
WinKill, ahk_class Winamp v1.x
GoSub, Unchek
Menu, tray, Uncheck, &Winamp
Return
wShout:
DetectHiddenWindows, On
DetectHiddenText, On
IfWinExist, Winamp
{
SetTitleMatchMode, 2
IfWinNotExist, - Winamp
IfWinNotExist, Winamp 1.
Return
ControlSend, ahk_parent, ^l
; {Alt down}l{Alt up}
MsgBox, , Did it Work?, Err=%errorlevel%, 3
Menu, tray, Check, &Winamp
If wSC <> 1
{
wSC = 1
Menu, tray, Check, &LyBerry
}
Else
{
wSC = 0
Menu, tray, Uncheck, &LyBerry
}
}
Return
;______These couldn't send "!h" (Shoutcast Lister window)______
; IfWinNotExist, - Winamp
; IfWinNotExist, Winamp 1.
; Return
; ControlSend, ahk_parent, h ; ; Only single characters!
; Send, j ; ; Wonky!
; WinMenuSelectItem, - Winamp, , 0&, 8& : Nothing!
; WinMenuSelectItem, - Winamp, , 0&, Library : Nothing!
; WinMenuSelectItem, ahk_parent, , 2&, Library
; Send, <!l
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
iExp:
Run, IEXPLORE.EXE
Return
Mixer:
Run, Sndvol32.exe
Return
aGetDev:
Inputbox, dev, Audio Device Number, `n`n`nChoose an audio device number...,,280,180,,,,,1
If ErrorLevel = 1
{
SplashTextOff
Return
}
Inputbox, devi, Audio Device Component, `nLine Cd`nMicrophone Wave Synth`nDigital Analog`nPcSpeaker Aux Telephone,,280,180,,,,,Master
If ErrorLevel = 1
{
SplashTextOff
Return
}
Inputbox, devic, Audio Device Control, Device%dev% %devi%...`n`nVolume Mute On Off Pan`nMono StereoEnh`nBassBoost Loudness Bass Treble Equalizer,,280,180,,,,,Volume
If ErrorLevel = 1
{
SplashTextOff
Return
}
SoundGet, mess,%devi%,%devic%,%dev%
If ErrorLevel <> 0
{
SplashTextOn ,350,60,Audio Device Message,Device%dev% %devi% %devic%...`n%ErrorLevel%
WinMove, Audio Device Message, , 10, 10
}
Else
{
SplashTextOn ,350,60,Audio Device Message,Device%dev% %devi% %devic%...`n%mess%
WinMove, Audio Device Message, , 10, 10
}
Inputbox, mess, Audio Device Control, Device%dev% %devi% %devic% = %mess%...`n`nEnter a new value or...`nLeave it alone.`n ,,280,180,,,,,%mess%
If ErrorLevel = 1
{
SplashTextOff
Return
}
SoundSet, %mess%,%devi%,%devic%,%dev%
If ErrorLevel <> 0
{
SplashTextOn ,350,60,Audio Device Value,Device%dev% %devi% %devic%...`n%ErrorLevel%
WinMove, Audio Device Value, , 10, 10
}
Else
{
SplashTextOn ,350,60,Audio Device Value,Device%dev% %devi% %devic%...`n%mess%
WinMove, Audio Device Value, , 10, 10
}
mess =
dev =
Goto aGetDev
Return
Unchek:
Menu, tray, Uncheck, %A_SPACE% &Url ...
Menu, tray, Uncheck, %A_SPACE% &File(s) ...
If U1 <> , Menu, tray, Uncheck, &1 %U1%
If U2 <> , Menu, tray, Uncheck, &2 %U2%
If U3 <> , Menu, tray, Uncheck, &3 %U3%
If U4 <> , Menu, tray, Uncheck, &4 %U4%
If U5 <> , Menu, tray, Uncheck, &5 %U5%
If U6 <> , Menu, tray, Uncheck, &6 %U6%
If U7 <> , Menu, tray, Uncheck, &7 %U7%
If U8 <> , Menu, tray, Uncheck, &8 %U8%
If U9 <> , Menu, tray, Uncheck, &9 %U9%
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Ur1:
Uy = 1
Uz = %U1%
Goto, UGet
Ur2:
Uy = 2
Uz = %U2%
Goto, UGet
Ur3:
Uy = 3
Uz = %U3%
Goto, UGet
Ur4:
Uy = 4
Uz = %U4%
Goto, UGet
Ur5:
Uy = 5
Uz = %U5%
Goto, UGet
Ur6:
Uy = 6
Uz = %U6%
Goto, UGet
Ur7:
Uy = 7
Uz = %U7%
Goto, UGet
Ur8:
Uy = 8
Uz = %U8%
Goto, UGet
Ur9:
Uy = 9
Uz = %U9%
Goto, UGet
UGet:
iniRead, Url, %iPath%, bAddr, %Uy%
GoSub, Unchek
Menu, tray, Check, &%Uy% %Uz%
Uy =
Uz =
Loca:
StringLen, UrlNum, Url
If UrlNum = 0
{
InputBox, Url, Enter a URL,,,280,100,,,,,http://
If ErrorLevel <> 0, Goto J1
GoSub, Unchek
Menu, tray, Check, %A_SPACE% &Url ...
Goto, Loca
}
DetectHiddenWindows, On
DetectHiddenText, On
If db = 1, MsgBox, , Open a Location, `nCommand:`n%wPath% %Url%
RunWait, %wPath% "%Url%"
; WinActive, , &Winamp, 3
; Run, %wPath% "%Url%"
Menu, tray, Check, &Winamp
J1:
Url =
UrlNum =
DetectHiddenText, Off
DetectHiddenWindows, Off
Return
LocF:
iniRead, wExt, %iPath%, options, extensions
FileSelectFile, Filz, 4, ,Select File(s) to Play, %wExt%
StringLen, FilzNum, Filz
If FilzNum = 0, Goto LocX
Loop, parse, Filz, `n
{
If A_LoopField = ; A BLANK field marks the end of the list.
{
If a_index = 2
Fiz = "%Pathz%"
break
}
If a_index = 1
{
If db = 1, MsgBox, The selected Path/File:`n %A_LoopField%.
StringReplace, Pathz, A_LoopField, `n, , all
}
Else
{
If db = 1, MsgBox, 4, , The next file is:`n %A_LoopField%. Continue?
IfMsgBox, No, break
StringReplace, Filez, A_LoopField, `n, , all
Fiz = "%Pathz%\%Filez%" %Fiz%
}
}
; MsgBox, Filz is %Filz% `n Pathz is %Pathz% `n wPath is %wPath% `n
If db = 1, MsgBox, , Files to Play, Loading...`n %Fiz%, 6
Run, %wPath% /ADD %Fiz%
GoSub, Unchek
Menu, tray, Check, %A_SPACE% &File(s) ...
Menu, tray, Check, &Winamp
LocX:
;ToolTip, `n%Fiz%`n, 1, 1
Filz =
FilzNum =
Pathz =
Filez =
Fiz =
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Morez:
If mr = 1
{
mr = 0
}
Else
{
mr = 1
}
Mores:
If mr = 1
{
iniWrite, 1, %iPath%, options, more
Menu, tray, delete, E&xit
Menu, tray, Check, &More
Menu, tray, add, %A_SPACE% Edit Bookmar&ks, bMark
Menu, tray, add, %A_SPACE% &Edit Extensions, wampE
Menu, tray, add, %A_SPACE% Locate &iniFile, iniF
Menu, tray, add, %A_SPACE% Locate Win&Amp, wampF
Menu, tray, add, %A_SPACE% &Hotkeys, PawsK
Menu, tray, Check, %A_SPACE% &Hotkeys
Menu, tray, add, %A_SPACE% Scrip&t, Paws
Menu, tray, Check, %A_SPACE% Scrip&t
Menu, tray, add, %A_SPACE% Debu&g, dBug
If db = 1, Menu, tray, Check, %A_SPACE% Debu&g
Menu, tray, add, %A_SPACE% &Reload Me, ReMe
Menu, tray, add, E&xit, Exit
}
Else
{
iniWrite, 0, %iPath%, options, more
Menu, tray, Uncheck, &More
Menu, tray, delete, %A_SPACE% &Reload Me
Menu, tray, delete, %A_SPACE% Debu&g, dBug
Menu, tray, delete, %A_SPACE% Scrip&t
Menu, tray, delete, %A_SPACE% &Hotkeys
Menu, tray, delete, %A_SPACE% Locate Win&Amp
Menu, tray, delete, %A_SPACE% Locate &iniFile
Menu, tray, delete, %A_SPACE% &Edit Extensions
Menu, tray, delete, %A_SPACE% Edit Bookmar&ks
}
Goto WinampButton
Return
Exit:
ExitApp
Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Q Y Z
iniF:
FileSelectFile, iniP, 8, *.ini, Change %iPath%
If ErrorLevel = 1
{
iniP = %A_SPACE%
}
If iPath = %iniP%, Return
If db = 1, MsgBox, 1,Change initialization File, `nOld iniPath:`n%iPath%`n`nNew iniPath:`n%iniP%, 8
;If ErrorLevel = 1, Return
iniWrite, %iniP%, %iPath%, options, iniPath
iniWrite, %iniP%, %iniP%, options, iniPath
Reload
Return
wampE:
iniRead, wExt, %iPath%, options, extensions
Inputbox, wExt, File Extensions Filtering, `nFile Type Filter for Select File(s) dialogue.`n`nie: *.mp3;*.m3u;*.wav;*.mid`n,,280,180,,,,,%wExt%
If ErrorLevel = 1, Return
iniWrite, %wExt%, %iPath%, options, extensions
Return
wampF:
FileSelectFile, wPath, 1, C:\Progra~1\ Winamp.exe, Look for Winamp.exe
If ErrorLevel = 1, Return
iniWrite, %wPath%, %iPath%, options, winamp
Return
dBug:
If mr = 1
{
If db = 0
{
db = 1
Menu, tray, Check, %A_SPACE% Debu&g
iniWrite, 1, %iPath%, options, debug
}
Else
{
db = 0
Menu, tray, Uncheck, %A_SPACE% Debu&g
iniWrite, 0, %iPath%, options, debug
}
}
Goto WinampButton
Return
PawsK:
If mr = 1
{
Menu, tray, ToggleCheck, %A_SPACE% &Hotkeys
Suspend
MsgBox, , Winamp Button Hotkeys, `nBack:`tWin+Z or Win+LeftArrow`nStop:`tWin+X`nPause:`tWin+C`nPlay:`tWin+V`nFwd:`tWin+B or Win+RightArrow`n`nJump:`tWin+J`nBkmarks:`tWin+1 to Win+9`nVolume:`tWin+Up/DownArrow
}
Goto WinampButton
Return
Paws:
If mr = 1
{
Menu, tray, ToggleCheck, %A_SPACE% Scrip&t
Pause
}
Goto WinampButton
Return
ReMe:
Reload
Return
bMark:
Inputbox, bMk, Bookmarks, `nChoose a Bookmark Number`n`nbetween 1 and 9.,,280,180,,,,,1
If ErrorLevel = 1, Goto bMarx
iniRead, bMx, %iPath%, bName, %bMk%
If bMx = ERROR
{
;bMx =
}
Inputbox, bMn, Bookmark%bMk%, `nEnter a Name for the Bookmark`n`nDelete Line to remove Bookmark.,,280,180,,,,,%bMx%
If ErrorLevel = 1, Goto bMarx
iniRead, bMy, %iPath%, bAddr, %bMk%
If db = 1, MsgBox, ,Bookmark Name, `nOldName:%bMx%`nNewName:%bMn%, 2
If bMy = ERROR ;no section and/or variable entries.
{
Menu, tray, rename, &%bMk% %bMx%, &%bMk% %bMn%
;bMy =
}
Else
{
If U%bMk% =
{
If bMn =
{
}
Else
{
Menu, tray, add, &%bMk% %bMn%, Ur%bMk%
}
}
Else
{
If bMx <> %bMn%, Menu, tray, delete, &%bMk% %bMx%
}
}
iniRead, wExt, %iPath%, options, extensions
FileSelectFile, bMa, 0, %bMy%, Bookmark%bMK% File / Cancel to Edit Location, %wExt%
If ErrorLevel = 1
{
Inputbox, bMa, Bookmark%bMk% Location, Edit Location / Cancel to Quit / Delete the Line to Remove this Bookmark`n`nCurrently:`n%bMy%,,480,180,,,,,%bMy%
If ErrorLevel = 1, Goto bMarx
}
U%bMk% = %bMn%
iniWrite, %bMn%, %iPath%, bName, %bMk%
iniWrite, %bMa%, %iPath%, bAddr, %bMk%
If db = 1, MsgBox, OldName:&%bMk% %bMx% `nNewName:&%bMk% %bMn%`nNewURI:%bMa%
If bMx_bMy = %bMn%_%bMa%, Goto bMarx
Reload
Return
bMarx:
bMk =
bMx =
bMy =
bMn =
bMa =
Return
/*
________________________
Aezay Caption Draw
Winamp Hotkeys
________________________
Win + up | Volume Up
Win + down | Volume Down
Win + left | Rewind
Win + rite | FastFwd
Win + z | Back
Win + x | Play
Win + c | Pause
Win + v | Stop
Win + b | Fwd
Win + q | Quit
Win + j | Jump
Win + t | wamp 2 Top
________________________
AutoHotKeys
________________________
Win + 1 | Bookmark 1
. | .
. | .
. | .
Win + 9 | Bookmark 9
________________________
*/ |
|