From a script in a Main DB I need to call another script from a target DB, that my main script chooses based on some algorithm. I attempted to run the target script in a very simple environment (on an external disk, single user, no network), using all the following ways:
a) using Perform Script after setting a $variable in External Data Source. But this works only (from FMP 16) for the first chosen target DB; afterwords the chosen target DB is locked into the Data Source and the only way I know to change it is to close the main DB and open it again.
b) using Open URL script step with fmp protocol. It works with some limits i.e. b.1) only if the target DBs is within the startup disk in the file system subtree with root <my home>/Documents (fmp://~/..../target DB), or b.2) only if the target DBs is addressed on the network (fmp://<net address>/target DB)
NB: Instead it does NOT work if the target DB is anywhere else outside of fmp://~/... namely on an external disk (and aliases to target DB do not work)
c) using Open URL script step with file. From my previous experience Open URL is able to open any file (txt, pdf, .mp4, etc.) anywhere in the startup or external disk... but not FMP files themselves! It just ignores them returning no error
d) using Perform AppleScript script step: it does not work even when using the same simple script that I first successfully tested in the Script Editor: Perform AppleScript returns a mysterious error -2741
e) using Send Event script step: during its setup the Application FileMaker Pro Advanced appears greyed out in the Applications directory: no way to choose it (obviously any other application is selectable...)
In summary: since my purpose is to parametrically call another script in a target DB that must lay in an external disk, I had to:
1. discard d) and e) because they just don't work
2. discard b) and c) because my DBs are on an external disk. If at least c) had worked I could combine them as follows:
Open URL with file:///.../target DB - and then:
Open URL with fmp://$/target DB?script=<target script> (this line works fine, e.g. if I first manually open the target DB)
This would be an alternative to the missing form
Open URL with fmp:///.../tagret DB?script=<target script>
3. today I'm left with "solution" a) modified by a workaround: my workaround implements multiple calls to different target DBs by exiting and entering again the main DB each time, with the support of an ad hoc Helper. It works ... but it involves a not trivial interface programming: it's really a workaround I'd be happy to substitute with a real straightforward solution where I just setup a variable with the new path for a target DB and some script step (Open File, or Open URL, or whatever) may successfully use it...
So my questions are:
- are the above a) thru e) approaches actually limited as I found them, or I'm missing something ?
- any suggestion to remove that cumbersome workaround I'm stuck with ?
Thanks a lot
Configuration: FMP Advanced 220.127.116.110, MacOS HighSierra 10.13.5, iMac 27i Late 2013