1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

No buttons on AppleScript dialog

Discussion in 'Mac Programming' started by macuser154, Aug 18, 2010.

  1. macrumors 6502

    #1
    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
     
  2. macrumors 603

    #2
    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.
     
  3. macrumors 6502

    #3
    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.
     
  4. macrumors 603

    #4
    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?
     
  5. macrumors 6502

    #5
    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.
     
  6. Moderator emeritus

    angelwatt

    #6
    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.
     
  7. macrumors 6502

    #7
    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.
     
  8. macrumors 603

    #8
    Is your goal to write a benchmark, or to run a benchmark?
     
  9. macrumors 6502

    #9
    I wanted to write an app that performed a benchmark on a users machine by spawning 1000 windows.
     

Share This Page