MacScript call different under OS 9.1 and OS X? 
Author Message
 MacScript call different under OS 9.1 and OS X?

Hello,

I have Microsoft Word 2001 running on 2 Macs with different operating
systems, OS9.1 and OSX.  On the computer that OSX is installed on,
OS9.1 had previously been installed, and Classic applications are
still recognized.  I am running a macro that makes a call to MacScript
on both machines.  What's interesting is that under OS9.1, the call to
MacScript works fine, but under OSX, I keep getting errors(run-time
errors).  Does anybody have ANY idea why this happens?  Is there a
chance that it's because I had OS9.1 previously installed on the
machine that is currently running OSX?  I am not that familiar with
Macs, and any help/advice on the issue would be greatly appreciated.
Thank you.

Regards,
Jung-Hoon Shin
Software Engineer
DYMO Corporation



Sat, 27 Dec 2003 07:52:25 GMT  
 MacScript call different under OS 9.1 and OS X?
I'm cross-posting this to the macword2001 newsgroup, as you're likely to get
better responses there.


Hello,

I have Microsoft Word 2001 running on 2 Macs with different operating
systems, OS9.1 and OSX.  On the computer that OSX is installed on,
OS9.1 had previously been installed, and Classic applications are
still recognized.  I am running a macro that makes a call to MacScript
on both machines.  What's interesting is that under OS9.1, the call to
MacScript works fine, but under OSX, I keep getting errors(run-time
errors).  Does anybody have ANY idea why this happens?  Is there a
chance that it's because I had OS9.1 previously installed on the
machine that is currently running OSX?  I am not that familiar with
Macs, and any help/advice on the issue would be greatly appreciated.
Thank you.

Regards,
Jung-Hoon Shin
Software Engineer
DYMO Corporation



Sat, 27 Dec 2003 08:15:28 GMT  
 MacScript call different under OS 9.1 and OS X?

Quote:

> I'm cross-posting this to the macword2001 newsgroup, as you're likely to
get
> better responses there.



> Hello,

> I have Microsoft Word 2001 running on 2 Macs with different operating
> systems, OS9.1 and OSX.  On the computer that OSX is installed on,
> OS9.1 had previously been installed, and Classic applications are
> still recognized.  I am running a macro that makes a call to MacScript
> on both machines.  What's interesting is that under OS9.1, the call to
> MacScript works fine, but under OSX, I keep getting errors(run-time
> errors).  Does anybody have ANY idea why this happens?  Is there a
> chance that it's because I had OS9.1 previously installed on the
> machine that is currently running OSX?  I am not that familiar with
> Macs, and any help/advice on the issue would be greatly appreciated.
> Thank you.

It may depend what you're doing with MacScript:

1) Calls to the Finder are likely to to not work properly.

2) Particularly anything referring to 'process' in the Finder - that simply
doesn't exist at the moment.

3) Any calls using a 3rd-party scripting addition (anything other than what
you find in Standard Additions) will not work since none has been carbonized
for OS X yet. And if they were, they' have to be in a different location. In
calls to a Classic app from a Classic app (e.g. A Classic script editor or
applet or Entourage or Word) they should work, but might not in VBA.

4) Most likely -- you could be using the 'path to' scripting addition to
help get a file path. Its parameters are very different in OS X, due to the
multi-user environment of OS X. See link below.

I might have ventured that VBA's MacScript always routed through the Finder
and would fail, but it doesn't. I used MacScript successfully in Classic
just two days ago.

Here's a link to a site that describes most of the changes and behavior of
AppleScript in OS X:

<http://www.AppleScriptSourcebook.com/index.html>

What is your applescript in MacScript? I might be able to help. AppleScript
is my area.

--
Paul Berkowitz
MVP Entourage/Outlook Express Mac

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.



Sat, 27 Dec 2003 11:45:21 GMT  
 MacScript call different under OS 9.1 and OS X?
Hi Paul,

Thank you so much for all your help.  I felt like I hit a dead wall
before your response.  Here are a couple of functions where calls to
MacScript are being made:

Public Sub CheckIsDLSRunning()
Dim ScriptText As String

ScriptText = "tell application ""Finder""" + vbCr + _
             "try" + vbCr + _
             "  get process """ + DLSFileName + """" + vbCr + _
             "  return false" + vbCr + _
             "on error" + vbCr + _
             "  return true" + vbCr + _
             "end try" + vbCr + _
             "end tell"

CloseDLSOnTerminate = MacScript(ScriptText)
End Sub

' Script that hides DLS main window form desktop
Public Sub HideDLS()
Dim ScriptText As String

' this will run DLS if not
ScriptText = "tell application " + DLSFullName + vbCr + _
             "get app dir" + vbCr + _
             "end tell" + vbCr + _
             "" + vbCr

'hide DLS
ScriptText = ScriptText + _
             "tell application ""Finder""" + vbCr + _
             "try" + vbCr + _
             "set visible of (get process """ +
DLSFileName + """) to false" + vbCr + _
             "on error" + vbCr + _
             "set visible of (get process """ +
