Re: calling a Classic osax from X
Re: calling a Classic osax from X
- Subject: Re: calling a Classic osax from X
- From: Jon Pugh <email@hidden>
- Date: Tue, 22 Apr 2003 21:21:26 -0700
At 6:50 PM -0700 4/22/03, matt neuburg wrote:
>
According to a note in the online help, it's possible, by judicious use of
>
"using terms from", to call a Classic osax from a script running under X.
>
Could someone show me an example? For instance, please show me how to say
>
"min monitor depth" from a script running under X. m.
AFAIK, you need to send the osax AppleEvent to a classic app in order to execute a classic osax. A simple classic stay open applet suffices for this purpose. Then you wrap your osax call in a tell "classic app" block.
However, I can't seem to get classic osaxen terms recognized using terms or not.
I can call them however, for example (<< and >> are opt-\ and opt-|):
tell application "Classic Applet"
<<event JonsScrC>> {screen id:1, screen size:{640, 480}}
end tell
This will set the main screen's resolution, but also seems to return a parameter error, probably from Carbon Display Manager calls. Doing a "screen list" seems to work, and uses the syntax from the X version of Jon's Commands. However, the classic version works better than the X version because of the way they've implemented the display stuff under Carbon versus the blue box.
Anyhow, here's a script which uses a completely empty classic applet and Jon's Commands on both X and in Classic to change the screen resolution. It's pretty skanky, but it works.
tell application "Classic Applet"
set sc to screen list
set mainScreen to item 1 of sc
set msid to screen id of mainScreen
set msri to resolution index of mainScreen
try
<<event JonsScrC>> {screen id:msid, screen size:{640, 480}}
on error number -50
end try
beep
try
<<event JonsScrC>> {screen id:msid, resolution index:msri}
on error number -50
end try
end tell
Man, I wish we could do high bit characters on this lamo list. We should all go back to MacScript where you can. ;)
Jon
_______________________________________________
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.