1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Applescript: how to tell if iTunes is paused

Discussion in 'Mac Programming' started by sammich, May 25, 2009.

  1. macrumors 601


    I can get iTunes to give me the player state, it will give me a string like <constant ****kPS#>, where # is "p" for paused, "P" for playing, and "S" for stopped.

    This should be cake:

    set thechar to character 18 of (player state)
    if thechar is equal to "p" then set ispaused to true
    Now I discover AS is more or less case-blind/insensitive. Is there a way I can do this?
  2. macrumors 6502a

    I'm not entirely sure what it is you are asking..but here is how I used Applescript to check if iTunes was paused. It works without any issues..

    tell application "iTunes"
    		set whatshappening to (get player state as string)
    	end try
    	if whatshappening = "paused" then
    		return "its paused"
    	end if
    end tell

Share This Page