[futurebasic] Re: [FB] Re: Running a FM script (Applescript question)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2004 : Group Archive : Group : All Groups

From: Ben Jamin <benjamen@...>
Date: 28 Feb 2004 08:40:32 +1100
I do this sort of thing as well, here is the mystical bit you need:

Send an AppleEvent to FileMaker of type _"misc", _"dosc" with the direct (_"----") parameter
being the name of the script you want to run.  Depending on the version of FileMaker you
are using, the script may have to be available in the scripts menu before you can call it.

If it is a long script and you need to know when it has completed, I suggest you don't wait
around for the reply, just alter the script to send you back a "Completed" event as the last
step of the script (you will need to add an AE handler to your app for this).
Also I have found that breaking the script up into small sections and
calling each section one at a time is helpful.

There are also events for logging in with a password, doing custom searches (like the find screen - but without having to export the results to a text file), etc.
Most of FileMaker's features can be found by using Script Editor and opening FM's dictionary.
Anything you see in there is fair game.


Jamin



On Saturday, 28 February 2004 6:30 AM, Paul Bruneau <paul_bruneau@...> wrote:
>Thanks Ken, I have that part (I'm using RUN). I was wondering if I 
>could perform an applescript (or do some kind of mystical apple events 
>call to FM) right from FB thereby eliminating the "helper" compiled 
>applescript that I am currently setting up.
>
>PB
>
>On Friday, February 27, 2004, at 02:23 PM, Ken Shmidheiser
>wrote:
>
>> Paul asked
>>
>>> I need to have my FB program run a FileMaker script. What I am 
>>> starting
>>> to do is to create a runnable compiled Applescript that tells 
>>> Filemaker
>>> to run its script.
>>
>>
>> Paul,
>>
>> If your machines are running OS X, and you know the path to the 
>> compiled AppleScript, you can use the following (this assumes a file 
>> named "MyCompiledAppleScript.app" on the Desktop. On caveat: When you 
>> create a compile AppleScript, the .app extension is automatically 
>> appended the name, even if you can't see it. You need to have the .app 
>> on the name to launch it.
>>
>>
>> dim as str255 t
>> open "Unix", 2, "open ~/Desktop/MyCompiledAppleScript.app"
>> do : line input #2, t
>> until eof (2) : close  2
>>
>> do
>> handleevents
>> until  0
>>
>> Otherwise, you could try experimenting with something like this (I'm 
>> writing this in a hurry so this is untested):
>>
>> Include "Subs AppleScript.Incl"
>>
>> route _toAppleScript
>> print "tell application ""MyCompiledAppleScript.app"" to activate"
>> route _toScreen
>>
>>
>>
>> Of course there's always FB"s "Run" statement found on Page 493 of the 
>> Reference Manual.
>>
>> Have to run.
>>
>> Ken
>
>--
>