Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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


This topic is 5487 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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...
Posted

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

Posted

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.

Posted

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

Posted

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

Posted

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.

This topic is 5487 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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