GetChar status, & converting scripts from OS 9 to OS X?

My two questions (details below):
1) What is the current working status of GetChar?
2) What changes are necessary to convert an OS 9 script to work in OS X?


Background:
I have been using the Mac OS 9 version of PTB and Matlab 5.2.1 running in Classic (on G4
and G5 PPC iMacs). This has worked successfully so far for a series of experiments I've
done.

However, I'm probably about to have to run the next experiment on Intel Mac Minis, which
won't be able to run Classic (but WILL be able to boot Windows).
So I need to convert my scripts from OS 9 PTB to work in OS X PTB, or convert them to
work in Windows, or give up and start over from scratch in RealBasic or something.


Details on Question 1:
My scripts rely heavily on GetChar as the experiments call for participants to memorize
words and then later type in each entire word, using the keyboard, in response to a cue.
Early on, I tried writing something that used kbcheck to do this, and while kbcheck
seemed to work alright for participant responses of a single keypress, it proved entirely
inadequate for recording an entire word that was typed in.
I know that as of at least a year ago there were major problems with getting GetChar
working, but I'm not sure what the current status is.

Details on Question 2:
Is there a guide/tutorial/example or anything online that demonstrates the major changes
necessary in converting an OS 9 to an OS X script? I thought I remembered seeing
something along those lines once, but can't find it again now. I understand that the OS 9
and X versions of PTB use different methods to display ("draw") stuff on the screen, so I
know that'll all have to be changed at least, and probably other aspects too. At least
seeing a few examples of the same script in OS 9 and OS X would be really helpful.

thanks very much,
Jason Finley
UCLA (soon to be UIUC)
Thanks Mario, Allen, for the helpful info.
I have only one more question before I get to work on conversion:
Is the Windows version of PTB currently identical in implementation
to either the Mac OS 9 or the Mac OS X version?
I'm trying to figure out what changes I would need to make to convert
an OS 9 script to a Windows script.
Thanks,
Jason


On Jul 30, 2006, at 4:53 PM, Mario Kleiner wrote:

