Intel Mac vs. Power Mac. New insights on applescript behaviour?

Hi all,

I am wondering if there are any scripters who are facing difficulties / problems / unexpected issues with Applescripts written on a PowerMac but running on an Intel Mac.
And of course if you found any solutions or workarounds for these problems.
Also curious if these issues are related to the app, the OS or the way Intel works.

Hope to hear more about this general question, I didn’t find much information on this. Posted some issues I am facing here and there, but did not get much response. Maybe Intel Macs are a bit to new?

Thanks,
Kjeld

Hi Kjeld, I hoping this forum posting will grow. I can’t do the simplest of things with applescript on Intel. An example follows. Mind you, It doesn’t matter if I write this script from scratch on the Intel machine or not. It also doesn’t make any difference whether I save it as an application bundle, run it from script editor or anything else. Check it out:

set saveFilePath to "NewsPaper:GFX_Transfer:Evans_Brad:Advisory.rtf"

tell application "TextEdit"
	set x to make new document
	set the text of x to "Hello World"
	save x in saveFilePath
	close x
	quit
end tell

Go ahead and try it out yourself on a PPC and then an Intel, of course you’ll have to type in your own path.
The script (the really basic script) fails on figuring out the path to save the file into…(if you add-on to the path name an ‘as alias’ it works on the PPC, but still not on the Intel)

I’ve posted this question before with a lot of responses but zero answers. I’m not certain that Apple put AppleScript through its paces on Intel machines just yet…although TextEdit and Text Edit Plus seem to be the only regular issues cropping up.

In Script debugger 4 you get a little sign if its powerPC only in the dictionary, its only a problem with scripting additions, or applescript own language as applications run Rosetta if needed. The thing is on my intel mac, you ask system info what machine type it is and it say PowerPC. Does someone know a method of getting if its Intel. Maybe a System Attribute or UNIX call.

Finding a work around is a problem most of the time you don’t want to call an application, becuase of speed. Hope its better with Leopard, not too far away.

This works on my intel 20in imac?


set saveFilePath to ((path to desktop) & "xxx.rtf" as text)
tell application "TextEdit"
	set x to make new document
	set the text of x to "Hello World"
	save x in saveFilePath
	close x
	quit
end tell

Well, it doesn’t work on a MacPro.

Maybe it’s good to mention some system and hardware specs? One of the issues I had troubles with did work on an Intel iMac, but not on a MacPro / OS 10.4.9.

Well it works on my macpro!! 2x3 ghz dual-core intel zenon
I am assuming you already have a document created on the desktop called xxx.rtf
If you want to create a text file on the fly then use


set thetext to "Hallo World"
writetofile(thetext)

on writetofile(thetext)
	set saveFilePath to ((path to desktop) as text) & "zzz.txt"
	open for access file the saveFilePath with write permission
	write thetext to file the saveFilePath starting at eof
	close access file the saveFilePath
end writetofile

Weedinner,

this sort of works but it stops on save dialog


set saveFilePath to ((path to desktop) & "xxx.rtf" as text)
tell application "TextEdit"
   set x to make new document
   set the text of x to "Hello World"
   save x in saveFilePath
   close x
   quit
end tell

this works fine the big difference here is that your not using text edit


set thetext to "Hallo World"
writetofile(thetext)

on writetofile(thetext)
	set saveFilePath to ((path to desktop) as text) & "zzz.txt"
	open for access file the saveFilePath with write permission
	write thetext to file the saveFilePath starting at eof
	close access file the saveFilePath
end writetofile

Model: MacBook Pro Lapzilla 2.16Ghz Core Duowha
AppleScript: 2.11
Browser: Firefox 2.0.0.1
Operating System: Mac OS X (10.4)

Hey Guys,

Was thinking of getting myself a new Macbook Pro. Does this mean that I won’t be able to do applescripting on it???
That would be bad…

A friend of mine does alot of NT scripting for his Toshiba laptop. But now since Vista came out, he has to re-think about upgrading because his scripts won’t run on it. Vista uses some different coding language. I hope the same thing hasn’t happened to Apple OS
That would seriously be very bad

Julz

You will still be able to do applescripting on a MBP I have one and I do scripting on it. However scripts will run slower for applications that are not universal as they will need to be translated through Rosetta .

mm

Model: MacBook Pro Lapzilla 2.16Ghz Core Duo
AppleScript: 2.11
Browser: Firefox 2.0.0.1
Operating System: Mac OS X (10.4)

Is urs an Intel based Mac??

Are you talking about scripts for software that was built to run on a PPC based mac??? Are those the ones that slow down???

Yes! All MacBookPros are Intel based

Yes and yes

So I guess all I need to do is make sure that whatever software I use on my Mac are new versions created to run on Intel based machines…:stuck_out_tongue:

Perhaps its a problem with Text Edit? I am not a programmer but if you look at the properties for the document created you can’t set certain criteria.



set saveFilePath to (path to desktop)
tell application "TextEdit"
	set x to make new document with properties {name:"ddd", text:"asas", path:saveFilePath}
	get properties of document 1
	end tell

returns
{modified:false, path:missing value, text:“asas”, class:document, name:missing value}
My first post was confused…sorry. The file can’t be created on an intel but it can on a PowerMac. If the file is already created on an intel it will write to that file.
I