• 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: processor identification
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: processor identification


  • Subject: Re: processor identification
  • From: Yvan KOENIG <email@hidden>
  • Date: Sun, 17 May 2009 14:56:10 +0200


Le 17 mai 2009 à 14:40, Axel Luttgens a écrit :

Le 17 mai 09 à 12:14, Yvan KOENIG a écrit :

Hello

I'm writing a script transfering datas from an AppleWorks database to a FileMaker one.

Alas, FileMaker behaves differently when it receive an AppleWorks clipboard on a PPC machine or on a i386 one.

I have a workaround but it requires extra steps so I wish to be able to drive the script behavior according to the host processor;

Is it a way to get the processor kind from the script ?

I assume that I may find it in some globals (those used by "About this Mac" for instance).

Hello Yvan,

Perhaps are you more specifically interested in the "endiannes" of the box, i.e. whether it is little endian or big endian one?
In which case
do shell script "sysctl -n hw.byteorder"
might prove sufficient.
It should return "1234" for little endian boxes (all Intel processors), and "4321" for big endian boxes (default mode for PPCs).


HTH,
Axel

Thanks

The problem is that FileMaker Pro is unable, on IntelInside machines to grab styles embedded in an AppleWorks clipboard.

Given that, my workaround is to paste in a TextEdit document then cut the data from this document.
Then FileMaker is happy with the TextEdit Clipboard.


On entry,  the script executes:

	set intelInside to CPU type of (system info) contains "Intel"
	if intelInside then my activateGUIscripting()

later it executes:

	if intelInside then
		tell application "TextEdit"
			activate
			make new document
			set TEname to get name of document 1
		end tell
	end if

In the main loop it does:

	if intelInside then (*
Auxiliary paste-cut in/from a TextEdit document
			*)
				tell application "TextEdit" to tell document TEname
					my shortCut("TextEdit", "vax", "c")
				end tell
			end if

Just before exit, it does:

if intelInside then tell application "TextEdit" to close document TEname without saving

And the required GUIscripting handlers are:

--=====

on activateGUIscripting()
tell application "System Events"
if not (UI elements enabled) then set (UI elements enabled) to true (* to be sure than GUI scripting will be active *)
end tell
end activateGUIscripting


--=====
(*
==== Uses GUIscripting ====
*)
on shortCut(a, t, d)
local k
tell application a to activate
tell application "System Events" to tell application process a
repeat with k in t
if d = "c" then
keystroke (k as text) using {command down}
else if d contains "c" then
if d contains "s" then
if d contains "k" then
keystroke (k as text) using {command down, shift down, control down}
else
keystroke (k as text) using {command down, shift down}
end if
else if d contains "k" then
keystroke (k as text) using {command down, control down}
end if
end if
end repeat
end tell
end shortCut


--=====

This late handler may appears to be an ugly one but, it does all what I need and due to the tests and the repeat lup, it inserts automatically the small delay needed between the paste, select all and cut commands.

Yvan KOENIG (from FRANCE dimanche 17 mai 2009 14:56:05)



_______________________________________________
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
References: 
 >processor identification (From: Yvan KOENIG <email@hidden>)
 >Re: processor identification (From: Axel Luttgens <email@hidden>)

  • Prev by Date: Re: processor identification
  • Next by Date: Re: Home to top of the list.
  • Previous by thread: Re: processor identification
  • Next by thread: TextEdit preferences
  • Index(es):
    • Date
    • Thread