• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Can't make QuickTime Player 7 Pro auto quit on finishing playing a track
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can't make QuickTime Player 7 Pro auto quit on finishing playing a track


  • Subject: Can't make QuickTime Player 7 Pro auto quit on finishing playing a track
  • From: ILJA SHEBALIN <email@hidden>
  • Date: Sat, 3 Jun 2017 22:40:59 +0300

Hello again,

Some time ago I wrote a script based on another example script in the book I'm learning AS from. The script wakes me up by playing a chosen track at a set time. A player app is QuickTime Player, but since I love QuickTime Player 7 Pro more I use the latter in the script for opening files to play. Everything's fine - it counts the time remaining until the time to wake me up and all that jazz, opens a file and plays it - except one thing: I want the app to quit it having finished to play the audio file (document or movie, as put in the app's Dictionary - both are interchangeable synonyms) but can't. When it finishes playing the file the app is still running and the frontmost window stays open. Here's a snippet of my script which is a pared down version  (I omitted setting date and time lines of the code and other related stuff). See my comments for additional details. Remove the hash signs to make an appropriate line of your choice in the code below active). What can I do about that? 

The script:

property wakeup_tune: missing value
property song_name : missing value --not sure of its necessity



repeat
set wakeup_tune to choose file with prompt "CHOOSE AUDIO FILE" of type {"public.audio"} default location alias "(*any folder that you locate the audio file in*)"
set wakeup_tune to wakeup_tune as text
tell application "Finder" to set song_name to name of file wakeup_tune
end repeat


set VolumePrompt to display dialog "Enter volume value" & return & return & "Any integer between 0 (min) and 256 (max)" default answer "" --smth not very explicitly clear. In the dictionary values that "sound volume" can hold are described as follows: "sound volume (integer) : the sound volume of the movie (0..384), where 256 is 100%". if 256 is 100% then how 384 came up?
set EnteredVolume to text returned of VolumePrompt as integer



tell application id "com.apple.quicktimeplayer" --"QuickTime Player 7" makes no difference. 
activate
open file wakeup_tune

#set quit when done to true --shows error 1708 when placed here

tell document named song_name
set track_time to (get duration) --in the app's Dictionary the "duration" property is described as an integer value without specifying measurement units (sec, ms, what?) and returns incomprehensible values: in my case the duration of 1:08.06 (1 min 8 sec 6 ms) of a chosen file transformed into 46840. I don't know what that means. Too small for ms either since for that figure it should be 78060 ms so I'm mystified.  


set sound volume to EnteredVolume
play

#set quit when done to true --no effect

#set close when done to true --takes effect by closing the frontmost window with the document been played but leaves the app running.

end tell
delay track_time --was meant to let the script make the document play before quitting the app. No need of this line when using "quit when done" property but (IMPORTANT!) in absence of the latter it's needed since "quit" command quits the app before the document been played and it's the only way of actually auto quitting the app (i.e. no "quitting when done" and "delay track_time" in the script: undesired). 
#set quit when done to true --shows error 1708 when placed here.
#set auto quit when done to true --no effect
#quit --no effect
end tell


 


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Can't make QuickTime Player 7 Pro auto quit on finishing playing a track
      • From: David Gregg <email@hidden>
  • Prev by Date: Re: oddities with a Mail rule & Numbers
  • Next by Date: Re: Can't make QuickTime Player 7 Pro auto quit on finishing playing a track
  • Previous by thread: Re: oddities with a Mail rule & Numbers
  • Next by thread: Re: Can't make QuickTime Player 7 Pro auto quit on finishing playing a track
  • Index(es):
    • Date
    • Thread