• 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: A method of using Power PC OSXEN in an Intel environment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A method of using Power PC OSXEN in an Intel environment


  • Subject: Re: A method of using Power PC OSXEN in an Intel environment
  • From: has <email@hidden>
  • Date: Fri, 23 Mar 2007 16:02:12 +0000

Walter Bushell wrote:

Basically you create a stay open application with a handler that
calls the desired scripting addition and launch it before running
your script. This script must be compiled on as a PPC application
that is on a PPC machine or with Script Editor (or other) set to use
Rosette.

The extra handler is technically unnecessary as you can send your osax events directly to the PPC process. The tricky part is getting your osax commands to compile, as the AppleScript component only loads dictionaries from osaxen compiled for the architecture under which the AS component is currently running; thus PPC-only osaxen will be ignored if Script Editor is running natively on i386.


Solutions:

- Set Script Editor to run as PPC (Finder > File > Get Info > Open using Rosetta); that way the AS component can see PPC-only osaxen and get their dictionaries, e.g.:

	tell app "PPC process" to GetMilliSec


- Use raw AE codes (you can use the ASDictionary app available on appscript's Downloads page to obtain these; just drag-n-drop an osax onto it and choose the 'plain text' format), e.g.:


	tell app "PPC process" to «event MSecMSec»


- Use a 'using terms from' block to specify the osax whose terminology should be used, e.g.:


tell application "PPC process"
using terms from application "MacHD:Users:has:Library:ScriptingAdditions:GetMilliSec.osax"
GetMilliSec
end using terms from
end tell


Note: this one relies on undocumented behaviour (I'm guessing AS ignores the 'application' specifier part and passes the path string straight to OSAGetAppTerminology, which can get terminology for both osaxen and apps), so you should really check with Chris Nebel that no unexpected nasties could result from using it.


- Write a simple (couple dozen lines of C code) PPC-only faceless background app that installs an 'ascrgdte' event handler, and have that handler search through all the ScriptingAdditions folders for installed osaxen, use OSAGetAppTerminology to get their aetes, and return them as a list. That'll allow AS to get the osax dictionaries from the application itself, e.g.:


	tell application "PPC process"
		GetMilliSec
	end tell


For example here is a demo script which also shows limitations of
this method as it takes 17 millisec to run on a Core 2 Duo 2
GigaHertz macBook.

Sending Apple events to another process is always more expensive (maybe 20x) than sending them to the host process. (Though console yourself with the thought that it was a hundred times worse in the pre-OS X days.) For short-duration commands that must be called many times in a performance-critical portion of your program, this can be a problem; OTOH, if high performance is a major requirement, AppleScript probably isn't the best language to be using in the first place.


HTH

has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
http://appscript.sourceforge.net/objc-appscript.html

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Prev by Date: Re: Puzzling display dialog
  • Next by Date: Re: Two quick questions
  • Previous by thread: A method of using Power PC OSXEN in an Intel environment
  • Next by thread: Quark - Find and Replace -addendum
  • Index(es):
    • Date
    • Thread