> Hi Jason & Allen,
>
> reg. 1: Mathworks hasn't released a Intel-Mac native version of Matlab
> and afaik except for the statement that they are working on it, they
> didn't provide any release date for the new version. So the matlab
> -novjm mode is the only way of running Matlab on Intel --> No GetChar
> at the moment. What you could do if you must run on an Intel-Mac: Use
> Apples Bootcamp to install M$-Windows and run Windows PTB.
>
> Regarding porting oldPTB->newPTB. I think the standard commands
> KbCheck, KbWait, GetMouse, GetClicks, SetMouse, ShowCursor,
> HideCursor, WaitSecs and GetSecs are fully compatible and have same
> behaviour. I don't know about the M-File functions but assume that
> most are fully compatible?
>
> The Screen command differs in its internal implementation, but most
> code should work with minimal change.
>
> If you want to get old code working with minimal effort, it might be
> enough to simply add Screen('Preference','EmulateOldPTB',1) at the top
> of your script. This will enable backward compatible Offscreen window
> support, Screen('WaitBlanking') and immediate drawing to the screen.
> If it works for your old code, you're done. If it doesn't, then you
> need to port your code to the new style.
>
> The recommended way (for new code) is to switch to the new drawing
> model:
>
> Instead of doing a
>
> Screen('WaitBlanking');
> ...then all Screen drawing commands...
>
> you do a
>
> ...all Screen drawing commands...
> Screen('Flip');
>
> -> All drawing commands draw into an invisible backbuffer.
> -> Screen('Flip') makes the backbuffer visible in sync with
> next vertical retrace. Flip can do a lot more interesting things, so
> read the help for "Screen Flip?" carefully and have a look at the
> PsychDemos. The new drawing model is much more poweful: More robust
> presentation timing, guaranteed tear-free, lots of new functions that
> only work with the new model.
>
> I think there are minor differences in some drawing commands, but
> usually only when it comes to seldom used special options.
>
> best,
> -mario
>
> --- In psychtoolbox@yahoogroups.com, "Allen W. Ingling"
> <Allen_Ingling@...> wrote:
> >
> > On Jul 27, 2006, at 10:27 PM, Jason Finley wrote:
> >
> > > 1) What is the current working status of GetChar?
> >
> > Dear Jason,
> >
> > GetChar in the Psychtoolbox Beta fork should work now with OS X and
> > the MATLAB IDE, the standard default MATLAB configuration.
> >
> > GetChar does not yet work with OS X on Intel run in a terminal
> window
> > with the -nojvm flag. There are two possible fixes for this.
> >
> > 1. Mathworks releases an updated MATLAB fully compatible with OS
> X on
> > intel, which does not need to be run in a terminal window with the -
> > nojvm flag. (Has this already happened?)
> >
> > 2. I conditionally enable the Cocoa implementation of GetChar when
> > running on intel. There is a bug associated with Cocoa GetChar when
> > run without the MATLAB IDE which needs to be stomped out first. No
> > prediction right now about when that might happen.
> >
> > Option 2 there would still be useful after Mathworks fixes MATLAB on
> > intel because we could use it in the future for other PTB bindings,
> > Octave or Mathematica or whatever. It's preferred over the Java
> > implementation because of a more precise timestamp provided in the
> > second return argument.
> >
> > > 2) What changes are necessary to convert an OS 9 script to work in
> > > OS X?
> >
> > With respect to GetChar: There is a new function "ListenChar" which
> > directs keyboard input to the GetChar queue. If ListenChar is not
> > called before GetChar then characters might be directed to a queue
> > other than the GetChar event queue, such as the MATLAB command
> > window. See "help GetChar" and "help ListenChar" for more
> information.
> >
> > The test "TestGetChar" now pounds hard on GetChar. I recommend first
> > running TestGetChar on your computer before using GetChar.
> > TestGetChar also could serve as an example of how to use GetChar on
> > OS X until we either write or port a demo for GetChar to OS X.
> >
> > Beyond GetChar: I don't know where to find a guide or tutorial on
> > that. It would be extremely useful. Maybe someone else can help.
> >
> > best,
> >
> > Allen
> >
> >
> >
> > On Jul 27, 2006, at 10:27 PM, Jason Finley wrote:
> > >
> > >> My two questions (details below):
> > >> 1) What is the current working status of GetChar?
> > >> 2) What changes are necessary to convert an OS 9 script to
> work in
> > >> OS X?
> > >>
> > >> Background:
> > >> I have been using the Mac OS 9 version of PTB and Matlab 5.2.1
> > >> running in Classic (on G4
> > >> and G5 PPC iMacs). This has worked successfully so far for a
> > >> series of experiments I've
> > >> done.
> > >>
> > >> However, I'm probably about to have to run the next experiment on
> > >> Intel Mac Minis, which
> > >> won't be able to run Classic (but WILL be able to boot Windows).
> > >> So I need to convert my scripts from OS 9 PTB to work in OS X
> PTB,
> > >> or convert them to
> > >> work in Windows, or give up and start over from scratch in
> > >> RealBasic or something.
> > >>
> > >> Details on Question 1:
> > >> My scripts rely heavily on GetChar as the experiments call for
> > >> participants to memorize
> > >> words and then later type in each entire word, using the
> keyboard,
> > >> in response to a cue.
> > >> Early on, I tried writing something that used kbcheck to do this,
> > >> and while kbcheck
> > >> seemed to work alright for participant responses of a single
> > >> keypress, it proved entirely
> > >> inadequate for recording an entire word that was typed in.
> > >> I know that as of at least a year ago there were major problems
> > >> with getting GetChar
> > >> working, but I'm not sure what the current status is.
> > >>
> > >> Details on Question 2:
> > >> Is there a guide/tutorial/example or anything online that
> > >> demonstrates the major changes
> > >> necessary in converting an OS 9 to an OS X script? I thought I
> > >> remembered seeing
> > >> something along those lines once, but can't find it again now. I
> > >> understand that the OS 9
> > >> and X versions of PTB use different methods to display ("draw")
> > >> stuff on the screen, so I
> > >> know that'll all have to be changed at least, and probably other
> > >> aspects too. At least
> > >> seeing a few examples of the same script in OS 9 and OS X
> would be
> > >> really helpful.
> > >>
> > >> thanks very much,
> > >> Jason Finley
> > >> UCLA (soon to be UIUC)
> > >>
> > >
> >
>
>
>