Vegar Posted October 29, 2009 Share Posted October 29, 2009 Hello I have made a small script witch does that i can change the song in the music-player without having to open the music-players window.. realy simple script witch i have used "Hotkeyset's", and "controlsend" in func's.. the button's i use is Ctrl + Arrow but the problem is that i have to release the Ctrl before the song changes.. so its preaty annoying when i'm going to change many song.. so i woundered if there was any way possible that i can hold the Ctrl-button, and that the song changes at once i hit the right/left arrow? Thanx for all help Link to comment Share on other sites More sharing options...
NoHAX Posted October 29, 2009 Share Posted October 29, 2009 Maybe #include <Misc.au3> $dll = DllOpen("user32.dll") $key = 11 ;$key = 11 (CTRL key) $switchkey = ;set here your keys to change song While 1 Sleep ( 250 ) If _IsPressed("$key", $dll) Then Send($switchkey); Maybe you need to use controlsend, i hate control send =] EndIf WEnd DllClose($dll) I think i am on good way to do this Link to comment Share on other sites More sharing options...
Vegar Posted October 29, 2009 Author Share Posted October 29, 2009 Hmm, this made the song change if i only hit the Ctrl button ... nad i dont know what happend but seemd like the Ctrl was stuck or something, because the pc acted all weird after i had run the script.. like if the Ctrl button was down... the ide'a was that if i hold Ctrl and then hit Right Arrow then it changes song, and i can hold the Ctrl button and just skip to next song by pushing the right arrow again without realysing the Ctrl button between each song.. I tried this #include <Misc.au3> $dll = DllOpen("user32.dll") $key = 11 ;$key = 11 (CTRL key) $switchkey = "^{RIGHT}" ;Ctrl + "Right Arrow" to change to next song While 1 Sleep ( 50 ) If _IsPressed(11, $dll) and _IsPressed (27, $dll) Then ;11 = Ctrl ... 27 = Right Arrow ControlSend ("MusicProgramTitle","","",$switchkey) EndIf WEnd DllClose($dll) But with these i had to realease the Ctrl button between each song :/ Link to comment Share on other sites More sharing options...
Mison Posted October 29, 2009 Share Posted October 29, 2009 So what's the problem with Hotkeyset? Works just fine for me HotKeySet("^{DOWN}","_down") HotKeySet("^{UP}","_up") HotKeySet("{esc}","_exit") $win = GUICreate("Test123") GUISetState(@SW_SHOW) $trans = 255 While 1 Sleep(10) WEnd Func _down() $trans-=20 WinSetTrans("Test123","",$trans) EndFunc Func _up() $trans+=20 WinSetTrans("Test123","",$trans) EndFunc Func _exit() Exit EndFunc Hi ;) Link to comment Share on other sites More sharing options...
Vegar Posted October 29, 2009 Author Share Posted October 29, 2009 (edited) So what's the problem with Hotkeyset? Works just fine for me HotKeySet("^{DOWN}","_down") HotKeySet("^{UP}","_up") HotKeySet("{esc}","_exit") $win = GUICreate("Test123") GUISetState(@SW_SHOW) $trans = 255 While 1 Sleep(10) WEnd Func _down() $trans-=20 WinSetTrans("Test123","",$trans) EndFunc Func _up() $trans+=20 WinSetTrans("Test123","",$trans) EndFunc Func _exit() Exit EndFunc yeah it works alright... but when i try just that with ControlSend when i'm finnished changeing song it seems like the Ctrl Button is stuck ... so it holds the Ctrl button down until i hit the button myself again, then it "realeses" HotKeySet("^{RIGHT}","_RIGHT") HotKeySet("^{LEFT}","_LEFT") HotKeySet("{esc}","_exit") While 1 Sleep(10) WEnd Func _right() Controlsend ("MusicPlayerTitle","","","^{Right}") EndFunc Func _left() Controlsend ("MusicPlayerTitle","","","^{Left}") EndFunc Func _exit() Exit EndFunc Edited October 29, 2009 by Vegar Link to comment Share on other sites More sharing options...
jvanegmond Posted October 29, 2009 Share Posted October 29, 2009 Simple solution: Unbind the hotkey! Help file says how. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Baraoic Posted October 29, 2009 Share Posted October 29, 2009 Looks like your trying to do what P5ych0Gigabyte did HKTunes also if its for itunes because they one of the few that doesn't recognize media keys then there's this great dll called mmkeys.dll at Here that you install then restart itunes and then media keys works for it. Link to comment Share on other sites More sharing options...
Vegar Posted October 29, 2009 Author Share Posted October 29, 2009 Simple solution: Unbind the hotkey! Help file says how. Hmm, turned in to a litle problem with this "Unbinding" Now it works to change 2 songs, but then i have to release the Ctrl button to change more songs :/ but at least now the Ctrl button did not get "Stuck", dow evrything else worked fine.. but i'm unsure if i understand the "Unbinding" concept? anyways, here is what i tried: HotKeySet("^{RIGHT}","_right") HotKeySet("^{left}","_left") While 1 Sleep(10) WEnd Func _right() ControlSend ("Spotify","","","^{Right}") call ("unbind") EndFunc Func _left() ControlSend ("Spotify","","","^{left}") call ("unbind") EndFunc func unbind() HotKeySet("^{RIGHT}","_right") HotKeySet("^{left}","_left") EndFunc Link to comment Share on other sites More sharing options...
jvanegmond Posted October 29, 2009 Share Posted October 29, 2009 Step one: Unbind the hotkey Step two: Send keys that would otherwise trigger hotkey Step three: Rebind the hotkey Yes? github.com/jvanegmond Link to comment Share on other sites More sharing options...
Vegar Posted October 29, 2009 Author Share Posted October 29, 2009 (edited) hmm, i'm not understanding this ... i've trid just what you say, and exactly what it says in the help file ... but i'm not getting it to work :/ This works only for changeing 2 songs?! :S HotKeySet("^{RIGHT}","_right") While 1 Sleep(10) WEnd func _right() HotKeySet ("^{RIGHT}") ;1: unbind ControlSend ("Musikprogram","","","^{right}") ;2 Send hotkey HotKeySet("^{RIGHT}","_right");3 rebind EndFunc Edited October 29, 2009 by Vegar Link to comment Share on other sites More sharing options...
martin Posted October 29, 2009 Share Posted October 29, 2009 (edited) hmm, i'm not understanding this ... i've trid just what you say, and exactly what it says in the help file ... but i'm not getting it to work :/ This works only for changeing 2 songs?! :S HotKeySet("^{RIGHT}","_right") While 1 Sleep(10) WEnd func _right() HotKeySet ("^{RIGHT}") ;1: unbind ControlSend ("Musikprogram","","","^{right}") ;2 Send hotkey HotKeySet("^{RIGHT}","_right");3 rebind EndFunc I think your problem is the fact that you are using a modifyer key in a HotKeySet combination which is used to start sending text in some way. This results in the modifyer key being 'stuck' down if it has not been released befor ethe text is sent. The only way I can think of to stop this is to use the approach in a post I made here but this would mean that you would need to release the keys, including the Ctrl key, before the song changed and that might not be what you want. Edited October 29, 2009 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Vegar Posted October 30, 2009 Author Share Posted October 30, 2009 I think your problem is the fact that you are using a modifyer key in a HotKeySet combination which is used to start sending text in some way. This results in the modifyer key being 'stuck' down if it has not been released befor ethe text is sent. The only way I can think of to stop this is to use the approach in a post I made here but this would mean that you would need to release the keys, including the Ctrl key, before the song changed and that might not be what you want.Yeah, i have already made a script witch works like that.. that i have to release the Ctrl between each song ... cind of just that i wanted to get rid of...And i woundered if there is any way to do it with some _ispressed functions? Link to comment Share on other sites More sharing options...
Mison Posted October 30, 2009 Share Posted October 30, 2009 How about using other hotkey combination? For example Alt("!{UP}")... Hi ;) Link to comment Share on other sites More sharing options...
Vegar Posted October 31, 2009 Author Share Posted October 31, 2009 Hmm, did not get anything to work with the ALT-key :/ Link to comment Share on other sites More sharing options...
martin Posted November 1, 2009 Share Posted November 1, 2009 Hmm, did not get anything to work with the ALT-key :/Any combination which uses a modifyer key is likely to have the same problem. You could use keys that are rarely used. For example Pause, ScrollLock, or some function key perhaps. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Vegar Posted November 7, 2009 Author Share Posted November 7, 2009 (edited) Ok, After givin up 7-8 times trying to make this work, i actualy think i have found a way.. i tried many ways using _ispressed functions a stuff like that.. but when giving up on that i went back to what i originaly tried... And if i use the Windows-Button it worked preaty simple actualy: HotKeySet("#{RIGHT}","_right") While 1 Sleep(100) WEnd func _right() HotKeySet ("#{RIGHT}") ControlSend ("Musicprogramtitle","","","^{right}") HotKeySet("#{RIGHT}","_right") EndFunc Edited November 7, 2009 by Vegar 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