Applescript Finder Timeout Error

Discussion in 'Mac Programming' started by velocityg4, Sep 21, 2017.

  1. velocityg4 macrumors 601

    velocityg4

    Joined:
    Dec 19, 2004
    Location:
    Georgia
    #1
    I've been trying to import a large Picasa library into Photos and keep the folder structure as albums. I found a nice Apple Script someone made for this. Unfortunately, it has a problem where the Finder will timeout when importing a large folder. Some of the albums are over 2GB. So, it can take the Finder over two minutes.

    I don't really have much programming experience. I've tried modifying adding timeout periods to every reference I could find for "tell application "Finder". No luck. It will still timeout after the default 2 minutes.

    If there was a better way to maintain albums in Photos from Picasa. I would use it. I've had no luck finding anything. So, I'm stuck trying to make this work more reliably.

    I've linked the original. As I don't know if it is allowed to upload a copy of someone else's work I found.

    I am using "Version 2". Due to support of sub-folders.
    https://discussions.apple.com/docs/DOC-8931
     
  2. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #2
    Hi,

    Whereabouts in the code is it timing out?
     
  3. velocityg4 thread starter macrumors 601

    velocityg4

    Joined:
    Dec 19, 2004
    Location:
    Georgia
    #3
    I really dont know enough to tell you. If it is working on a large folder. It is before the imported pictures start appearing in the Import Folder of Photos.
     
  4. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #4
    Well, I think that's your first challenge! ;-)

    Assuming it's not stalling because of an error, and your script just needs a longer time to execute then first step is to figure out which part of the code is timing out. Once you've found it, put an "with timeout..." command around it. If there is already one there then you may need to increase the amount of time allowed.

    There's some documentation on how to use it here:

    https://developer.apple.com/library...gGuide/reference/ASLR_control_statements.html

    ...an example of usage might be:

    Code:
    with timeout of 20 seconds
       //do something that takes a long time
    end timeout
    
     
  5. velocityg4 thread starter macrumors 601

    velocityg4

    Joined:
    Dec 19, 2004
    Location:
    Georgia
    #5
    Other errors occurred during the script. Such as Photos hanging because the script would start processing the next batch before it was ready. So, Photos would stop and say it was still importing pictures.

    I found an alternative. I could just have iPhoto import everything as it would add each folder as an individual Event. Then I just had Photos create a new library from that iPhoto library. Keeping all the events.

    There wasn't anyway I was going to figure out where to insert those timeout statements. I tried it at every mention of Finder. I was hoping it was an easy solution where someone could just say. Add the timeouts to all of these entries. So, that there is no chance for a timeout. No matter where it occurs during the script.
     
  6. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK

Share This Page

5 September 21, 2017