text
stringlengths
0
15.7k
source
stringlengths
6
112
tell application "iTunes" to launch
lns3.scpt
set thesePlaylistTitles to the name of every user playlist
lns3.scpt
set the beginning of thesePlaylistTitles to "USE MUSIC LIBRARY"
lns3.scpt
set chosenPlaylistTitle to ¬
lns3.scpt
(choose from list thesePlaylistTitles with prompt "Choose the playlist to use:")
lns3.scpt
if chosenPlaylistTitle is false then tell me to quit
lns3.scpt
set chosenPlaylistTitle to chosenPlaylistTitle as string
lns3.scpt
if chosenPlaylistTitle is "USE MUSIC LIBRARY" then
lns3.scpt
set playlistTitle to missing value
lns3.scpt
set playlistTitle to chosenPlaylistTitle
lns3.scpt
set hasPlayed to false
lns3.scpt
display dialog "Applet is active and ready for presentation to begin!" buttons {"Switch to Keynote", "OK"} default button 2
lns3.scpt
if button returned of the result is "Switch to Keynote" then
lns3.scpt
set startFlag to true
lns3.scpt
set startFlag to false
lns3.scpt
if startFlag is true then
lns3.scpt
if running of application "Keynote" is true then
lns3.scpt
if playing is true then
lns3.scpt
set hasPlayed to true
lns3.scpt
set trackTitle to the presenter notes of current slide of front document
lns3.scpt
if trackTitle is "" then
lns3.scpt
my stopPlaying()
lns3.scpt
my playThisTrack(trackTitle, missing value)
lns3.scpt
if hasPlayed is true then
lns3.scpt
say "Keynote is not open. Quiting applet."
lns3.scpt
say "iTunes is not open. Quiting applet."
lns3.scpt
return idleTimeInSeconds
lns3.scpt
on playThisTrack(trackTitle, playlistTitle)
lns3.scpt
if running of application "iTunes" is true then
lns3.scpt
if player state is playing then
lns3.scpt
if the name of current track is not trackTitle then
lns3.scpt
if playlistTitle is missing value then
lns3.scpt
tell user playlist "Music"
lns3.scpt
play (first track whose name is trackTitle)
lns3.scpt
if exists user playlist playlistTitle then
lns3.scpt
tell user playlist playlistTitle
lns3.scpt
say "No matching playlist in iTunes. Quitting applet."
lns3.scpt
if errorNumber is -1728 then
lns3.scpt
say "No matching track in the iTunes music library."
lns3.scpt
say "iTunes is not running"
lns3.scpt
end playThisTrack
lns3.scpt
on stopPlaying()
lns3.scpt
if player state is playing then stop
lns3.scpt
end stopPlaying
lns3.scpt
property sourceLanguageID : "en" -- (en=English, fr=French, es=Spanish, de=German, it=Italian, sv=Swedish, nl=Dutch)
lns3.scpt
property sourceLanguageTitle : "English"
lns3.scpt
property destinationLanguageID : "es"
lns3.scpt
property destinationLanguageTitle : "Spanish"
lns3.scpt
property languageAbbreviations : {"en", "fr", "es", "de", "it", "sv", "nl"}
lns3.scpt
property languageTitles : {"English", "French", "Spanish", "German", "Italian", "Swedish", "Dutch"}
lns3.scpt
property bodyStyleCSS : "margin-left:36px;-webkit-user-select:none;width:50%;background-color:#555;color:white;"
lns3.scpt
property slideIdentiferOpeningTag : "<h4 style=\"margin-bottom:4px;margin:0;\">"
lns3.scpt
property slideIdentiferClosingTag : "</h4>"
lns3.scpt
property noteOpeningTag : "<textarea rows=\"5\" id=\"txtareaXXXX\" onClick=\"SelectAll('txtareaXXXX');\">"
lns3.scpt
property noteClosingTag : "</textarea>"
lns3.scpt
property blankLineHTML : "<hr>"
lns3.scpt
property introductionOpeningTag : "<h3 style=\"margin-bottom:0;font-style:italic;\">"
lns3.scpt
property introductionClosingTag : "</h3>"
lns3.scpt
property documentTitleHTMLOpeningTag : "<h2 style=\"margin-left:24px;margin-bottom:12px;margin-top:8px;\">"
lns3.scpt
property documentTitleHTMLClosingTag : "</h2>"
lns3.scpt
property instructionsOpeningTag : "<p style=\"font-size:small;font-style:italic;\">"
lns3.scpt
property instructionsClosingTag : "</p>"
lns3.scpt
display dialog "This script will open a new window in Safari containing a tab listing the presenters notes from the front presentation, and a second tab displaying the Google Translate website." & linefeed & linefeed & "Translate from: " & sourceLanguageTitle & linefeed & "Translate to: " & destinationLanguageTitle buttons {"Cancel", "Set Prefs", "Begin"} default button 3 with title "Translation Helper"
lns3.scpt
if button returned of the result is "Set Prefs" then
lns3.scpt
set thisLanguage to (choose from list languageTitles with prompt "Language to translate from:" default items {sourceLanguageTitle})
lns3.scpt
if thisLanguage is not false then
lns3.scpt
set sourceLanguageTitle to (thisLanguage as string)
lns3.scpt
set sourceLanguageID to my matchItemByIndexToCorrespondingList(sourceLanguageTitle, languageTitles, languageAbbreviations)
lns3.scpt
set thisLanguage to (choose from list languageTitles with prompt "Language to translate to:" default items {destinationLanguageTitle})
lns3.scpt
set destinationLanguageTitle to (thisLanguage as string)
lns3.scpt
set destinationLanguageID to my matchItemByIndexToCorrespondingList(destinationLanguageTitle, languageTitles, languageAbbreviations)
lns3.scpt
set thisDocumentName to the name of it
lns3.scpt
set the HTMLBody to ¬
lns3.scpt
introductionOpeningTag & "Presenter notes for:" & ¬
lns3.scpt
introductionClosingTag & linefeed & ¬
lns3.scpt
documentTitleHTMLOpeningTag & "“" & thisDocumentName & ¬
lns3.scpt
"”" & documentTitleHTMLClosingTag & linefeed & ¬
lns3.scpt
instructionsOpeningTag & "(Click the text of a presenter note to select it)" & ¬
lns3.scpt
instructionsClosingTag
lns3.scpt
repeat with i from 1 to the count of slides
lns3.scpt
tell slide i
lns3.scpt
if skipped is false then
lns3.scpt
set thisSlideNotes to its presenter notes
lns3.scpt
set thisSlideNotesHTML to thisSlideNotes
lns3.scpt
set thisNoteOpeningTag to my replaceText(noteOpeningTag, "XXXX", (i as string))
lns3.scpt
HTMLBody & linefeed & ¬
lns3.scpt
blankLineHTML & linefeed & ¬
lns3.scpt
slideIdentiferOpeningTag & "Slide " & (i as string) & ¬
lns3.scpt
slideIdentiferClosingTag & linefeed & ¬
lns3.scpt
thisNoteOpeningTag & thisSlideNotesHTML & noteClosingTag
lns3.scpt
set HTMLOutline to "<!DOCTYPE html>
lns3.scpt
<html lang=\"en\">
lns3.scpt
<head>
lns3.scpt
<meta charset=\"utf-8\" />
lns3.scpt
<meta name=\"description\" content=\"Page Generated for Translation\">
lns3.scpt
<title>" & thisDocumentName & "</title>
lns3.scpt
<script type=\"text/javascript\">
lns3.scpt
function SelectAll(id)
lns3.scpt
{ document.getElementById(id).focus(); document.getElementById(id).select(); }
lns3.scpt
</script>
lns3.scpt