Applescript and Keynote: skipping old/un-skipping new?

I manage digital signage for a university department. Last week, I wrote an Applescript that will examine the contents of two folders (an Incoming and a Current folder), check the filenames of slides inside for start and end dates, and move new/old slides to the Current folder and an Old Slides folder, respectively. For example, a file named "xxx-20141027-20141031-xxx.jpg" would have been moved into the Current folder this morning and will be moved into the Old Slides folder the morning of Nov. 1.
I thought I could adapt this script to do the same thing with Keynote, having the "20141027-20141031" portion in the Presenters Notes instead. However, I'm having trouble figuring out how to get this to work exactly.
to extractStartDate(slideNotes)
     set TempID to AppleScript's text item delimiters
     set AppleScript's text item delimiters to "-"
     set notesParse to every text item of slideNotes
     set returnStartDate to text item 1 of notesParse
     return returnStartDate
     set AppleScript's text item delimiters to TempID
end extractStartDate
**repeat for EndDate
to date_format(old_date)
     set {year:y, month:m, day:d} to result
     set todayDate to (y*10000 + m*100 + d)
end date_format
set old_date to current date
set todayDate to date_format(old_date)
set currentSlideshow to "*filepath*"
set slideCount to count of currentSlideshow
tell application "Keynote"
     repeat with slide sc from 1 to slideCount
          tell slide sc
               set notesData to the notes of it
               if skipped is false then
                    set addDate to extractStartDate(notesData)
                    if addDate comes before todayDate then
                         set skipped to true
                    end if
               else if skipped is true then
                    set removeDate to extractEndDate(notesData)
                    if removeDate comes before todayDate then
                         set skipped to false
                    end if
               end if
          end tell
     end repeat
