Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Thu Nov 21, 2024 7:39 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: iTunes remote
Thanked: 1 time(s)  Unread post Posted: Fri Nov 23, 2012 9:36 am 
Lifetime VIP Contributor
Lifetime VIP Contributor
User avatar



Joined: Tue Nov 23, 2010 10:51 am
Posts: 213
Location: Pandora
Been thanked: 101 time(s)
Has thanked: 66 time(s)
Contribution Points: 8650
in case your keyboard does not have media control keys, this will send commands to iTunes.

left control + right = next song
left control + left = previous song
left control + up = volume up
left control + down = volume down
left control + space = pause/play or start iTunes... it does not start playing automatically yet i may try again later
hold control after a direction = repeat

i may try to get it working better or clean up the code, anyway it covers the basics for now. set start trigger to {<lcontrolkey>}
Code:
 begin
     Keyboard.Suppress keys("{<left>}{<right>}{<up>}{<down>}{<space>}")
     // keep this lower than repeat_search_pause
     Variable.Set("milliseconds_to_wait", "10")
     // ms to hold the key
     Variable.Set("hold_pause", "1")
     // detection interval
     Variable.Set("repeat_search_pause", "50")
     // how long until it repeats command if control held
     Variable.Set("repeat_key_pause", "1500")
     // time to wait after starting iTunes and playing first song
     Variable.Set("start_wait", "2000")
     if  Variable.Does not exist("time")
          begin
               Macro.Start stopwatch("last_pressed")
          end
     if  Window.Is running("iTunes", "yes")
          begin
               Variable.Set("running", "yes")
          end
     Keyboard.Get last key press("key")
     if  Variable.Is equal to("key", "left")
          and
          Variable.Exists("running")
          begin
               Window.Send hold keys("iTunes", "yes", "0", "{<rcontrolkey>}")
               Window.Send hold keys("iTunes", "yes", "0", "{<left>}")
               Macro.Pause("{hold_pause}")
               Window.Send release keys("iTunes", "yes", "0", "{<left>}")
               Window.Send release keys("iTunes", "yes", "0", "{<rcontrolkey>}")
               Keyboard.Unsuppress keys("{<left>}{<right>}{<up>}{<down>}{<space>}")
               Macro.Pause("{repeat_key_pause}")
          end
     if  Variable.Is equal to("key", "right")
          and
          Variable.Exists("running")
          begin
               Window.Send hold keys("iTunes", "yes", "0", "{<rcontrolkey>}")
               Window.Send hold keys("iTunes", "yes", "0", "{<right>}")
               Macro.Pause("{hold_pause}")
               Window.Send release keys("iTunes", "yes", "0", "{<right>}")
               Window.Send release keys("iTunes", "yes", "0", "{<rcontrolkey>}")
               Keyboard.Unsuppress keys("{<left>}{<right>}{<up>}{<down>}{<space>}")
               Macro.Pause("{repeat_key_pause}")
          end
     if  Variable.Is equal to("key", "up")
          and
          Variable.Exists("running")
          begin
               Window.Send hold keys("iTunes", "yes", "0", "{<rcontrolkey>}")
               Window.Send hold keys("iTunes", "yes", "0", "{<up>}")
               Macro.Pause("{hold_pause}")
               Window.Send release keys("iTunes", "yes", "0", "{<up>}")
               Window.Send release keys("iTunes", "yes", "0", "{<rcontrolkey>}")
               Keyboard.Unsuppress keys("{<left>}{<right>}{<up>}{<down>}{<space>}")
               Macro.Pause("{repeat_key_pause}")
          end
     if  Variable.Is equal to("key", "down")
          and
          Variable.Exists("running")
          begin
               Window.Send hold keys("iTunes", "yes", "0", "{<rcontrolkey>}")
               Window.Send hold keys("iTunes", "yes", "0", "{<down>}")
               Macro.Pause("{hold_pause}")
               Window.Send release keys("iTunes", "yes", "0", "{<down>}")
               Window.Send release keys("iTunes", "yes", "0", "{<rcontrolkey>}")
               Keyboard.Unsuppress keys("{<left>}{<right>}{<up>}{<down>}{<space>}")
               Macro.Pause("{repeat_key_pause}")
          end
     if  Variable.Is equal to("key", "space")
          begin
               Keyboard.Suppress keys("{<lcontrolkey>}")
               if  Variable.Does not exist("running")
                    begin
                         System.Launch application ("iTunes", "no")
                         Keyboard.Unsuppress keys("{<left>}{<right>}{<up>}{<down>}{<space>}")
                         Macro.Pause("{start_wait}")
                         Window.Minimize("iTunes", "yes")
                         Macro.Pause("400")
                         Window.Send hold keys("iTunes", "yes", "0", "{<rcontrolkey>}")
                         Window.Send hold keys("iTunes", "yes", "0", "{<right>}")
                         Macro.Pause("{hold_pause}")
                         Window.Send release keys("iTunes", "yes", "0", "{<right>}")
                         Window.Send release keys("iTunes", "yes", "0", "{<rcontrolkey>}")
                         Macro.Pause("30")
                         Window.Send hold keys("iTunes", "yes", "0", "{<space>}")
                         Macro.Pause("{hold_pause}")
                         Window.Send release keys("iTunes", "yes", "0", "{<space>}")
                         Macro.Pause("{hold_pause}")
                         Window.Send hold keys("iTunes", "yes", "0", "{<space>}")
                         Macro.Pause("{hold_pause}")
                         Window.Send release keys("iTunes", "yes", "0", "{<space>}")
                         Macro.Pause("{hold_pause}")
                    end
               Window.Send hold keys("iTunes", "yes", "0", "{<space>}")
               Macro.Pause("{hold_pause}")
               Window.Send release keys("iTunes", "yes", "0", "{<space>}")
               Keyboard.Unsuppress keys("{<left>}{<right>}{<up>}{<down>}{<space>}")
               Macro.Pause("{repeat_key_pause}")
               Keyboard.Unsuppress keys("{<lcontrolkey>}")
          end
     if  Keyboard.Key is held down("{<lcontrolkey>}")
          begin
               Macro.Restart stopwatch("last_pressed")
          end
     Macro.Read stopwatch("last_pressed", "time")
     if  Variable.Is equal to("key", "{<lcontrolkey>}")
          or
          Variable.Is less than (Math)("time", "{milliseconds_to_wait}")
          begin
               Function.Execute("restart")
          end
     Function.Execute("stop")
 end

