Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

macuser154

macrumors 6502
Original poster
Jan 17, 2009
372
0
UK
I am writing a script that will spawn a dialog box 1000 times then quit. The problem I'm having is that whenever a dialog box comes up a button shows up on the dialog box and I can't have the user pressing "OK" 1000 times. So is there a way to just have a dialog box appear and then disappear without the user clicking a button?

Code:
set LoopDialog to "Window"

repeat 1000 times
	display dialog LoopDialog
end repeat
 
  1. Open your AppleScript Editor.
  2. Choose File > Open Dictionary...
  3. Select the "Standard Additions" listed item.
  4. Select the "User Interaction" suite (left column).
  5. Select the "display dialog" command (middle column).
  6. Read the "giving up after integer" summary.
 
  1. Open your AppleScript Editor.
  2. Choose File > Open Dictionary...
  3. Select the "Standard Additions" listed item.
  4. Select the "User Interaction" suite (left column).
  5. Select the "display dialog" command (middle column).
  6. Read the "giving up after integer" summary.

I tried that but I can't seem to get it to give up after anything less than a second. If I type in milliseconds (0.01) then the box stays there indefinitely.
 
I tried that but I can't seem to get it to give up after anything less than a second.

You can't. It won't.


Exactly what are you trying to accomplish? I can't think of any reason to display a dialog 1000 times non-interactively with a 10 ms timeout. Humans can't see that fast, so the net effect would be the same as displaying a flickering non-interative dialog-shaped thing for 10 secs. What purpose does that serve?
 
You can't. It won't.


Exactly what are you trying to accomplish? I can't think of any reason to display a dialog 1000 times non-interactively with a 10 ms timeout. Humans can't see that fast, so the net effect would be the same as displaying a flickering non-interative dialog-shaped thing for 10 secs. What purpose does that serve?

It is supposed to be a type of performance tester, like Let1kWindowsBloom. The script starts, displays 1000 dialog boxes, then tells you how long it took.
 
It is supposed to be a type of performance tester, like Let1kWindowsBloom. The script starts, displays 1000 dialog boxes, then tells you how long it took.

It'll take 1000 seconds :D

AppleScript won't be what you want to use for this type of performance test. It's not designed to do what you want simply put. You might want to get Xcode installed and build from there.
 
It'll take 1000 seconds :D

AppleScript won't be what you want to use for this type of performance test. It's not designed to do what you want simply put. You might want to get Xcode installed and build from there.

Hehe :D. I was trying to do it in AppleScript cause I don't know how to code, I've played with AppleScript in the past so I thought I'd give it a shot.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.