end tell
Also tried this instead of repeat loop:
     set skipped of (every slide where the extractStartDate(notes) comes before todayDate to false
     set skipped of (every slide where the extractEndDate(notes) comes before todayDate to true

Hi,
Try this, it work on the current document of Keynote '09'
set old_date to current date
set todayDate to date_format(old_date)
tell application "Keynote" -- version 09
    tell front slideshow
        set tc to count slides
        repeat with i from 1 to tc
            tell slide i
                set notesData to the notes of it
                if not skipped then
                    set addDate to my extractDate(notesData, 1)
                    if addDate comes before todayDate then set skipped to true
                else
                    set removeDate to my extractDate(notesData, 2)
                    if removeDate comes before todayDate then set skipped to false
                end if
            end tell
        end repeat
    end tell
end tell
to extractDate(slideNotes, n)
    set TempID to AppleScript's text item delimiters
    set AppleScript's text item delimiters to "-"
    set returnStartDate to text item n of slideNotes
    set AppleScript's text item delimiters to TempID
    return returnStartDate
end extractDate
to date_format(old_date)
    set {year:y, month:m, day:d} to result
    return (y * 10000 + m * 100 + d)
end date_format

Similar Messages

  • How to move my movies and music from old PC to new PC

    how to move my movies and music from old PC to new PC+

    The following article(s) may help you.
    Moving your iTunes library to a new computer

  • How do i transfer my music library and playlist from old computer to new computer with windows 7

    How do I transfer my music library and playlist from old computer to new computer with windows 7?

    Type "move itunes library" into the google search bar.

  • Transfer settings and data from old iphone to new iphone

    Hi. I recently replaced my iphone 3G with an iphone 4. I backed up my old phone and then connected the new iphone4. When registering the phone for the first time, iTunes crashed while backing the phone up. I rebooted, connected my iphone4 again and finished registration but there was no option to copy my old data across.
    How do I do this?
    I'm not sure whether clicking 'restore' will work or whether that will just wipe the phone again (it's straight out the box, so no real loss if it does, although I'm concerned because I really don't want to lose all the data from my old phone.)
    I'm on a PC, with the latest iTunes installed.
    Any help appreciated. Thanks

    Hi! were you able to do it, finally? im having the same situation right now... dunno if it's possible or not to transfer the old to the new iPhone, they're different iOSes.

  • Moving Mail, Address Book and Keychains from Old Computer to New Computer

    My issue: Moving mail, address book and keychains from Panther (old machine) to Leopard (new machine). Old machine (500mh G4 power pc) will not connect directly via firewire to new machine (iMac intel). So, I have to move the files manually via a firewire hard drive.
    I am looking for a document that will tell me exactly which files to move. Can someone please help me find this document? Thank you. Dale
    P.S. I have no issues with installing Leopard. I only need to move the mail, address book and keychains from old to new machine. No .mac account is available.

    for address book: go to your old mac, launch ab, and go to file>export and export your contacts as vcards, select all cards before that, then bring that export file to the new mac, and launch ab there, then go to file>import as vcards and you should be set as far as contacts are, but not as far as groups if you have extensive groups. that would be the safe option. the other option is to go to homefolder/library/application support/address book and move that folder to the new mac. the only question i have is... is the database structure and files the same between panther and leopard, which is why i suggest the first option of import/export of vcards.
    for mail, in your old panther go to homefolder/library/mail and move that mail folder to the new mac. make a copy of that folder, then move one copy to the same location in the new mac.
    for keychain, in your old panther go to homefolder/library/keychain, you want to bring the file that is in that folder to your new mac. make a copy of that folder, then move one copy to the same location in the new mac.
    once that is done, you may have to do some more steps with mail, once you launch mail, such as importing mailboxes. let me know if that is the case.
    hope this helps

  • How do I transfer all files and apps from old iPad to new iPad?

    How do I transfer everything from iPad1 to iPad3?

    You can backup your current iPad, and then restore the new iPad from that backup (a list of what is included in a backup is in this article - it excludes music, videos, synced photos). As the backup doesn't contain the actual apps, just their settings and content, for the restore to work completely you'll need all the relevant apps in your computer's iTunes library - otherwise the restore won't be able to install the apps and therefore their content (if you don't have the apps on your computer then you can either copy them over from the current iPad via File > Transfer Purchases or you can re-download them for free).
    The restore won't copy passwords onto a different device, so you will need to re-enter your email, router, and any website passwords onto the new iPad - they only get restored onto the same device.

  • How to transfer all files and programs from old HDD to new HDD?

    I would like to change my laptop's HDD to one with a larger capacity. Is there a way for me to transfer all my current content to the new HDD from the old one without having to re-install all programs/ the OS?

    Check this MS page about Windows Backup and Restore Center
    http://www.microsoft.com/windows/windows-vista/features/backup.aspx
    There you can find this:
    +Windows Complete PC Backup and Restore Available in Windows Vista Business, Ultimate, and Enterprise editions, Windows Complete PC Backup and Restore is a comprehensive, image-based backup tool that will help you out of a tight spot if you need to recover your entire system+.
    So I would assume that this is similar to the ghost or another image tools

  • Installing photoshop cc and lightroom from old laptop to new desktop

    Hi, I have a account for photoshop cc and lightroom under cc. Recently i bought a new desktop and want both the aaps to be installed as on my old laptop.
    I want it to be under same account. Please suggest.
    Thanks

    No magic. Simply sign out on the old machine and sign in on the new one.
    Mylenium

  • Easiest method to transfer CS6 and cloud from old Mac to new one?

    Oi.  I'm old and have poor memory that makes this Very difficult.  I need to transfer licensed CS6 and cloud member (9.90 a mo) from my old iMac to my new iMac.  I backed it up under Maverick using Carbon Copy Cloner.  I don't know where to look or how to transfer.
    Thank you.

    You are allowed two installs. You can just download,install, and activate on the new Mac.
    A clean install is less error prone than recovering it from backup.
    When you are sure you do not need the old install, just deactivate and uninstall.

  • How to transfer music and photos from old iCloud to new iCloud

    I have to make a new iCloud but I don't want to lose all my photos and music that I have bought. How can I transfer those things from my old iCloud to my new one?

    Music can only be used with the Appel ID that has been used to buy the songs. They can be downloaded again for free:
    Download past purchases - Apple Support
    You can transfer the photos on your phone to your computer:
    Import photos and videos from your iPhone, iPad, or iPod touch to your Mac or Windows PC - Apple Support

  • Moving purchased music and files from old computer to new computer.

    My old computer was recently stolen and on it I had quite alot of music that I had purchased from the itunes store. Is there anyway to recover some of the music that I have purchased through the itunes store and put it on the itunes on my new computer?

    If you didn't make a back-up of your purchases to restore from then I'm sorry to say that the policy on lost purchases is that you have to pay to download them again:
    "Once a Product is purchased and you receive the Product, it is your responsibility not to lose, destroy, or damage the Product, and Apple shall be without liability to you in the event of any loss, destruction, or damage." iTunes Store: Purchased content can be downloaded only once
    You could try contacting iTunes Store Customer Service and you might be able to persuade them to sanction a second free download. There have been occasional reports in the iTunes forum of this happening, however just be aware that they are not under any obligation to do so. If you click on this link you'll be able to email your query: Customer Service - iTunes Store Support
    If you have an iPod that still has any of your purchases on it you'll find details in this article on how to transfer them to the computer: Copying iTunes Store purchases from your iPod or iPhone to a computer

  • Tags and Keyword from old computer to new computer

    I have Elements 11 on my old computer and in the Organiser I attached key words etc to my images. Since then I have a new computer and purchased Elements 12. What I would like to do is to have Key words and tags on the new computer, having taken ages to set them up.  Is there an easy way of getting this information.
    All help greatly appreciated.

    HI,
    Take a backup of your PSE11 cataog, bring it to ur new computer and then restore it in PSE12.
    Thanks,
    Anwesha

  • Transfer video and music from old iphone to new one

    I just purchased an iphone 4s and i wanna transfer my music, pictures and videos. How do i do it?

    Are the music video in your iTunes? If not, please connect your old iPhone to iTunes and then click "Transfer Purchases" then all the music video file will be saved in your iTunes account. Finally connect your new iPhone to iTunes and sync.

  • HT204053 My new Iphone is asking me to "Try another Apple ID"?  when I log i my email adrees. Ive ben online and chnaged my old password to new, but doesnt help??

    Just bought a new Iphone 5 and am trying to start it up. Im right at the bstrart and have enetreed my email eadderess but when I go "next" message says "Try another apple ID".
    Ive reset a forgotten password and have my apple ID.
    What do I d now as it wont let me  go fwd

    Contact iTunes Customer support... it is not possible to bypass Activation Lock.

  • How do I get photos and songs from old iphone to new iphone?

    I have no idea how to transfer all of my photos and songs from my 3g to my new 5s...can someone tell me in plain simple english...I am no expert! Please?

    YOu should backup your 3G and then use that backup on your new phone http://support.apple.com/kb/HT1766
    your songs should already be in yoru itunes media library, sync your phone to get the songs.

Maybe you are looking for

  • Can I use bind variable instaed of writing static COLUMN Name

    Hi , I am having a table containing id and column names, the data is stored against that id in other tables. Now I wish to update data into another table so that it goes into apppropriate column without using decode function. I am trying to do this:

  • How do I transfer my iPad to another person?

    What's the process to change the "ownership" of an iPad from me to another member of my family?

  • How can I delete Photo albums in iPhone 4s.  I am using OS 10.5.8 Mac Book Pro

    I would like to delete several albums from my iPHone 4s.   I have a MacBook Pro, OS 10.5.8.   I only can delete single photos from camera roll.

  • Number of CAL for my network

    how do I know how many CAL I have in my windows AD and how many I need to get? my AD is windows 2008 R2. I have abt 350 windows desktops/laptops. We hava a new office to setup which may require 20-30 new desktops. my boss is worried that we may run o

  • Any good books for abap coding

    Hi.. Any one can tell me the good books on routines,user exists,mailny for abap code used in BW.Sap press books also.I dont known the abap.if any docs is ther please sent me to my mail id:[email protected] simens or reliance material.will assign poin