function("restart")
     begin
          Macro.Pause("{repeat_search_pause}")
          Macro.Restart("no")
     end
function

function("stop")
     begin
          Keyboard.Unsuppress keys("{<left>}{<right>}{<up>}{<down>}{<space>}")
          Macro.Abort()
     end
function
 


Top
 Profile  
Reply with quote  
 Post subject: Re: iTunes remote
Thanked: 0 time(s)  Unread post Posted: Tue Jan 22, 2013 12:27 pm 
Silver Contributor
Silver Contributor
User avatar



Joined: Thu Jun 14, 2012 9:23 am
Posts: 122
Been thanked: 15 time(s)
Has thanked: 6 time(s)
Contribution Points: 310
omg never thought that BE-M would work with iTunes

This is so good

Thank you very much for sharing this

_________________
Blue Eye White Dragon

Oops! Blue Eye - Macro

YAY!

View my "Dragonsaga bots archive" here : viewtopic.php?f=243&t=13883

If you find this usefull, just simply press "Thank You" -------------------------------------------------------------------------------------------------------------------->


Top
 Profile  
Reply with quote  
 Post subject: Re: iTunes remote
Thanked: 0 time(s)  Unread post Posted: Tue Jan 22, 2013 12:30 pm 
Contributor
Contributor
User avatar



Joined: Sat Jan 12, 2013 12:06 pm
Posts: 54
Been thanked: 0 time(s)
Has thanked: 0 time(s)
Contribution Points: 25
if this work it will be nice..
wanna try it right now :D :D :D
thx anyway :D :D :D


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group