JoeyJoeJOe Posted March 1, 2005 Share Posted March 1, 2005 Hi, I'm currently trying to write a script that will remotely tell winamp to do stuff (pause,start,stop etc.). I've got a client/server script going that works fine and will allow me to execute whatever i want on the remote computer and have global hotkeys set up linked to the functions i want to peform (ctrl+alt+c to pause for example). Anyway the problem occurs when i try and do Send("^!c") on the remote machine. See i'm using synergy to use the same keyboard/mouse over two computers, so when i run my script on the local computer (the one that has the keyboard/mouse control) it tells the other computer two run Send("^!c") which it does. However synergy then of course hijacks the keypresses and sends them back to the computer on which it was triggered. Anyway winamp doesn't have any controls that i can use the ControlSend() function with to do what I want, so what i need to do is directly send a windows message to winamp itself, thereby bypassing synergy. Sorry if this explanation is hard to follow. Essentially what i need is a way to directly send a windows message, possible some kind of DLL call? Thanks. Link to comment Share on other sites More sharing options...
MHz Posted March 1, 2005 Share Posted March 1, 2005 Have you tried sending these keys?{VOLUME_MUTE} 2000/XP Only: Mute the volume {VOLUME_DOWN} 2000/XP Only: Reduce the volume {VOLUME_UP} 2000/XP Only: Increase the volume {MEDIA_NEXT} 2000/XP Only: Select next track in media player {MEDIA_PREV} 2000/XP Only: Select previous track in media player {MEDIA_STOP} 2000/XP Only: Stop media player {MEDIA_PLAY_PAUSE} 2000/XP Only: Play/pause media player {LAUNCH_MEDIA} 2000/XP Only: Launch media playerAre they suitable? Link to comment Share on other sites More sharing options...
JoeyJoeJOe Posted March 1, 2005 Author Share Posted March 1, 2005 They might be, but the problem is any keypresses simulated by the send() command will be intercepted by synergy and sent to the wrong computer. Link to comment Share on other sites More sharing options...
sugi Posted March 1, 2005 Share Posted March 1, 2005 Try using ControlSend with an empty control name:ControlSend('Winamp', '', '', '^!c')I'm not sure if that works (also check the window name, I have no idea how the winamp window is called), but it's worth a try. Link to comment Share on other sites More sharing options...
therks Posted March 1, 2005 Share Posted March 1, 2005 Try using ControlSend with an empty control name:ControlSend('Winamp', '', '', '^!c')I'm not sure if that works (also check the window name, I have no idea how the winamp window is called), but it's worth a try.<{POST_SNAPBACK}>I successfully used this:ControlSend('Winamp', '', '', 'x')To "press" the Play button. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
JoeyJoeJOe Posted March 1, 2005 Author Share Posted March 1, 2005 (edited) Well i'm an idiot (wasn't capitalizing w in winamp) that works now. Thanks for the help. I don't suppose there is a way to directly send windows messages asside from this just out of interest? For example the following should turn off all monitors. Msg|Progman|274|61808|2 Edited March 1, 2005 by JoeyJoeJOe Link to comment Share on other sites More sharing options...
therks Posted March 1, 2005 Share Posted March 1, 2005 (edited) Heh, neat... I just tried that with the DllCall SendMessage function and shut off my monitor. I'll have to remember this.$WM_SYSCOMMAND = 274 $SC_MONITORPOWER = 61808 Opt('WinTitleMatchMode', 4) $hwnd = WinGetHandle('classname=Progman') DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', $WM_SYSCOMMAND, 'int', $SC_MONITORPOWER, 'int', 2)There you go.*Edit: I found some information. MSDN Edited March 1, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
JoeyJoeJOe Posted March 2, 2005 Author Share Posted March 2, 2005 awesome, thanks alot. That msdn info is also really good. Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted March 2, 2005 Share Posted March 2, 2005 $WM_SYSCOMMAND = 274 $SC_MONITORPOWER = 61808 Opt('WinTitleMatchMode', 4) $hwnd = WinGetHandle('classname=Progman') DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', $WM_SYSCOMMAND, 'int', $SC_MONITORPOWER, 'int', 2) Great tool, but it only shuts off the monitor for 1 sec or so, can you control when you want it to turn on again? Link to comment Share on other sites More sharing options...
sugi Posted March 2, 2005 Share Posted March 2, 2005 The monitor is only turned on again when you move the mouse or press a key. Or if a function to turn on the monitor is called. Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted March 2, 2005 Share Posted March 2, 2005 Im sitting at a Win2k Computer, and if i run the script, and not tuchting anything, it will still just turn off for about 2 sec:S Link to comment Share on other sites More sharing options...
therks Posted March 3, 2005 Share Posted March 3, 2005 That's weird. Perhaps there's something else running on the computer that resets the idle time. On a related note, if anyone finds a way (via DLL, or other means) to turn off the harddrives (like in the power settings) that would be great. On my old computer, the harddrive is loud while it's spinning, and it'd be great if I could manually stop it spinning when I want to. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
sugi Posted March 3, 2005 Share Posted March 3, 2005 Im sitting at a Win2k Computer, and if i run the script, and not tuchting anything, it will still just turn off for about 2 sec:SI think Saunders is right.Some program is resetting the idle time, or your mouse sends events even if it's not moved. Or, your monitor doesn't support power saving. At least these are the possibilities I can think of right now. Link to comment Share on other sites More sharing options...
JoeyJoeJOe Posted March 5, 2005 Author Share Posted March 5, 2005 I had the same problem as WB-Freekill when sending that message through hoekey, I solved it by placing a sleep|1000 command before the message is sent. I see no reason why it wouldn't work the same in autoit. Link to comment Share on other sites More sharing options...
therks Posted March 5, 2005 Share Posted March 5, 2005 Hmm.. just realized that this command doesn't seem to work on my other computer at all. Very strange. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now