• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: delay 1 millisecond in Panther
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: delay 1 millisecond in Panther


  • Subject: Re: delay 1 millisecond in Panther
  • From: Bill <email@hidden>
  • Date: Fri, 13 Feb 2004 23:35:30 +0800

At 11:03 PM -0800 2/12/04, Christopher Nebel wrote:

Well, it won't return for at least one millisecond. :-) Seriously, "delay"'s accuracy is not guaranteed, and at best has a resolution of 1/60th of a second. If you need guaranteed millisecond timing, you shouldn't be using AppleScript. Heck, you probably shouldn't be using a normal consumer OS.

Chris,

Thanks for your information :)

Indeed, my friend needs tools to design a psychological experiment (if possible, using Mac OS X). Briefly, display a cue word for several milliseconds, then the cue word disappears for several millisecond; afterward, the target word displays for several milliseconds and then disappears. The aim is to measure the "priming effect" (correct term?).

My suggestion is applescript and TextEdit.app, here is the script:

-- script starts

property cueWord : "cue"
property targetWord : "target"

tell application "TextEdit"
activate
make new document at front
-- place the window in a specified position
set bounds of window 1 to {37, 41, 599, 601}
tell document 1
-- put a dummy space
set text 1 to space
-- set font size to 127 points
set size of text 1 to 127
-- display cue word for 0.02 second
set text 1 to cueWord
delay 0.02
-- display blank for 0.5 second
set text 1 to space
delay 0.5
-- display target word for 1 second
set text 1 to targetWord
delay 1
-- display blank again
set text 1 to space
end tell
-- close window
close window 1 without saving
end tell

-- script ends

In the above script, is TextEdit.app really display "cue" for 0.02 second?

Further, will the display (CRT or LCD), CPU usage & free RAM size affect the performance?


Smile is slightly better at that, its "smilepause x" makes a good job for x = 1 millisecond (expect an actual pause between 1 and 2 milliseconds). Also, its "chrono" has a good resolution, e.g. OMM (G3/900) it beats 5000 Hz.

Unlike "delay", "smilepause" lets the application responsive: this is usually helpful but on the other hand it makes "smilepause" depend still more than "delay" on the activity of the other processes.

Emmanuel,

Thanks :)

Do you think Smile is suitable for the task?


bill
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: delay 1 millisecond in Panther
      • From: Timothy Bates <email@hidden>
    • Re: delay 1 millisecond in Panther
      • From: Emmanuel <email@hidden>
  • Prev by Date: Re: Bytes into integer
  • Next by Date: Re: delay 1 millisecond in Panther
  • Previous by thread: Re: delay 1 millisecond in Panther
  • Next by thread: Re: delay 1 millisecond in Panther
  • Index(es):
    • Date
    • Thread