Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

AppleScript: Spinning wait cursor and delay when running the first time

Featured Replies

Hey there,

In one of my solutions I offer the user to insert a file into a Filemaker record. Each of my users has his own folder from where he can choose the files that he wants to insert.

To make sure that every user can choose from his own folder, I attached an AppleScript that gets called from a Filemaker script: AppleScript opens the correct folder (based on the user's name), tells Filemaker what file the user has chosen, and Filemaker does the rest. (This technique is based on Fenton's work (http://fmforums.com/forum/showtopic.php?tid/199641/).

One thing is fairly annoying though: Every now and then, while the AppleScript is being executed and the Choose File window is open, the spinning wait cursor appears, for no reason. I can still click and choose files, I can click OK or Cancel and so on; it is just that the cursor turns into the beloved spinning rainbow pizza. This is something that causes a lot of confusion among the users ("Hey! The system has stopped responding!...")

So, I wonder if and how I can get rid off this. It only happens with AppleScript.

Another thing also is interesting: When I run this AppleScript for the first time on a computer, it takes a while until the Choose File dialog opens. From then on running this script opens the dialog box right away. As I'd like to set things up in a way that the dialog box shows right away, even at the first time, I'd be grateful for some suggestions.

Thanks for your input :( Mike

  • 1 month later...
  • Author

O.k., I still haven't found the reason behind, but the following workaround helped, and it might help in case somebody faces the same problem...:

What seems to cause trouble is the Allow User Abort script step. The critical script steps are:


  • Allow User Abort [Off]
    Show Custom Dialog (...and hit OK)
    Perform AppleScript (...including choosing a file and hitting OK)

When the script runs these three steps in the above order, then it happens that the spinning wait cursor appears in case the user clicked OK in the custom dialog too long.

Changing the order helped (finally):

  • Show Custom Dialog (...and hit OK)
    Allow User Abort [Off]
    Perform AppleScript (...including choosing a file and hitting OK)

With this order no rainbow pizza appears!

Mike

This is very close to the problem I'm having, that I posted the other day Here . I didn't use a Custom Dialog in my script, and I get the spinning wheel after choosing the file using AppleScript.

Yes, upon further investigation I find that even a simple loop that takes about a second causes the spinning rainbow. A Pause/Resume step with a duration of even 0 causes it.

I tried using a Allow User Abort ["On"] right before the AppleScript, but no dice. The only thing I've found so far which eliminates it is to Refresh Window right before the AppleScript. It makes a little flash, but is not too noticeable as, in this case, the choose file window obscures it. On a large complex layout it would be worse.

When you use Refresh Window it makes no difference if Allow User Abort ["Off"], no rainbow. Which is a little odd.

It is actually not much of a problem when the rainbow spins. It is only a FileMaker thing really. If you move the cursor outside that choose dialog, outside FileMaker windows, it turns back into a regular arrow cursor. In some ways it illustrates how a Perform AppleScript step in FileMaker is running the AppleScript within FileMaker's application space. But in that case I would have expected Allow User Abort ["On"] to prevent it, and would expect that Allow User Abort ["Off"] would cause it to appear even after Refresh Window (which it doesn't).

P.S. Look at the script first. Because you may want to lower the number of Loops, if you have an older computer. About 55,000 (a second or two) is what it takes for the rainbow to appear for me. I was trying to show that any FileMaker operation of over a second will cause the rainbow to appear.

Abort_rainbow_AS.fp7.zip

Hi Fenton,

Thanks for your new AppleScript. I'll have to try it out later. I have a MacBook Pro Intel duo, So I'm not sure how the 55,000 will come into play?

Lee

I put in a simple loop, that just increments a Variable. I wanted to see/show that any FileMaker script which takes more than a second will cause the rainbow to appear/reappear. It takes 55,000 loops on my early 2009 iMac 2.93 GHz. You may need less; or just wait a bit longer.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.