DLSFileName + """) to false" + vbCr + _
             "end try" + vbCr + _
             "end tell"

MacScript (ScriptText)

End Sub

'Close or show DLS on terminate
Public Sub CloseDLS()
Dim ScriptText As String

ScriptText = "tell application" + DLSFullName + vbCr +
_             "if " + CStr(CloseDLSOnTerminate) + "
then" + vbCr + _
             "close saving no" + vbCr + _
             "else" + vbCr + _
             "tell application ""Finder""" + vbCr + _
             "set visible of (get process """ +
              DLSFileName + """) to true" + vbCr + _
             "end tell" + vbCr + _
             "end if" + vbCr + _
             "end tell"

MacScript (ScriptText)
End Sub

ANY help or advice on how to get this to work would be GREATLY
appreciated.  Thanks again.

Jung-Hoon Shin
Software Engineer
DYMO Corporation

Quote:



> > I'm cross-posting this to the macword2001 newsgroup, as you're likely to
>  get
> > better responses there.



> > Hello,

> > I have Microsoft Word 2001 running on 2 Macs with different operating
> > systems, OS9.1 and OSX.  On the computer that OSX is installed on,
> > OS9.1 had previously been installed, and Classic applications are
> > still recognized.  I am running a macro that makes a call to MacScript
> > on both machines.  What's interesting is that under OS9.1, the call to
> > MacScript works fine, but under OSX, I keep getting errors(run-time
> > errors).  Does anybody have ANY idea why this happens?  Is there a
> > chance that it's because I had OS9.1 previously installed on the
> > machine that is currently running OSX?  I am not that familiar with
> > Macs, and any help/advice on the issue would be greatly appreciated.
> > Thank you.

> It may depend what you're doing with MacScript:

> 1) Calls to the Finder are likely to to not work properly.

> 2) Particularly anything referring to 'process' in the Finder - that simply
> doesn't exist at the moment.

> 3) Any calls using a 3rd-party scripting addition (anything other than what
> you find in Standard Additions) will not work since none has been carbonized
> for OS X yet. And if they were, they' have to be in a different location. In
> calls to a Classic app from a Classic app (e.g. A Classic script editor or
> applet or Entourage or Word) they should work, but might not in VBA.

> 4) Most likely -- you could be using the 'path to' scripting addition to
> help get a file path. Its parameters are very different in OS X, due to the
> multi-user environment of OS X. See link below.

> I might have ventured that VBA's MacScript always routed through the Finder
> and would fail, but it doesn't. I used MacScript successfully in Classic
> just two days ago.

> Here's a link to a site that describes most of the changes and behavior of
> AppleScript in OS X:

> <http://www.AppleScriptSourcebook.com/index.html>

> What is your applescript in MacScript? I might be able to help. AppleScript
> is my area.



Sun, 28 Dec 2003 01:31:55 GMT  
 MacScript call different under OS 9.1 and OS X?
On 7/10/01 10:31 AM, in article

Quote:

> Hi Paul,

> Thank you so much for all your help.  I felt like I hit a dead wall
> before your response.  Here are a couple of functions where calls to
> MacScript are being made:

I've tried my best, but there's no way.

As I said, some things in Finder scripting simply aren't working in OS X,
and the usual alternative of using a scripting addition has one gap: there
is none that can set 'visible' of a running application, even though there
is one that can 'get process' without the Finder, and that still works for
apps running in Classic. I.e., even though other aspects of 'process' are
available to this scripting addition, hiding and revealing running
applications are not. And every trick I tried to access it from with Classic
(loading a compiled classic script, running a classic applet) failed on this
'visible' thing.

You use the 'process' in every subroutine. (In later releases of OS X, Apple
will certainly be replacing 'process' by something else or will be able to
implement it. But 'process' goes right to the heart of the change to OSX. A
running process or application is simply utterly different in OS X.) The
very thing you're trying to do here (setting 'visible' of 'process') cannot
be done with the OS X Finder, or even, unfortunately, with the Classic
Finder. They can be done in pure AppleScript in OS 9.1, compiled there as a
self-standing compiled applescript, but the 'set visible of process whatever
to false' line won't work in the Classic environment.

You can't do anything involving 'process'  in VBA because the applescripting
in a MacScript command must be compiled on the fly, and won't work in OS X
or Classic.

I had hoped that you could instead call an actual compiled applescript or
classic applet from VBA MacScript to do the work. Hey can access the Classic
Finder - even 'process' in the Finder. But I've been struggling all day with
this, and there simply is no way to hide or reveal an application, Classic
or otherwise, in OS X . I'm really sorry. You're going to have to wait until
'process' is fixed in OS X, or go back to using OS 9.1.

I'm very sorry I couldn't be more help.

--
Paul Berkowitz



Sun, 28 Dec 2003 12:32:01 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Diff between Pocket PC OS / Handled PC OS/ Embedded NT OS

2. English OS to Japanese OS

3. Templates on different OS's

4. behavior of Getlocale() on different versions of OS

5. Building Applications for different OS Languages....

6. Installing your VB program on a different O.S?

7. Is possible one .exe run on different OS?

8. Scrollbar width on different machines/OS

9. CreateFile API call with VB4(32) on Win95 OS

10. Calling OS/2 program from winos2

11. VB calling OS/2 routine?

12. Calling sub routine dependent on OS

 

 
Powered by phpBB® Forum Software