AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Postmessage to winamp setting volume

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
eagle00789



Joined: 27 Nov 2006
Posts: 52
Location: Heerlen Country: Netherlands

PostPosted: Fri Jun 27, 2008 1:39 am    Post subject: Postmessage to winamp setting volume Reply with quote

I have this code:
Code:
      if joyy >= 000
      {
         StringLeft, tmpVol, joyy, 2
         if tmpVol = 07
            volume = 00
         if tmpVol = 06
            volume = 36
         if tmpVol = 05
            volume = 73
         if tmpVol = 04
            volume = 109
         if tmpVol = 03
            volume = 145
         if tmpVol = 02
            volume = 182
         if tmpVol = 01
            volume = 218
         if tmpVol = 00
            volume = 255
         PostMessage, 0x400, 122, %volume%, , ahk_id %WinAmpHWND%
      }
to set the volume of winamp, but this doesn't work. am i using the w/lparam wrong?? i found the code to do this here and all my other winamp messages are correct
_________________
Before asking a question try to read the manual
Always use the code sections when you paste some code
Back to top
View user's profile Send private message
Muzzi



Joined: 15 Jun 2008
Posts: 65
Location: east coast of Australia

PostPosted: Fri Jun 27, 2008 2:02 am    Post subject: Reply with quote

Not sure what you're after exactly to control Winamp's volume but thought this might be useful...

By moving your entire mouse up and down it will control Winamp's volume.



Code:
SetTimer, KeepRunning
return
KeepRunning:
GetKeyState, state, scrolllock, T  ;;; use scroll lock key to turn on/off
if state = D
{
  Suspend, off
  SetTimer, PowerWAmp, 5 ;;; enables mouse volume control for winamp
}
else
{
  Suspend, on
  SetTimer, PowerWAmp, off  ;;; disables mouse volume control for winamp
}
return

^w::Run "%ProgramFiles%\Winamp\Winamp.exe"  ;;; Ctrl + w = starts winamp


FiMap( input, low, high )
{
  If ( low > high )
  return FiMap( input, high, low )
  return Round( input * (high-low) + low )
}
PowerWAmp:
Coordmode, Mouse, Screen        ;;; moving the entire mouse up or down controls Winamp's volume.
MouseGetPos, X, Y
SendMessage, 0x400, FiMap(1-Y/A_ScreenHeight, 0, 255), 122, , ahk_class Winamp v1.x
return

_________________
̊˳ɱטᶚᶚї˳̊
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1071

PostPosted: Fri Jun 27, 2008 2:04 am    Post subject: Re: Postmessage to winamp setting volume Reply with quote

eagle00789 wrote:
am i using the w/lparam wrong??
Yes, swap them and your code should be OK.
_________________
My Home Thread
More Common Answers: 1. It's in the FAQ 2. Ternary ( ? : ) guide 3. Post code with [code][/code] tags
Back to top
View user's profile Send private message
eagle00789



Joined: 27 Nov 2006
Posts: 52
Location: Heerlen Country: Netherlands

PostPosted: Fri Jun 27, 2008 7:04 am    Post subject: Re: Postmessage to winamp setting volume Reply with quote

[VxE] wrote:
eagle00789 wrote:
am i using the w/lparam wrong??
Yes, swap them and your code should be OK.
Thx mate. that indeed works Very Happy

To complete this post, here is the correct code:
Code:
      if joyy >= 000
      {
         StringLeft, tmpVol, joyy, 2
         if tmpVol = 07
            volume = 00
         if tmpVol = 06
            volume = 36
         if tmpVol = 05
            volume = 73
         if tmpVol = 04
            volume = 109
         if tmpVol = 03
            volume = 145
         if tmpVol = 02
            volume = 182
         if tmpVol = 01
            volume = 218
         if tmpVol = 00
            volume = 255
         PostMessage, 0x400, %volume%, 122, , ahk_id %WinAmpHWND%
      }


p.s. this code is part of a larger part that uses a virtual gamepad (but actual buttons and a knob) to control winamp, windows media player, or any other media player. if no mediaplayer is opened, it uses the default windows master volume as setting to change Very Happy
_________________
Before asking a question try to read the manual
Always use the code sections when you paste some code
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group