[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)
Can someone help please with the following .sh script:

Code:
#!/bin/bash

/usr/bin/osascript <<-EOF

      tell application "System Events"
    if process "iTunes" exists then
        set okflag to true --iTunes is running
    else
        set okflag to false
    end if
end tell

if okflag is true then
    
    tell application "iTunes"
        
        set currentvolume to the sound volume
        if player state is playing then
            repeat
                --Fade down    
                repeat with i from currentvolume to 0 by -1 --try by -4 on slower Macs
                    set the sound volume to i
                    delay 0.01 -- Adjust this to change fadeout duration (delete this line on slower Macs)
                end repeat
                pause
                --Restore original volume
                set the sound volume to currentvolume
                exit repeat
            end repeat
        else -- if player state is paused then
            
            set the sound volume to 0 --2007-03-20 script update to fix startup glitch
            play
            
            -- tell application "System Events" to set visible of process "iTunes" to false
            
            -- reveal current track
            
            repeat with j from 0 to currentvolume by 1 --try by 4 on slower Macs
                set the sound volume to j
                delay 0.01 -- Adjust this to change fadeout duration (delete this line on slower Macs)    
            end repeat
        end if
    end tell
end if

EOF

This one worked with the original callbacks 0.5 but not with callbacks2. I get the following errors:

Image
Image
Reply


Messages In This Thread
Great! - by gnorf - 2013-02-27, 22:50
[RELEASE] Pilulli Revisited - by KenV99 - 2014-06-28, 18:18
RE: [RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...) - by bigbadrabbit - 2015-01-02, 20:57
Logout Mark Read Team Forum Stats Members Help
[RELEASE] Execute user scripts on specific XBMC actions (play starts/stops...)4