I have a problem using a script that worked perfectly under OS 9 to work in the classic environment of OS X. The reason I have to use this script in classic mode and not in OS X itself is that it is activated by an OS 9 application (written in Omnis 7, for those who are interested). The basic problem is very easy to reproduce using the following example:
Tell application “Finder”
name of every process
end tell
I’ve executed this script in the classic and OS X script editor with the event log open, resulting in this:
Using Script editor 1.9 (for OS X using Applescript 1.9.1):
tell application “Finder”
get name of every process
end tell
tell application “System Events”
get name of every process
→ {“loginwindow”, “Dock”, “SystemUIServer”, “Finder”, “DragThing 4.2”, “Internet Reminder”, “Microsoft Outlook”, “”, “OMNIS 7”, “TeamNotify”, “Classic Support”, “System Events”, “Script Editor”, “Script Editor”}
end tell
But using Script editor 1.8.3 (for OS 9 using Applescript 1.8.3):
tell application “Finder”
get name of every process
open application file id “sevs”
«event ascrgdut»
get name of every process
→ Finder got an error: System version is too old to run the installed scripting system.
Is anybody able to give me the sollution for this problem?
I think the problem is that even in Classic Mode, the Finder is the X Finder - which gets its processes from System Events - which seems not to be available in Classic.
Here’s a Heath Robinson set-up that may work for you, but its final form will depend on what your script’s supposed to do. For a one-off task like your example, you could save the following script from the 1.9 (Mac OS X) Script Editor as a stay-open application:
on getProcessNames
tell application "System Events" to return name of every process
end getProcessNames
If this is saved under the name - say - “Process Name Getter”, then where your original OS 9 script said:
tell application "Finder"
name of every process
end tell
… you could now put:
tell application "Process Name Getter"
set processNames to getProcessNames()
quit
end tell
processNames
This is not particulary fast as you have to wait for the stay-open script to launch, but at least it works (on my machine). If you need to do more work outside the Classic environment, you could write handlers for that into the stay-open script too, and not tell it to quit until you’d finished with it.
Hi
It seems to me that we can also use " Finder " under OsX to know the name of the active applications, what allows to guard the same syntax for two environments:
tell application "Finder" to set ListOfPrecess to (name of every process)
My goal though is to build, compile and run the applescript from within my Omnis application (a classis developers environment with an external to make this possible). This way our customers won’t be needing an extra application on their clients, making upgrading and version control easier.
But if no other sollution is offered, I will follow your advise. So thanks again.
Fredo,
I’m not sure you understand the problem I have. But if the line of code you gave is running in classic mode under OS X, I would love to see the event log of script editor and I would like to know what versions of script editor and applescript you are using.
Marlene, I think Fredo is referring to the fact that you can use the “Finder” or “System Events” to achieve the same results in Mac OS X…
But as you can see from the result, that the “Finder” is calling "System Events anyway.
The script Fredo posted will complie in Classic with AppleScript 1.8.3, but it will either timeout or produce an error “Finder cannot get name of every process”
It’s true, thank you Greg, but the interest of this syntax is to be able to use the same script in the system X and 9 without changing anything (if there are no other peculiarities in the code specific in one of both systems).
It is etrange, because with AppleScript 1.6 and 1.4 there is no problem (directly under Os 9)…
Maybe that this problem comes from the use with the “classic” system ?!
And… maybe, with this syntax:
tell application "Finder" to set ListOfPrecess to (name of every application process)
tell application "Finder" to set ListOfPrecess to (name of every application process)
--> result =
tell application "Finder"
get name of every application process
open application file id "sevs"
«event ascrgdut»
get name of every application process
--> Finder got an error: System version is too old to run the installed scripting system. <-- that's a new one, I was getting a different error earlier
AS 1.8.3 in Classic OS 9.2.2. It may be my system though, Classic has been acting strange ever since I upgraded to OS X 10.2.8
OK, thank you Greg
I’m going to test this evening in my house with the system 10.2.6 and classic 9.2.2 (here, to the company, I work always under Os9 :? )…
I informs you…
Well Greg, I looked with the system 10.2.6, and the result is exactly the same that your… regrettably, because this complicates things a lot and obliges us to work with external scripts… :shock:
Mmm… It’s life…