Applescript: display dialog until memory card is inserted

I'm developing an applet to automate the process of copying video footage from my camera's memory cards onto my hard drive. It works perfectly, except that I cannot quit it. Here is the part of the code that needs help. It checks every 5 seconds for a memory card and, if one is inserted, continues to copy everything off it.
repeat
     set cardIn to 1
          with timeout of 86400 seconds
                    tell application "Finder"
                              repeat while cardIn is 1
                                        if exists disk "EOS_DIGITAL" then
                                                  set cardIn to 0
                                        else
                                                  delay 5
                                        end if
                              end repeat
                    end tell
          end timeout
     (the rest of the code)
end repeat
The problem is that there is no way I can find to quit once it is in this wait loop. The menu command to quit and the Command-Q hotkey both do nothing so I have to force quit when done. What I'd like is to be able to have a dialog displayed asking this user if they want to quit while it's waiting, but I don't know how to do that without it having to "give up after 5 seconds". That makes a new dialog display again every 5 seconds when it rechecks for memory cards, which would get very annoying for anyone using the computer.
I wish something like this would work...
repeat until (list disks) contains "EOS_DIGITAL"
     display dialog "Waiting for card..." buttons {"Quit"}
     tell me to quit
end repeat
...but it still waits for a button to be clicked in the dialog. I want this to be a truly automatic process, where plugging in a memory card triggers the whole copy process (which is already done and works perfectly) so I would rather not have to click a button to continue.
Is there any way to have a dialog displayes with a quit button that automatically goes away once a memory card is inserted without using "giving up after x seconds"?

Keeping a script or application locked up inside delays or repeat loops will keep it from responding to system events.  There are a few ways to monitor when a volume gets mounted:
Write your application using AppleScript in Xcode to watch for a workspace notification;
Use launchd or a folder action to watch the /Volumes folder (an alias is added to the folder when a volume is mounted);
Make your script into a stay-open application and use an idle handler to periodically check.

