Jump to content

if cretain keys are pressed, play the next song


Recommended Posts

i'm trying to make a little script for a friend. here's the main idea:

dim $loop=1
while $loop=1
   if ???1 then
      send ("{MEDIA_NEXT}")
   elseif ???2 then
      send ("{MEDIA_PREV}")
   elseif ???3 then
      exit
   endif;i'm not sure why, but it does not bitch when i type it this way instead of putting endif after each thing =/
wend

as you can see, i managed to nail all the things that are sort of easy...

HOWEVER, i can't seem to make the following idea:

if shift+n_is_pressed then

send ("{MEDIA_NEXT}")

endif

i have no idea what i can do to make it work =/

also, while $loop=1 wend kind of thing is very cpu-consuming, however it's the only way i know to make the thing run untill i stop it.

i would also love suggestions on the topic of how to make it run forever without eating 99% cpu. :D

Link to comment
Share on other sites

There are two solutions:

HotKeySet("+n","shiftn")
while 1
Sleep(100) ; You sleep a loop to make it CPU friendly
WEnd
Func shiftn ()
send ("{MEDIA_NEXT}")
EndFuncoÝ÷ Øêò¢ç붢YhÂ)à[a¢è!¶»-Æ޶׫jëh×6#include <misc.au3>
while 1
Sleep(100) ; Always sleep loops
If _IsPressed("10") And _IsPressed("4E") Then
send ("{MEDIA_NEXT}")
EndIf
WEnd

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...