Jump to content

Applescripting MYOB from Filemaker 6


This topic is 7866 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am using Applescript to control import of data into MYOB V 11, on a Mac OS9 platform, using the Perform Applescript command with a calculated field that contains the Applescript text.

Two problems

- is there any way of monitoring under Filemaker Script control what is going on in the Applescript, or detecting if it has failed?

- how do I stop the Applescript asking for the location of MYOB Accounting (the application that the FMP Applescript is trying to control) every time I run the FMP script that contains the Applescript?

Link to comment
Share on other sites

  • 2 weeks later...

1. You could have applescript set the value of a global variable that indicates some kind of progress or current action.

2. Are you using the "perform applescript" command from within a filemaker script? Usually, when you create the script, you will be asked to locate the application, and then won't be asked later when the script runs. However there are some situations where this doesn't happen. If the other application is running when you create the applescript, it's possible that it may not store the application's location. You may have to make sure that MYOB is not running, then go in and edit the script. When you save it again, you may be asked to locate the application. If so, then it will probably run without asking afterwards. Applescript is kind of flaky.

Link to comment
Share on other sites

Like Bob mentions, run your AppleScripts from within FileMaker. You will find, however, it is easier to debug your scripts using the Script Editor. Once it is debugged and tested, copy and paste the script into the "Perform AppleScript" script step in scriptmaker.

To insure a seamless user experience, turn on error capture, and immediately after the "Perform AppleScript" step, insert an If (Status(CurrentError) != 0) step. If an AppleScript error is encountered, the user should be prompted to contact you to fix the AppleScript.

Link to comment
Share on other sites

>> 1. You could have applescript set the value of a global variable that indicates some kind of progress or current action.

I had hoped that the Applecript dictionary provided by MYOB would return some kind of status value after the Applescript had run to determine what had happened. Unfortunately the documentation provided by MYOB on their Applescripts could easily be accomodated in a 64 byte memory chip. The only way that you can check the status of what has happened is to see whether MYOB has produced a log file, and then parse that log file for errors. This can be achieved with six Filemaker scripts, the TROI file and text plug-ins, and full knowledge of the list of possible error messages which could appear in the log file (by the way, MYOB don't actually publish these, so it does get to be something of a challenge).

Oh, and MYOB recommend that you perform a MANUAL backup of the file before executing any import function, whether this is under manual or Applescript control. They don't provide any method of restoring the file that you can use under Applescript, so if your import fails, you are toast.

Does this sound like a rant? You betcha!

>> 2. Are you using the "perform applescript" command from within a filemaker script? ... Applescript is kind of flaky.

Yes..... found that out too. What do you do when Applescript returns a 'Communications timeout' message, so you don't know how far your script got, nor what happened in the application you are trying to control.

If anyone has found a way round these issues, I'd love to hear about it.

Link to comment
Share on other sites

The communication timeout problem rears its ugly head every so often. It doesn't necessarily mean anything has gone wrong, just that it may have taken longer to run the applescript than Filemaker was prepared to wait. There is a "With Timeout of N seconds" construct that you can use to change the default timeout, but Filemaker seems to ignore this anyway.

Link to comment
Share on other sites

As far as I know applescript and apple events are identical in functionality, apple events is the technology upon which applescript is built. Applescript is the supposedly 'user-friendly' version of apple events. Apple events are more commonly used by applications programmers using real programming languages like C, C++ etc.

Link to comment
Share on other sites

I have found that there can be a significant difference between issuing a AppleEvent to run a AppleScript and running the AS from within a FileMaker script. Some of my scripts will only work when run outside of FileMaker. Conversely, AEs coming from outside of FileMaker are responded to much more slowly. Error trapping and timeouts can also function differently.

Link to comment
Share on other sites

This topic is 7866 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.