WWDC2004 Session 723
Transcript
Kind: captions Language: en [Applause] pardon me a second I'm going to do a little housecleaning this machine gets video to the one I'm presenting on we've sets that up because otherwise I can present and tell you what it looks like to me yes right here on this side DBI do you need the adapter okay I'm South to going on the Apple script product manager and while we're working that out I just want to thank you for coming in here today and spending some time with Ryan Lynch and myself the meeting of Apple scripting QuickTime has always been an incredibly fertile ground for creating very productive tools we first back in QuickTime 4 with the first time we had a scriptable dictionary in the QuickTime Player and since then the dictionary within quicktime has grown and grown and grown and and you can been able to do more and more and that growth is going to continue with Tiger you're going to see even more script ability in QuickTime more accessibility to QuickTime built into Apple script itself and also into the QuickTime architecture as well and we're very excited about that because the last thing you should have to do is some repetitive thing over and over again like setting annotations to movies it should always be an easy process and now with the introduction of Automator it's going to be even easier so while Ryan and I have been skating on the thin ice of a preview release we've still managed to cobble together some things to give you a window into what's coming up for you to take advantage of and so today I'm going to spend a little bit of time first of all showing you what you have what tools you have for QuickTime and AppleScript existing where you can get them what they can do for you already so that you can start if you're new to the world of Apple's in QuickTime you can start using these right away to familiarize yourself with some of the potential that these two technologies have together then we're going to show you some previews of what's possible in the future and Ryan and I are going to do some demos involving the Automator application and QuickTime the two were just made for each other it's really incredible so let's see how close am I to having video over here then okay then what is this demo machine right here that's me okay well let me show you first of all we'll go to we'll start with this I'm going to go to dub dub dub AppleScript comm we own that site this is the main Apple script page and this if you're interested in Apple script at all this is a great place to get started this is where you want to go first because it contains a lot of resources from this site but it also points you to other locations that have information one of the pages in particular of interest to QuickTime if you click the applications link here in the middle this little toolbar nav nav bar you'll see that we have links to some of the scriptable applications in the OS one of which is the QuickTime Player and I'll click that and it takes you to the QuickTime Player page within the Apple script website and on this page we've posted hundreds of scripts and examples and we've listed them all here there's example adding annotations creating streams there's hundreds of athletes and droplets setting your playback properties and then there's a set of screen menu scripts that it's about a hunt 50 of those and all of these you can download as a collection by just clicking that link right there and I'd like to show you that as soon as I get some video on this machine thank you when I take a question any questions no any complaints perhaps you feel you've been treated unfairly yes can we turn the lights down a little bit they like it intimate and cozy this is a very productive crowd yes the question is will there be ability to modify the workflows created by the Automator application if the person who created that workflow enables you to do that yes you can open them back up into Automator and change whatever parameters you want and if you're the person that's writing the Automator actions yourself then you can determine whether you want to release those with the code open that people can go in and mess with your widgets if you want to we're very excited about it looks like there's a lot of people waiting to develop these kind of things any other questions do I see card tricks I'm not nervous today let me tell you after doing the keynote nothing can bother me I could have a herd of wildebeests running straight at my nose and I wouldn't flinch okay well maybe I would I don't know what kind of network they have here but holy cow okay well I'm going to start demoing while they're doing that off of this machine I'll just copy these things so this is the QuickTime scripts collection from the website and I'm going to walk you through some of the of these scripts and what they can do for you hmm okay I can't work unless I can see the hard drive that's much better where did it go oh it is okay let's switch to that then we're switching to this laptop well we're okay this is it great thank you so you go to the that website you download this collection of scripts you get the QuickTime scripts collection now these scripts were written some of them have been written they've been added to over the years originally began with QuickTime 4 and it covers a large amount of the basic functionality that you need to deal with QuickTime one of the sections in there involves applets and droplets these are the kind of scripts that you can drag items on to you can take folders of movies and drag these onto these droplets and they will do some kind of processing whether it's setting annotation setting the hint setting the URL of a movie they're really great tools for just quick drag-and-drop the QuickTime scripts collection over here QuickTime Player scripts those are meant to be launched from a script menu and by default in Mac OS 10 you have a script menu that's located you can activate it via your Applications folder then your Apple script folder within that application folder and then you can use the Apple script utility in Tiger to enable that there's also in Panther another application called start script menu which would do the same thing once that has been activated once the script menu has been activated then the script menu will appear here in the top menu and when you are within the QuickTime Player application you can choose to create a folder of QuickTime Player scripts and then place those scripts from the collection in here and they will be available from within the QuickTime Player so I'm going to show you a couple of those to begin with let me start by opening up a little sample movie here have a little bit audio thank you and I think I'm threat does this appear it feels correct they're here it's like looking like this so here's an example of why you would want to use Apple script so I have a movie here and I want to add a chapter track any of those that are have ever done building at raptor track in the movie know what an involved process it really is to create that particular kind of text file with a certain set of codes and then to indicate where you want it to begin and end well with Apple script it's become a really easy process I'll just go to the script menu and my QuickTime Player scripts are here and one of the sections is chapters I'll choose create chapter track and it asked me what track I want to bind the chapters to the audio or video I'll choose video and you can see that instantly it creates the chapter track for me then if I want to add a chapter at a certain point I can just drag the cursor to that particular point and choose add chapter at the current time and let's give it a name well we'll give it something very creative like first chapter first to pop up I plan to Mohammed Mohammed aha and then you can see that it automatically adds that so I have the start and I have the first chapter and then I'll go over here and I'll go back to the chapter I'll choose another one I'll add another chapter the current time and we'll call this second chapter and now I have a start chapter a first chapter and a second chapter a very easy process to do because you let AppleScript do all the heavy lifting for you it does all the process it talks directly to the application and creates the chapter and can edit it on the fly that would take you quite a while to do by hand with Apple script it's very and you can go back in and edit them I could go back and say delete a chapter choose the chapter I want to delete and now the first chapter is gone from the list simple example could save you a lot of time in annotating and chapter in a movie there's one example of what you can do with Apple script in QuickTime let's take a look at another one let's take a look at some of the applets and droplets and let's start with this one now this particular script is called the limited annotations droplet and what it does is it'll put in three annotations into your movie all you have to do is go into the comments field in the Finder window for that particular droplet and set in your annotations you put the name of the annotation a colon and then its value and when the droplet is run it will automatically read from its own comments field and apply those so let me show you I'll take the sample movie that I just had and I'll drag it on to this droplet okay now I'll open back up my sample movie stop and you can see that it added the annotations in for me automatically now seems like a small thing but if if that's something that you do all the time with your content being able to do 150 of those and have a doughnut is a great thing it saves time it saves money now you'll notice that this movie is also set to auto play well as soon as it opened it started playing right well there are some playback properties in QuickTime that aren't really exposed to the UI did you know that a movie can automatically close when it's done or it can automatically quit the cook time player or it can automatically self present full screen you can set these properties yourself but nowhere in the UI of the application currently can you do that and so we'll go over here to the applets and droplets and we'll open up the folder called playback properties now these particular droplets all set some some individual playback property so the first one here is called reset playback properties if I double click it it will tell you what it does this script will set autoplay close when done Auto close when done quit when done Auto quit with done in Auto present false presentation size to normal and presentation mode to movies so if you just want to reset a movie back to normal condition that does it so now when I open up this movie it doesn't autoplay so if I want to set a group of movies to automatically play then I could determine I can set them to right here the autoplay property this particular script will set the autoplay you can set the preference to whatever you like currently it's set to enabled so now I'll drag the movie back on to the script and now go play so it auto plays I can also set the I'll save it as a presentation file and that will set the automatically closed when done and automatically self present so now when the user double clicks the file [Music] itself presents and then closes automatically the user doesn't know how does it need to know how to use the QuickTime Player and that's a property that's only settable via Apple script be it with an interface now that might come in useful in this kind of a scenario if we go back to our QuickTime scripts folder there is a folder called example files and within there there's a Help Center example and I'm going to open that and this has a movie in the help page and the URL of this movie has been set to self present move which is a movie within the same folder as the file and the target key is QuickTime Player it is also set to auto present and auto close so if a user of your product is reading the help information and you have in addition a nice full screen movie that describes that particular question that you're trying to have answered they can just click some link in that page and the movie goes plays full screen and when it's done cleans up after itself and all of that can be set with Apple script in QuickTime here's a very simple example of how it can be useful in the real world another example of using AppleScript is with droplets and droplets is media skins has anybody done media skins a couple why hasn't anybody else on media skins probably because it's a very involved process right well let's take a look at how Apple Script can make that process a little bit simpler here's an example I have a movie here called plane very exciting plane okay and I would like that movie to appear well you can't use okay appear within that queue with inside the queue I want the plane to fly through the queue well that's exactly what QuickTime can do it has that incredible ability with media skins to do it but it's a really long process so what I'm going to do is make this an easy process I'm going to use this droplet called apply media skin droplet and I'll just drag the plane on to that and let's watch what happens it's going to check and then it's going to ask where do you want it place your finished product I'll put it on the desktop and I've left this droplet showing you each step of what it's going to do so you can see how long and involved the process is if you take out these dialogues that happens very quickly so it's going to open the media skin background file it's going to add that into the movie then it's going to position it to the back and it's going to make it transparent is going to position the movie into position save a copy of that and it's going to close that then it's going to write an XML file describing how the media skin should be done then it's going to open up that XML file it's a new movie then it's going to apply the playback settings then it's going to save that particular thing as a self-contained entity and then it's going to clean up after itself so now thank you so now let's play the same movie it's set for autoplay now how to take advantage of a really cool technology with a single drag and drop that's the power of Apple script and quick time together that's what we're all about also within the the QuickTime scripts folder I'm going to take you to another little example are some example files folder and within that there are some examples of the code that you need to do this what does what do the scripts actually look like that can do this and what level of control do they offer well one of the examples that I had open but I don't have open now open this one it's called typewriter text movie I'm just going to run this one it's going to switch to the QuickTime Player create a brand new movie and it's going to add frames yes you have total control over frame level you can control the contents of frame you can control the position of objects within the frame you can control frame duration can control tracks you can control the movie can control the audio just about every aspect of a movie has been exposed too quick to QuickTime and Apple script so this movie wasn't created entirely with that script by generating frames on-the-fly that's the level of granularity that you have with Apple script and QuickTime as a matter of fact let's take a look at some of the text process some of the text frame properties we're going to run this one this is the one of the example scripts and this will show you the kind of properties you have over a frame default font while Chicago's not installed me is charcoal courier times Geneva you can control the default font size so this is not a movie this is Apple script talking to a frame in a movie file lie it's interacting with the player it's not a pre done movie so you can control justification you can change the foreground color green blue you can change the background color I should change the blue type to white huh red text on blue so you can change both of them together yellow text on black you can control anti-aliasing tease key text as well all of that is controllable that's the level of control that you have with Apple script in QuickTime you can really get to a very fine point in your scripts now to write these kind of scripts yourself what's involved okay yes I'll show you some also within that folder are some script templates there are tracks syntax examples and each one of these scripts will show you how to do a particular example like adding a frame to the start of a text track adding an image track adding text from data from a data item adding text from a list on disk then there are also some template examples here where are they favorites helps frame example slideshows chapter examples of script templates are down here and these are pre done scripts that you can add your particular actions to for example if you want to create a QuickTime droplet all you have to do is open up this template and then it'll tell you right here you place your own particular script statements there and the rest of it is already pre done for you to handle determining whether the user actually dragged on a movie file determining whether it's a folder of stuff and then iterating through each item in the folder all you have to do is open this template put your particular lines of Apple script in there save it and then it will become a droplet that you can use just like the other QuickTime applets and droplets and there's a whole set of them there for working with tear out the player tracks text tracks movie templates and video tracks as well all of that's available today all of these scripts and all of these examples you can get right from the Apple script site by downloading the QuickTime collection now here's a tip I've been using the quicktime player from Panther on this version of tiger that I have installed the version of the QuickTime Player and Tiger is a little flaky so copy your Panther one drop it into there and you'll be able to use these scripts while you're working on Tiger we're not going to ship the thing broking I mean they will fix it eventually but the version that you have right now you'll need the Panther player so that's the world of that's a couple examples of what QuickTime can do right now this is stuff that you can go get today now the next thing that we want to look at is where we're going in the future with QuickTime and Apple script and you got a little bit of a glimpse of that how many of you saw the keynote was that good look at I'm sick I generated down into like you know begging for applause holy cow that's as low as you can possibly go okay yes as you can tell you know Steve was very excited by Automator so am i it's a phenomenal technology that we're working on you got to see a preview of it and there's a preview of it installed on your developer disk as well and what Automator does is it provides an interface above and beyond what the normal droplet kind of thing where you have these little dialogues now it's made into where you can take the result of one action or one script and pass it to the next because you might have a group of movies that you want to set the playback properties for right you might want to be able to browse a whole group of movies you might want to be able to set the URL for a group of movies and Automator lets you do that so I'm going to show you a simple Automator action here I launched it I like the guy the fact that guy bounces blink-blink ensure bouncing and this is Automator in case you didn't see it before let me quickly describe the interface it's very simple on the left hand side here our category buttons and these represent the kind of actions that you would normally want to do with your computer like find things work with disk items communicate with the user of the computer and when you click a category button in the list below here all of the actions related to that category appear in this action list when you select one of those actions its description will appear down here in the description field and it will tell you basically what the action does if it has any things that it needs and then when you want to use the action you can just drag it right over into the workflow area and the action will appear here and you can set any kind of parameters that you want for that particular action and you put any preferences that it has appears here and it's real easy just to link these things together and create an entire workflow and then just run the workflow when you're done for example let's say that I have a lot of movies that I want to set some basic playback properties on them well to do that I'm just going to open up folder here of my favorites which movies let's see I'll grab a bunch of these I'm going to drag them into the workflow area and just let go the act of me doing that will automatically create a new action this is an action with those files that I just specified they're added to this action called get specified files the result of this action will just be a list of those files to the next action and then once I've dragged those in there then I can click my movies category over here and I have an action here that says set movie playback properties this action will set the playback properties of the past movie files the settable playback properties include auto play auto close when done not equipment done present it Otto present is active to play back sides of the movie will be chosen so let's add that to my thing I'll give it a double click and then I could say I want these movies just to autoplay and not set there anything other than just that particular property now I can then say all right click run up that ain't going to work because that's the wrong player well it's going to attempt and the nice thing is I don't have to do this it's doing it for me okay and it tells me here at the bottom that it's completed and what happened to my movie folder go back here movies switch movies and I think Qbert was one of them Audio audio on this laptop jano audio that's right again so that's now set to auto play there's a matter of fact that I can then to go back here to my existing workflow and I could say all right well I'd also like to have them automatically close when they're done and as long as you're at it have them present fullscreen and let's say hold on a second this is where that's the wrong one let's quit this guy and open up this one it's my Panther okay now I can run it so let's run our workflow again I mean anybody can use this I love uh lending in and then and then and we need an audio for Dunning in and then and then and then and then and then and then and then in and in and in that or a little Jetson think that's done and that's that's been in it okay now we'll go back to our thing and select one of the tracks like Qbert again up right into it hang on Qbert DJ it should have said it
- oh I didn't set to present sorry okay
what I'm going to do is select couple these and delete those so I have to go again let's run this and then one okay the execution has been done now I can go back to Qbert do I have audio on this laptop at all well the players not playing it and it's what you're saying okay now let's see if it will automatically quit once the commercials done his mom's going I can't believe he did a nationwide TV that's what moms think about and it automatically closes when done so setting the properties of a movie using Automator is a very easy process drag them in add the actions in after it and there you go it's a matter of fact you can do a lot of things with it you could set the movie annotations and then you can browse the movies I'm going to add movie annotations here and I'm going to have it delete existing annotations let's choose artist here or let's say copyright and we'll have option a copyright Apple Computer 2004 and we'll have it do that and then when we're done we're going to have it browse the movies for us as well and go so just be a couple now can you imagine this with compressing with sharpening so now we'll let you browse the movies in this wonderful little web interface and then you can click the next one I'm panted this draws very fast so it was very easy for us to be able to use Automator to do basic production actions with the QuickTime Player and this is the power that's coming to you when we develop this product the next thing is taking this same kind of idea of having the ease of creating a workflow and taking it to the next level of being able to control this machine and other machines that are involved in QuickTime production and one of the tools that is used is the QuickTime broadcaster and this is where Ryan is going to come in handy with this whole thing and we're going to show you how we used the Automator to automate using the QuickTime broadcaster to control the actions of a remote computer whoo okay Ryan take it away excellent okay let me exterior video here if you don't mind okay so slim here we only have one video yeah okay so just this mental note - all right tricky little bastards okay here we go so we thought it'd be kind of fun to figure out a way to control broadcaster because it's a really scriptable application and with Automator you get a lot of a lot of power can I have this laptop please maybe is it not happy okay excellent excellent so we wrote a few little stages slash action actions whatever to to take care of deal with broadcaster so you know creating settings is not that great so let's let's consolidate it into a nice the interface here and set up a broadcast so 256 192 standard 20 fits we like keyframes they're good me oh and let's just broadcast to myself shall we or to a server I have even so that's great okay what am I doing with this well this action actually is just going to create a settings file it doesn't do much for you so I can write that out to a text a new text file and we'll call this settings if I could spell boom so we're complete well what did it do on my desktop I have this setting little settings file which I can here we go and me as you see it says all my settings are loaded into QuickTime broadcaster with my server and everything that's great but it doesn't do much for me I want to take this and actually make it work so what I decided to do is I'm going to take this file that I just created and automatically broadcast it over to Sal's machine have him start broadcasting for me and actually so you can control a remote broadcaster over wireless except I need your IP address okay now nobody else you muck with this right now I'm going to give my IP address I don't see any other weird messages coming in because I know how you are it's 17.21 o dot 65.1 for one I'm going to bling-bling because I can't see it there it is 17.21 o dot 65.1 for okay so now I on my machine I've made sure that I have program linking turned on under the sharing preferences there is an option for remote Apple events and I have enabled that we have him on my machine as a user those are two requirements that you need in order to be able to control my machine remotely using Apple events go ahead okay so we have a a digital action yeah okay so yeah instead of sending to a text file we've got a nifty little app excellent okay we have a nifty little action we created called initiate remote broadcast which was at the top of the list because it's the most relevant item to follow the one that I just create and just added to the my workflow Cobo okay so I'm going to put in Sal's IP address because we have the remote machine here which he just gave me we're going to call my broadcast settings file broadcast why not and I automatically wanted to start broadcasting so let's let that run and see what happens I got a we have to login to his machine with a user that we are to have it on that machine and today I'm Trudy so what it's doing is it's logging in writing to the desktop the broadcast file that I just created launching broadcaster with that file and hopefully starting the broadcast hang on erode it and broadcaster keeps quitting on me but that's okay let me show you from my computer there it is so it's actually doing it right now you had kicked in it just took a little delay okay so you can see that it is broadcasting from this camera there is the file and there's the crash oh but even better let's I think I did work it actually controlled my machine from his computer wrote the broadcast settings to my desktop open it up with a QuickTime broadcaster initiated the broadcasted it worked for a little while that's not too bad remember this is all you know introductory stuff you're peering at the future here that was good yeah appearing in the future okay so excellent so that's great that's one of the wonderful applications that we have in the world of QuickTime that actually is really scriptable a new one that we have coming up yeah okay a new one that we have coming up with with Tiger is going to be QuickTime streaming server publisher and we have a new Rev with that but you actually have shipping in your the disk because you have today and we've added some script ability so we thought thought it would be a little fun to to do something with that so I'm going to upload some files to the server create a playlist with those files our stuff loaded and automatically start that playlist broadcasting yes so I've got one nifty file here on my desktop great so you just drag that in to get to specified stages right exactly okay and then I'm going to upload the publisher so I've got my nifty IP address oops that's supposed to be bullets well I forgot forgot to ask him how to do how to do the bullets in the text field oh girl I knew I didn't act pipe with other stuff sorry Ryan it's alright oh we're bouncing what does this mean so let's go look at net to see what's happening it's logging in and look it's uploading our file for us and uploading our file for us I think you have to go connect or something right it's already connected oh really it's already uploading okay I think that was it but it's hanging I think I have a corrupt file oh not is that making progress we need a percentage thing here okay this up trading this into you you I feedback for how come it's not saying like ten percent or something just to let me know hmm oh it's still uploading anyway so it does work really if I had some more files however let's try it with this we have so you if you don't want to just upload movies say you've got some some vials in iTunes some music songs that you want to upload and do it that way so let's try that shall we so we have this neat little thing in music we've got this action said get a plan I think you're still going there for the the previous one alright stop you might have to just use a new workflow for right now uh-oh yeah you're better off just yeah okay okay that that'll clear it out well that definitely will work yeah yeah definitely clear it out force okay all right now you like our icon and they cool these are important things so here we go back to this so we've got the we want to get the playlist tracks from iTunes let's let me choose a playlist I have here a music for streaming that sounds nifty I'm going to get the file tracks and this actually if you notice at the bottom here delivers an iTunes track so it's actually a path to the iTunes track within the program actually it's a reference to the iTunes tracked object which you don't need to know about why because Automator will handle it for you but it automatically figures out that what I require is a file or a folder converts the output of the last action into what I need for this action so I'm going to do simple conversion the note was there did you okay and now you all know my name and password on this machine call this iTunes and run so these are C data conversion completed here logging in I'm going to get progress bar here it's having a hard time transferring things well it's trying again but it's transferring up my MP mp4 audio AAC audio up to the server and it will create a playlist eventually and add this to the playlist so you can automate this and it's quite easily we have a also the option to automatic an save this and ask when it's run so that when you save this whole workflow as a script you can actually access this by an iCal event or something else and automatically have this pop up and create your own playlist on demand without having to go through all these steps another workflow or setting up your own Apple script later on so this is the power of Automator yes is that interesting thank you yeah you can see where we're going with this you're you're catching it just leave that ready so you're catching this a really early stage but isn't the whole idea behind automation the fact that you should just be working with what you want to do and not have to deal with the intricacies of how to do that and that's the beauty of what Automator can do as you've seen before as you saw initially Apple script can automate things but now this takes it to the next level to where you're just saying I want to do this task then that task then this task and go do it for me and even if that task involves communicating to a machine across the network you don't have to deal with all the other things that are involved with it so this is where we're taking QuickTime and Apple script together in the future we're very excited about Automator and the new versions of QuickTime that's coming out there's also one more thing I wanted to show you about are you running Tiger Here I am could just leave it all right I want to show you one more thing about Apple script in QuickTime and it is this so we're very focused on Apple scripted giving you access to the various components in the operating system and I'm in the script editor application right now this is located within your app hold Kate Applications folder apple script and I've opened up the library window which you can also get from the window menu and within the library window we keep a list of some of the favorite applications that you might want to access their scripting dictionaries and one of the applications is called system events this is an invisible process that runs in the background that controls a lot of what's done with with Apple script and you can see that it has a rather extensive dictionary I just want to point out that it now has a new XML suite for reading and writing XML stuff yay and it also has a whereas QuickTime file suite and let's take a look at this and show you what what is available there this will this particular suite will allow you to access information about QuickTime media files without having to use the QuickTime Player you can just ask the question or get the properties of it and as you can see there's a class of object called annotation because that's a common thing that people want to do they want to be able to get information about the movies that they're working with you can also see that QuickTime data has basically you know your core thinks about presentation size presentation mode is it a storage stream what's the time scale is it set for auto quit when done is that it set to automatically play and you can see that there's also other information about the contents of the file and information about QuickTime tracks and all the data about tracks QuickTime tracks as well so this will this particular set of this particular set of commands in the in QuickTime file suite will be really great for just getting quick information and setting quick information about QuickTime media files without having to rely on the player in the future so this is coming up for you in tiger as well well that's what we have for you today I will be glad to stand here and take some questions about this and any of your ideas thank you you