Similar Messages

  • Lightroom 5.0 fails to automatically open import dialog when memory card inserted

    Lightroom 5.0 fails to detect memory card and open import dialog. This has always worked fine in Lightroom 4, 3,and 2.  Same cards, same camera, same iMac using OS X 10.8.4. Manual importing works OK, card is detected just fine.

    I have tested Lightroom 4 and Lightroom 5 on Mac OSx 10.9.4 and find no difference in behavior.
    If you have correctly set Image Capture to auto-launch Lightroom on insertion of card and you have set Lightroom to launch the Import dialog upon insertion of card, this is expected behavior:
    1. If Lightroom is not open open, inserting a Memory Card will launch Lightroom without opening the Import Dialog
    2. If Lightroom is open already, inserting a Memory Card will open the Import Dialog.
    I can find no combination of settings in Lightroom 4 or 5 that allow you to, with Lightroom closed, insert a card and have Lightroom launch and open the Import dialog. I would sure love to see someone produce a screen vid capture of Lightroom 4 opening by itself and launching an import dialog upon card insertion with no user intervention.

  • Blackberry Curve 9300 - "memory card not inserted"

    Hi, I've seen this topic on here already but none of the things you mentioned actually worked for me. my blackberry is brand new this morning (22/10/2011) so there is no way it could have been damaged... i took the memory card out of my blackberry storm and put it in this one, and it didnt work, so i put the one i got with this phone in and that didnt work either. any ideas would be amazing?

    Well, for starters, make CERTAIN the card is inserted correctly... so the contacts touch as intended.
    That might sound silly, but believe, I've seen users put media cards in all different wrong ways.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Can't disable option show import dialog w/ memory card detected

    Hello. Across the board, I don't want applications to open up when memory cards or cd/dvds are inserted. Adobe Lightroom counters this desire by opening when I insert a memory card.
    I am running Windows Lightroom 2.4. In pervious versions, I could disable the perferences / import / show import dialog when a memory card is detected. However, in 2.4 I uncheck this option. Close lightroom. Open lightroom. And my disabled selection didn't save. It has it checked. And...Lightroom continues to open when I insert a memory card.
    Any ideas on how to resolve this issue?
    I have tried running Lightroom as admin to see if it was a registry permissions issues. The options still didn't stay unset.
    Thanks for your advice.

    DalePh wrote:
    I am running Windows Lightroom 2.4. In pervious versions, I could disable the perferences / import / show import dialog when a memory card is detected. However, in 2.4 I uncheck this option. Close lightroom. Open lightroom. And my disabled selection didn't save. It has it checked. And...Lightroom continues to open when I insert a memory card.
    You don't say which OX you're running, but if it is a Vista 64 bit version just a few notes down you will find the answer:
    http://forums.adobe.com/thread/455749?tstart=0
    Essentially it is a bug in 2.4 on Vista 64 bit systems and must be fixed by Adobe.
    I do experience the bug on my Vista system but not on my iMac.

  • Applescript Display Dialog Default Answer Rendering Issue

    After I installed Lion, I started having issues with Applescript rendering a dialog with a textbox.
    This is the sort of thing I end up seeing:
    The text box in the dialog doesn't render properly, and it's not possible to enter anything into it.  I've played with the display dialog parameters but it doesn't matter if I give an empty string for the default answer or other text, the behaviour is always the same.
    Does anyone have any ideas as to what the issue might be?  I suspect I might need to reinstall Lion, but I'm not sure that's even going to clear up the issue.
    Thanks in advance.

    Tried replacing 'Standard Additions' osax, dumping editor prefs, dumping ALL user prefs (not recommended for faint of heart), using a different copy of Script Editor. Nothing helped.
    The user account displaying the bug is an old one; likely updated continuosly from the days of Tiger or earlier.
    A std account on the same drive, which merely went through the Snow Leopard -> Lion transition, does not exhibit the edit-text display bug.
    So I bit the bullet, and used Migration Assistant to move to a new account on a clean install of Lion on a spare hard drive. 3.5 hours later, the Applescript edit text display bug is gone.
    As far as I can tell, all docs, Apps etc. made it through intact.
    If that continues to look true over the next few days, I'll try using SuperDuper! to copy the new drive back to the older, faster HD.
    Perhaps some other Lion bugs'll also go away now that I've got a cleaner install.

  • Applescript: display dialog / saving to . . .

    The following script always has the document folder selected in the "save as" window
    How do I designate another locaiton  such as the desktop
    or even  create a folderat the desk top and have it selected as the save to
    (G5 PPC OS X 10.5.8 Applescript)
    Thank you
    say (text returned of (display dialog ¬
        "Enter what you would like synthesized into a file." default answer ¬
        "Welcome to Mac OS X.")) saving to (choose file name with prompt ¬
        "Choose where you would like to to save the file." default name "say.aiff")

    The choose file / defaul location is a reference to a folder which is useful
    But how do I change the locaiton from the documents folder to the desktop
    The desktop is not a folder and won't work with this comand
    I googled and come up with  a solution:
    say (text returned of (display dialog ¬
        "Enter what you would like synthesized into a file." default answer ¬
        "Welcome to Mac OS X.")) saving to (choose file name with prompt ¬
        "Choose where you would like to to save the file." default name "say.aiff" default location path to desktop)
    Thanks for pointing me in the right direction

  • AppleScript Display dialog if clause

    What I'm trying to do now is have a pop up trigger from a calendar event(already know that part) and ask a user if they are ready to launch another workflow. If they select NO I want there to be a 5 minute delay and then have the same question asked again. I cant figure out how to loop the original question back through and I know there has to be a way to do it.
    Heres my code so far...
    set question to display dialog "If you're ready to clock in, punch for lunch, or clock out click YES. If you are stuck on a chat cancel this bad boy." buttons {"No", "Yes"} default button 2
    set answer to button returned of question
    if answer is equal to "Yes" then
              tell application "Finder" to activate
              tell application "System Events"
      keystroke "c" using {command down, control down, option down}
              end tell
    end if
    if answer is equal to "No" then
              display dialog "Automator will snooze for 5 minutes" buttons {"Snooze", "Snooze"} default button 2
    delay 300
    display dialog question
    end if
    Thanks in advanced for any input!

    You can also just put the whole thing in another repeat statement:
    repeat -- forever
      set answer to button returned of (display dialog "If you're ready to clock in, punch for lunch, or clock out click YES. If you are stuck on a chat cancel this bad boy." buttons {"No", "Yes"} default button 2)
      if answer is equal to "Yes" then
        tell application "Finder" to activate
          tell application "System Events"
            keystroke "c" using {command down, control down, option down}
          end tell
        exit repeat
      else
        display dialog "Automator will snooze for 5 minutes" buttons {"Snooze"} default button 1 giving up after 10
        delay 300
      end if
    end repeat

  • Applescript: display dialog while doing shell script

    Hello there,
    I'm making an applescript app for my company, and had  a question.
    The functionallity of the app is working great, but there is a certain step which can take up to several minutes.
    This can give the user the feeling that nothing is happening and things are stuck.
    Is there a possibility to display a dialog as long as the action (shell script) is running?
    Something along the lines of "Now performing action X. please wait...)
    Thanks for your thoughts!
    Grtz

    With regular AppleScript you can start the shell script in the background (see do shell script in AppleScript) and then put up a dialog, although you would have to periodically check to see if the shell script is finished.  In Lion, the AppleScript Editor has a Cocoa-AppleScript template that you can use (kind of a wrapper application that lets you use various Cocoa methods without having to use Xcode), in which case you could put up an indeterminite progress indicator and then do the shell script.
    AppleScript Studio is deprecated as of Snow Leopard, but there are some AppleScriptObjC in Xcode tutorials at MacScripter.  An additional source of information and templates is macosxautomation, but they seem to be having some server problems at this time.  I also have a Progress Window template application example, it can be downloaded here.

  • E90 - "memory card not inserted"

    My nokia E90 fell off the table and the card slot opened ejecting the card - ever since, it fails to detect the card - i have tried using a fresh micro sd card but it didnt work. wot cud b wrong? help!

    nidhi: u would have to take it to a nokia service center. the card holder would need a thorough check
    Wishing u a great time with your device,
    eseriesaddict
    Chennai
    India.

  • Problem with memory card slot on nokia c5 03

    Sir,
    I have a Nokia C5 03 from the last 8 months.....
    Working very well.
    Recently, my memory card stopped working.
    I thought that there might be a problem in the memory card and bought a new one.
    Even though i inserted new card in my phone, i am getting the same error.
    In file manager it is displaying as "Memory card Corrupted."
    I have checked the new memory card by inserting in to another phone which was working normally.
    There i have even formatted the new memory card and again inserted into my c5. 
    Then also i am getting the same error message........
    Can any one suggest me what to do in this regard??????
    Thanks in ADVANCE.
    Solved!
    Go to Solution.

    Hi,
    Welcome to the forum!
    Have you also tried inserting the old memory card to another phone as well? What happened after inserting it to another phone? If it's working properly with another phone, the memory card slot of the C5-03 might have an issue so you should bring it to the repair facility to have it checked. 
    You can search for the nearest repair facility in your area from this link: http://www.nokia.com/in-en/care-point-finder/
    Hope this helps.

  • How to swap memory card with all apps, data etc.

    Hi,
    Currently I have a 2GB memory card on my E63 (latest firmware), which has 3 'paid-for' applications and several free downloaded applications, loads of mp3s etc. I have purchased a 4GB memory card already, and would like to "do something" that would help me retain the entire contents of the current 2GB memory card, onto the 4GB memory card, s.t. apart from extra file space (which I plan to use for photos, videos, music), all other applications and current content remain available on the new card, w/o any other impact. I believe that backing up and restoring via 'Nokia PC Suite' won't save my apps, and only some of the data. E.g. it won't save the eBooks I have.
    Thanks in anticipation for the help.
    cheers.
    Solved!
    Go to Solution.

    Easy.
    Connect the E63 in "mass storage" mode.
    Go into "My Computer", open the removable drive that will have appeared when you connected the phone. Enable the display of hidden and system objects (this bit is crucial, but I don't know how to do this not being a Windows user myself).
    Once you have the display of all objects enabled, create a new folder on your desktop and then copy all of the files/folders in the phone over to it.
    Next, disconnect the phone and eject the memory card. Insert the new one and format it in the phone (that'll be in your phone's manual).
    Reconnect the phone in mass storage mode. Grab all the objects in the folder that you created on your desktop, including hidden and system objects, and drag'n'drop them over to the phone.
    Disconnect the phone once everything has been copied over -- don't forget to use the "safely disconnect USB device" thing in the computer's notification zone.
    Job done.
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • How can I make Photos not open every time a photo card is inserted?

    Hello,
    Every time I insert an SD or CF card or even my iPhone, Photos opens up. How can I stop this from happening? I looked everywhere and I can't find a solution, thanks.

    Go to Edit> Preferences. Under "Import Options" uncheck "Show import dialogue when memory card is inserted".

  • N95 8GB Isnt reading/detecting any memory card.

    My N95 isnt reading or noticing that a memory card is inserted, I tryed formating it it wouldnt let me, a message comes up saying "Drive not found". Even when i create a fold inside it a massage comes sayinf "Param error".
    Clicking Open says empty.
    I tryed to formating on the PC, but nothing changes, its still says the same thing.
    I tryed 2 new memory cards and both gave me the same messages.
    could I have some help pls.

    I remind you that if you have something calling itself a Nokia N95 8GB that has a memory card slot, then it most certainly isn't a genuine Nokia device.
    This being the case, all bets are off when it comes to hardware compatibility and you will receive no support here. All I can say is simply that the µSD card reader in your phone is most likely not an SDHC reader, meaning that it won't accept cards greater than 2GB.
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • N78 asking to remove memory card

    Hi there, i have bought my N78 just one month ago and find it amazing for almost every aspect except that it has a problem with the memory card. The fist time i turned on the phone, i have no notice that the Nokia microSD 2gb memory card was inserted as there wasn't any icon in the screen. So as i removed it and put it back in, the card was recognized but after a while the phone showed me a message asking to "remove memory card and press ok".
    I replaced the original Nokia card with a Sandisk card and still have the same problem, which is quite annoying because it is a brand new phone and i can't count with the memory card to store any information because after a while the card icon dissapears of the screen and it is like i have no memory card inserted in the phone.
    Any clue?? Thank you

    There were a few similar issues with cards in other phones in the past - I thought Nokia had ironed these out, but maybe with the N78 still being quite new ..
    I guess the most common issue was that the card wasn't formatted correctly. The way around is to format the card in the phone.
    Another issue was that the firmware wasn't designed to work with larger volume cards. I'd be very surprised if this was the issue as 2GB cards have been around for ages, however it might be worth checking if you have the latest firmware. To do this you need to use the "Update phone software" option in PC Suite. This will install a newer version of the firmware is there is one available.
    If neither of these helps, I guess you could try a factory reset. Not sure how that would help, but you never know.
    NB: be sure and backup (and preferably synch) your phone before you attempt to update firmware or reset the phone as both of these erase everything in phone memory.
    Have to say, the N78 I used didn't have any problems with it's 2GB card. It was SIM-free, though and SIM-free phones tend to be a lot less problem-prone than network-specific phones.

  • Lightroom starts every time i put in a memory card.

    Lightroom starts every time i put in a memory card or a USB stick with photos. Is it possible to turn off this feature? I want to determine if the program should start.

    Go to:
    Edit >> Preferences>> General (tab)
    Lightroom >> Preferences>> General (tab) on Mac OSX
    Uncheck the box: Show import dialog when memory card detected.

Maybe you are looking for

  • Sending duplicate text messages

    My phone is sending duplicate text messages whenever I send to my contacts.  How do I stop this? I've noticed this on my RAZR Maxx and now my HTC One M8. 

  • AHH iTunes Library (damaged).itl?

    I found a couple of posts about this problem but it was nothing very recent, nor anything very helpful. :/ (read: i'm not very good at computers, and i really don't know what you mean by 'just restore it'. so, step-by-step you're-an-idiot guides are

  • Stock Photo Images

    Hey there everyone, I am building a course in Captivate for training purposes for my company and my customers. I have some stock photos of a woman in different poses, and a man in different poses. My problem is that I dont have very many poses to cho

  • Parallel execution of interfaces

    Hi. In the ODI package I can locate my interfaces and join each two of them by two lines: 'ok' (succesful) and 'ko' (unsuccesful). So I get a sequential execution of these interfaces. How I can make ODI to execute them in parallel way?

  • Why can't I delete mp3 files from my Trash?  They are not locked.

    Why can't I delete mp3 files from my Trash? They are not locked.  I compressed them into a zip file and then couldn't delete that file either.  I've restored them and tried deleting again but no luck.  Can anybody please help?  iOS 10.8.5